On Friday, September 27, 2013 9:22:47 AM UTC-5, SegundoBob wrote:

> The call to cmdr.frame.createFirstTreeNode() seems to be the crucial 
operation required when creating a new Leo-Editor file with leoBridge.

That's a bug, imo.  bridge.openLeoFile should call 
c.frame.createFirstTreeNode automatically.  createFirstTreeNode is an 
internal helper, not intended for outside use.

This bug has been fixed at rev 6072. Here is the checkin log:

Fixed bug in leoBridge: bridgeController.createFrame now calls 
frame.createFirstTreeNode for new frames.

And here is a test that demonstrates the new code::

    import sys
    sys.path.insert(0,'c:/leo.repo/trunk/leo')
    import leo.core.leoBridge as leoBridge
    print(leoBridge)
    cc = leoBridge.controller(gui='nullGui',verbose=False)
    path = 'c:/Users/edreamleo/does-not-exist.leo'
    c = cc.openLeoFile(path)
    root = c.rootPosition()
    assert root
    root.h = 'root'
    p = root.insertAsLastChild()
    'A'
    assert p
    for p in c.all_positions():
        print(p.h)

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to