Now it works. But I have 3 minor problems:

1. The first time I load leo 2 buttons are created instead of 1:

http://live-wtr.ru/1.png

2. When I click 1 button upload function is called twice. It means,
that onCreate function is called twice for some reason.

3. When I open another instance of leo with node "@data ftp" another 2
buttons are created.

Here is the code:

def init ():
    leoPlugins.registerHandler('after-create-leo-frame',onCreate)
    return True


def onCreate (tag, keys):
    c = keys.get('c')
    if not c: return
@
here I want to check, whether the node @data ftp exists in the file,
that is being opened. If it exists, create a button and register
@c
    p = g.findTopLevelNode(c, '@data ftp')
    if p != None:
        controller = pluginController(c)


class pluginController:
def __init__ (self,c):
    self.c = c

    ib_w = self.c.frame.iconBar.w
    action = QtGui.QAction('Upload', ib_w)
    action.connect(action, QtCore.SIGNAL("triggered()"), self.upload)
    self.c.frame.iconBar.add(qaction = action, command = self.upload)

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