Hi,
I'm actually working on a Sphinx* plugin*.

*First why a plugin ? :*
Initially, I would like to implement Sphinx functionalities 
(menus+commands) inside a standalone .leo template file.
The basic aim to create a 'Sphinx' menu with 'make' submenu and subitems 
for every sphinx builders (make html, make epub..).
As there are more than a dozen builders, I thought about an unique 
"@command make" to which 'make' submenus could send 'builder' as argument...
But, I realized that it's *not possible to give args to @commands* (isn't 
it ?).
So I thought about scripting (@script) batch implementation of both menus 
and commands, but the auto-execution of @script need to be enabled into 
myLeoConfig.leo so doesn't fit the standalone .leo idea... 
So, not to write a dozen of almost identical menus and command, I decided 
to write directly a leoSphinx plugin.


*My actual issue :*
So while I'm learning the basic of leo plugins and I've the following 
problem :

I've a list of builder strings: 

builders = ['builder1', 'builder2'....]

And a make function (to simplify, let just print the builder):

def make(builder) :
   g.es(builder)


Now, how do I declare a new command for every builder ? 

I've tryed this :
    
    table = []
    for builder in builders:
        @g.command('make-'+builder)
        def mymakecommand(keywords):
           make(builder) 
        table.append((builder,None,'make-'+builder),)    
    c.frame.menu.createMenuEntries(makeMenu, table)


But obviously, all the created commands are linked to the last builder...

Could someone tell me what is the right way to create various commands that 
differs by the argument they give to the same function ?

-- 
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.

Reply via email to