And finally got the solution!! =)
Sample working code on how to create menu, buttons on the menu, then delete
them:
#Get the menu in case it alread exists
MenuToDelete = c.frame.menu.createNewMenu('Programming')
def MyCommand():
g.es('yeah')
#Add command to the menu. It will add it with the corresponding hotkey,
number [c.db['Button_NextID']] from the string 1234... etc
c.add_command(c.frame.menu.getMenu('Programming'), label = "%s %s" %
('1234567890QWERTYUIOPASDFGHJKLZXCVBNM'[c.db['Button_NextID']],c.db['Button_NextStatusLine']),
command=MyCommand, underline=0)
#And now we delete the button range we want on the menu:
MenuToDelete .delete_range(MenuToDelete ,0,2)
On Wednesday, June 19, 2013 12:54:31 AM UTC+2, Fidel Pérez wrote:
>
> Well, I think I should be able to extract those functionalities from
> studying "file -> recent files" menu.
> It is located in leopyref.leo. This is the class:
>
> class RecentFilesManager
>
>
> The important part seems to be:
>
> # Delete all previous entries.
>> menu.deleteRecentFilesMenuItems(recentFilesMenu)
>> # Create the permanent (static) menu entries.
>> table = rf.getRecentFilesTable()
>> menu.createMenuEntries(recentFilesMenu,table)
>
>
> Tomorrow will go on studying and see if I can pop that one out.
>
> I would like to replicate that possibility, to add a list of commands with
> pre-set hotkeys such as "A B C D E F..." on the dinamic menu I will create,
> same as it already happens with the recent files menu.
>
>
>
--
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/groups/opt_out.