Maybe you should using different decorators.

No, it doesn't work.  In ​leo/commands/helpCommands I replaced:​
>
> def cmd(name):
>     '''Command decorator for the helpCommands class.'''
>     return g.new_cmd_decorator(name,['c','helpCommands',])
>
> with cmd = g.cmd where g.cmd is defined as you suggest, except it makes 
> entries in g.global_commands_dict.  I also added traces.
>
> After thinking a little about this problem:
Maybe you are trying to pack too much into one decorator. My solution 
wasn't meant to work with a variable list of  additional parameters (i.e. [
'c','helpCommands',]), but only with a variable number of names (aka 
synonyms).

I don't know how many commands are involved that need additional parameters 
(i.e. your key bindings). But instead of making case distinctions in your 
command dispatch function you could use two decorators:

@keybinding('F12')
@command('help-for-leo')
defhelpForLeo(self):
    ...

The '@keybinding' decorator could then access the global_command_table 
enhance the command.
This would make your intentions explicit and simplify the command dispatch 
function.

Reinhard

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to