On Tue, May 21, 2013 at 8:00 AM, Fidel Pérez <[email protected]> wrote:

> Another quick question on the same topic:
>
> How to call a function within a plugin?
>

Great question.

The best solution, in general, is to create a per-commander controller
class.  See::

    leoPlugins.leo#Plugins-->  Templates-->
    Template for plugins with per-commander controller class

Then, in event handlers, the code will be something like this::

def handle_event(keywords):

    c = keywords.get('c')
    if c:
        << handle the event >>

There are many examples of this pattern in leoPlugins.leo.  Just search for
.get('c') or .get("c")

HTH

Edward

-- 
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?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to