On Sun, 30 Oct 2011 11:33:14 -0700 (PDT)
SegundoBob <[email protected]> wrote:

> > You show your code in a button - calls to g.openWithFileName()
> > triggered when a user clicks on a button aren't reentrant, only calls
> > run on load from a @script node would be reentrant, so (1) may not
> > be relevant anyway.
> 
> I'm not sure what you mean.  Do you mean that when
> g.openWithFileName() is called by @script code, g.openWithFileName()
> returns before the open is completed. But when g.openWithFileName() is
> called by @button code, g.openWithFileName() finishes the open before
> it returns?

Essentially - there's nothing reentrant about sequential calls to
g.openWithFileName() in a @button.  @script nodes are run during file
opening, which I assume means they're run from within
g.openWithFileName(), hence reentrant.  But reentrant doesn't mean it
doesn't work.

# not reentrant
l = []
def extend_list(l):
    l.append(0)
    
while len(l) < 5:
    extend_list(l)

# reentrant but does the same thing
l = []
def extend_list(l):
    l.append(0)
    if len(l) < 5:
        extend_list(l)
        
extend_list(l)


> This does seem to be the case, and I missed it when I wrote and
> "tested" my code.  That is, the only error symptom I see when
> g.openWithFileName() is called by @button code is that the
> c.frame.bringToFront() at the end does not work (The focus stays on
> the tab for the last file opened.).  This symptom also occurs when my

Perhaps because you pull c from the after-create-leo-frame event
parameters (cmdr = keywords.get('c')).  You just want to take note of
the c that's active when the button's clicked, and
call .frame.bringToFront() on that one at the end.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to