Apparently, there are a number of plugins that were designed in the Tk days
and that allowed clicks of various sorts to do things. John Lunzer points
out that all such usages could be considered bugs.
Imo, clicks in headlines are, or should be, second-class citizens. It's
never elegant to use the mouse, and questions of taste aside, anything that
can be done with a mouse click really should have a key-based alternative.
I wonder how many people realize that there is a generic act-on-node
command that plugins can appropriate as they like. I didn't, until I redid
the Commands Reference. Here is the docstring, as reported by F11
(help-for-command)::
Executes node-specific action, typically defined in a plugins as
follows:
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.
I'm not sure what happens if multiple plugins define act_on_node. Otoh,
multiple plugins could define an action that fires when the user
double-clicks an icon...
Hmm. Why not turn potential confusion to our advantage? Suppose the
act-on-node command brings up a menu of possible actions if several plugins
define act-on-node handlers. Even better, why not have act-on-node be
another way of bringing up the right-click menu defined by the contextmenu
plugin!
This has real promise:
- It's an extensible framework for adding arbitrarily many actions to a
node.
- Imo, it's a superior alternative to mouse clicking of various kinds.
- At a stroke, act-on-node becomes worthy of a default key binding.
Implementation should be easy:
- Leo will define a new 'act-on-node' event.
- The contextmenu plugin could easily be extended to handle 'act-on-node'
events.
- It would take very little work to replace 'click' handlers in plugins
with 'act-on-node' events.
- Double-clicks would be synonymous with 'act-on-node'.
No need right-click or control-click handlers.
The more I think about this, the better it seems. Your comments, please.
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.
For more options, visit https://groups.google.com/d/optout.