On Sat, Feb 28, 2009 at 6:29 PM, TL <[email protected]> wrote:
> I have not been able to find any documentation on the current act-on-
> node functionality and how it would be applied to achieve specific
> plugin scenarios. I think the best place for this would be the
> "Chapter 13: Writing Plugins" web page of the Leo Users Guide. Any
> chance this can be added?
This is because it's only been around for a very short while. I can
document it, but the discussion about the merits of the feature is
still ongoing and new viewpoints are still coming (and I haven't
pushed the default keyboard binding yet).
In the meantime, the docstring should be enough to actually use it,
since it's really quite simple:
def actOnNode(self, event):
""" Execute node-specific action (typically defined by plugins)
Actual behaviour is to be defined by plugins.
Here's how to define actions for nodes in your plugins::
import leo.core.leoPlugins
def act_print_upcase(c,p,event):
if not p.h.startswith('@up'):
raise leo.core.leoPlugins.TryNext
p.h = p.h.upper()
g.act_on_node.add(act_print_upcase)
This will upcase the headline when it starts with @up.
--
Ville M. Vainio
http://tinyurl.com/vainio
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---