On 5/14/2013 10:05 AM, Edward K. Ream wrote:
On Tue, May 14, 2013 at 8:54 AM, Jacob Peck <[email protected] <mailto:[email protected]>> wrote:

> I'm still fairly lost as to how to actually add things to the existing menubar... how do I get at the leoQtMenu instance? Or do I create a new one? I could manipulate c.frame.top.menuBar directly, I suppose, but that's not what I want to do - it goes against the API you just showed me.

Excellent question.  You understand the issues completely.

It's ok with me if you do just use c.frame.top.menuBar directly. It would make your plugin Qt specific, but that's a minor point.

To get a particular menu, use the getMenu command in leoMenu.py: Here it is::

    def getMenu (self,menuName):
        cmn = self.canonicalizeMenuName(menuName)
        return self.menus.get(cmn)

The call to canonicalizeMenuName means that you don't have to worry about capitalization or other cruft (like ampersands) in the menu name you pass as menuName.

EKR
--
I found that c.frame.menu gives me a leoQtMenu instance... but then I gave up. Menus aren't all that terribly important to me at the moment.

However, my printing plugin is ready! It offers 12 printing-related commands, allowing for printing nodes (with or without headlines) and expanded scripts. It also offers print preview capabilities, so that you're not caught off guard.

I'll submit a merge request once I've cleaned it up a bit and made sure the unit tests pass.

-->Jake

--
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?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to