I recently upgraded to version 4.7.1 (from 4.5.x) on both a Windows
machine and an Ubuntu machine. I have been using the script node code
below to implement a poor-man's PIM, but now the script doesn't work.
I use tkinter on Windows, and qt on Ubuntu. Though I'm sure I could
fix the problems if I spend enough time tracing it out, I'm pressed
for time right now and would be grateful if someone could give me a
quick solution.

Thanks!

Here's the code:

@
Place clones of nodes (that should have hoist buttons created for them
automatically) below this node.
@c
from mod_scripting import scriptingController
sc = scriptingController(c)

def FindNextClone(c):
    if not c: return c
    if not c.isCloned(): return c
    v = c.threadNext()
    while v and v.t != c.t:
        v = v.threadNext()
    if not v:
        # Wrap around.
        v = c.rootVnode()
        while v and v != c and v.t != c.t:
            v = v.threadNext()
    if v:
        return v
    else:
        return c

c.frame.addIconRow()
first = True
for node in p.following_siblings_iter():
    if first:
        first = False
        continue
#for node in p.children_iter():
    #node = FindNextClone(node)
    h = node.headString()
    buttonText = sc.getButtonText(h)
    statusLine = "Hoist %s" % h
    b = sc.createIconButton(text=buttonText,
                            command=None,
                            shortcut=None,
                            statusLine=statusLine,
                            bg='yellow')
    def deleteButtonCallback(event=None,sc=sc,b=b):
        sc.deleteButton(b)

    def hoistButtonCallback (event=None,c=c,p=node.copy()):
        while (c.canDehoist()):
            c.dehoist()
        c.selectPosition(p)
        c.hoist()

    b.configure(command=hoistButtonCallback)
    b.bind('<3>',deleteButtonCallback)

-- 
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