On Thu, 26 Sep 2013 14:14:57 -0700
Segundo Bob <[email protected]> wrote:
> On 09/26/2013 01:36 PM, Edward K. Ream wrote:
> > That's what I did.
> >
>
> Sorry, I misunderstood you because you did not point out any bugs in my
> program yet you implied that it contains bugs. I assumed that if you
> had modified my program, you would have noted the bugs you had to fix.
>
> My program is very, very simple:
>
> Using leoBridge:
> 1) Open a .leo file that does not yet exist.
So, is opening an non-existent file actually the right way to create a
file de novo from leoBridge? It fails for me as Segundo Bob reports.
I also tried
g = bridge.globals()
c = g.app.newCommander(None)
but that fails the same way, i.e.
p = c.rootPosition()
c.positionExists(p)
Out[19]: False
So perhaps the question should be "how do you create an empty outline
from leoBridge", not "why doesn't this code work".
This works:
import sys
sys.path.insert(0, './leo')
import leo.core.leoBridge as leoBridge
bridge = leoBridge.controller(gui='nullGui', verbose=False,
loadPlugins = False,readSettings = False)
g = bridge.globals()
c = bridge.createFrame('/tmp/test22_del.leo')
p = c.rootPosition()
c.positionExists(p) # False
c.frame.createFirstTreeNode()
p = c.rootPosition()
c.positionExists(p) # True
nd = p.insertBefore()
nd.h = "Before..."
c.save()
took some source reading to get there though.
Cheers -Terry
> 2) Get the root position for this file.
> 3) Create a child of the root position.
>
> The problem can actually be seen after step 2 because ptrRoot.v is None
> -- on my system.
>
> But on your system, after step 2, ptrRoot.v is a valid vnode?
>
> Do you still think my program contains bugs--even though it works on
> your system? Is my open statement incorrect? Is my get root position
> incorrect?
>
> Even though bridge.g.app.signon is the expected value, do you still
> think that my installation of Leo-Editor is screwed up and I'm using the
> wrong leoBridge or wrong some other part of Leo-Editor?
>
--
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.