I am trying to write my first plugin but can not figure out the
details from the Writing Plugins part of  the Leo web site.

Is there a basic template, or can someone suggest a simple working
plugin I could modify ?    Note I want to create a Alt-X command and
also add a function that can be used in an outline's scripts (after
enabling the plugin)

Or just help me fix the simple mytest plugin below

import leo.core.leoGlobals as g
import datetime

def init():
    g.registerHandler('mytest', mytest)
    g.es('Loading mytest plugin')
    g.plugin_signon(__name__)
    return True

def mytest(msg=None):
    dt0= datetime.datetime.now()
    msg1= 'Test on %s' % dt0
    g.es(msg1)
    if msg:
        g.es(msg)
    g.es('\n')


I am completely unsure about
    g.registerHandler('mytest', mytest)

I had hoped this would bind the mytest() function to the command
'mytest'
but it does not.

I also can not call mytest() in scripts, although the plugin loads
without an error message

Is there a particular namespace needed.  I tried mytest(),
mytest.mytest(), g.mytest()

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