On 19 May, 2009, at 3:51, Kevin Walzer wrote:
I'm trying to patch IDLE to work better with the Cocoa fork of Tcl/ Tk. With Tk-Cocoa, in order to correctly set up the Apple/ Application menu, you have to call the equivalent of 'self.configure(menu=menubar)' after everything else is set up. Otherwise the hard-coded "About Tcl/Tk" menu item remains, and the menu override is moved to the very end of the menu, after "Help." (So there are two "IDLE" menus under this scenario.)In macosxSupport.py, in the function overrideRootMenu(), there is a call to root.configure(menu=menubar); I thought moving this to the end of the function would work. However, no matter where this line is set, it has no effect; the overridden IDLE menu still sits at the end of the menubar. My question is, where in idlelib would be the best place to call this configuration option to ensure that the entire menu is built before it is bound/set to the root menu? There are many calls to macosxSupport.py in idlelib, and that's the "root" for overriding the Tk menu, so I thought that was where it should be done...but I'm not sure.Advice is appreciated. If I get this resolved, I'll submit a patch to support Tk 8.6, when Cocoa will move from a fork to trunk in Tk development.
I would have thought that overrideRootMenu is the right location for your change, that function should be called (by setupApp in the same function) by the time everything is set up (PyShell calls setApp just before opening the console window).
The IDLE codebase can be annoyingly hard to understand at times, which makes creating patches unnecesserily hard at times.
I'm afraid the only way to find the correct location for a patch is by trial and error, first try to hardcode a fix inline and when that works move the code to a function in macosxSupport.py.
Ronald
-- Kevin Walzer Code by Kevin http://www.codebykevin.com _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig