[Pythonmac-SIG] Patch to IDLE

Kevin Walzer kw at codebykevin.com
Tue May 19 17:14:21 CEST 2009


Ronald Oussoren wrote:

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

You are right, the codebase is complex.

Setting aside the application/apple menu for the moment, I've run into 
another issue. With Tk-Cocoa, the "help" menu automagically adds a menu 
entry for an Apple help book, and pops up a dialog saying "Help isn't 
available for Foo.app." I think PyObjC does something similar; it's the 
default behavior for the help menu in Cocoa. However, if the app defines 
its own help command (as IDLE does), then you have two "help" commands 
under the help menu--the useless Cocoa command and the IDLE-defined one.

The workaround is to rename the "help" menu to something else, i.e. 
"helpdocs"; this avoids the empty Cocoa help command. I've tried this at 
various points in the IDLE code (Bindings.py, EditorWindow.py), and it 
seems to work. However, I'm not sure if doing this would break IDLE on 
other platforms.

Simply re-naming the "help" menu to something else is preferable and 
simpler to wrapping the menu_specs dict in a lot of platform-specific 
logic: I've tried adding some "if macosxSupport.runningAsOSXApp():" 
lines to the code, but that crashes IDLE at various points. Any advice 
here?

--Kevin
-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com


More information about the Pythonmac-SIG mailing list