On Jul 17, 5:38 pm, Terry Brown <[email protected]> wrote:
> On Sun, 17 Jul 2011 17:00:26 -0700
>
> I think if you plugin provides a command like this (at top level in
> module):
>
> @g.command('my-new-command')
> def do_thing(event):
>
> c = event.get('c')
> if not c:
> return
> c.my_plugin_controller.do_thing()
>
> then a binding like
>
> my-new-command = Ctrl-B
>
> in the @shortcuts node in the @keys node in the @settings node should
> work. I have a couple of things running that way.
Terry,
Thanks for suggesting that I use the @g.command('my-new-command')
decorator. But I'm stuck on the same issue you raised here:
http://groups.google.com/group/leo-editor/tree/browse_frm/thread/a83082cec5ad3df8/14579985c620ce70?rnum=1&_done=%2Fgroup%2Fleo-editor%2Fbrowse_frm%2Fthread%2Fa83082cec5ad3df8%2F14579985c620ce70%3Ftvc%3D1%26#doc_7a58cc87cd22eaca
That is, my command function needs to be a method. That is, my
command function needs the instance of my plugin class that gives my
command function access to my plugin's static/global information.
I'm afraid the problem is a hard. I tried just putting
"g.app.global_commands_dict['clone-nav'] = self._buttonClicked" into
my __init__() method. This put my function into the global commands
list all right, but I still could not assign a shortcut to the
function in myLeoSettings.leo. At this point I realized that my
plugin can't initialize itself till after a Leo frame is created and
myLeoSettings.leo is (must be?) processed before a Leo frame is
created.
Hence, I doubt that there is any way to allow my commands to be
assigned shortcuts in myLeoSettings.leo.
--
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.