On Mon, 1 Aug 2011 19:28:48 -0700 (PDT) mdb <[email protected]> wrote:
> I need help understanding howthe context_menu plugin works and I have > some questions > > --Does the context_menu.py plugin automatically determine where to > place each contextmenu command as either a right click Headline item > or a right click Body item? What other 'context' are available and > is the potential placement listed anywhere ? Also can an item be > in two or more right click menus? I don't think the context menu plugin handles the body context menu, I think that's just the default Qt text editor context menu (on the body). > One reasons I ask is because I expected copy-text to work as a body > command but it only shows up as a Headline item I only see th opposite. Copy is in the body context menu, no in the headline context menu. > --Where are the default context items shown (i.e. documented)? > With a right click on a Headline I see Edit, Open, Delet and Mark and > I'd like to remove some of these I think those defaults/examples are hardwired in to the context_menu.py plugin. > --I assume that more than mini buffer commands are valid as context > menu items and I can I write script to serve as an item. But I am > confused by these directions at > http://webpages.charter.net/edreamleo/plugins.html#contextmenu-py > > And call this in your plugin once: > > g.tree_popup_handlers.append(nextclone_rclick) > > Where is g.tree_popup_handlers.append( .. ) placed? a > myplugins.py file maybe? The context menu plugin provides a mechanism for other plugins to add items to the context menu. You could write your own plugin with a 'add_minibuffer_commands' function, and then call g.tree_popup_handlers.append(add_minibuffer_commands) from the init() (not __init__) function in the module of your plugin. > I see the node << Add commands >> under install_handlers in the > @file contextmenu.py plugins node > but I prefer to not modify the contextmenu.py file To add things you don't need to, you need to provide your own plugin which add what you want added. I think Leo searches the python path for plugin modules, so this wouldn't have to be in the distribution. To remove things, your plugin could manipulate the menu items in the menu passed in to the function you append to g.tree_popup_handlers. Cheers -Terry -- 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.
