classification
Title: IDLE only customizes correctly for OS X when using framework build
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.5, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: Todd.Rovito, ned.deily, python-dev, roger.serwy, ronaldoussoren, terry.reedy
Priority: normal Keywords: patch

Created on 2013-04-08 00:14 by Todd.Rovito, last changed 2014-03-28 04:07 by ned.deily. This issue is now closed.

Files
File name Uploaded Description Edit
issue17654.patch ned.deily, 2014-02-10 10:32 review
Messages (9)
msg186257 - (view) Author: Todd Rovito (Todd.Rovito) * Date: 2013-04-08 00:14
IDLE's new right click menu doesn't seem to be working on Mac OS X.  I am running OS X 10.8.3 with TK version 8.5.9 (which I think is what OS X 10.8.3 ships with). The right click activation I am trying is control-click.
msg186258 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-04-08 00:51
It works OK as long as you are running Python from a framework build (--enable-framework).  There are various OS X customizations in IDLE that are currently triggered by the runningAsOSXApp() function in idlelib/macosxSupport.py.  One of the customizations is to add the event binding for <Control-Button-1> (in idle lib/EditorWindow.py).  Restricting the customizations to framework builds is not useful nor correct and there are some other questionable customizations assumptions made in that module.  I'll work up a patch.  In the meantime, you can easily workaround it for testing by patching runningAsOSXApp to always return True.
msg186500 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-04-10 14:51
The trigger for the customizations is probably too specific. The primary reason for a having a check that's more specific than 'if sys.platform == "darwin"' is to avoid using the customizations when someone uses an X11 build of Tk and I didn't know (and still don't) a way to check for a "native" Tk port.
msg210820 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-02-10 10:32
Here's a patch that refactors many of the OS X customizations in IDLE based on more granular criteria, e.g. those that should apply to all Tk implementations vs those that depend on specific ones (Cocoa Tk, Carbon Tk, or X11 Tk) rather than the bogus current framework test.  This should fix the specific problem of the control-click menu not appearing in non-framework builds along with various other issues such as missing menu items when using an X11 Tk on OS X.  It does not address the issue of providing the OS X specific key set with a non-framework build: Issue20580 addresses that.
msg210823 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-02-10 10:52
(Just to be clear, the Tk situation on OS X has changed substantially since the original customizations were added by Ronald.  So the checks weren't bogus initially.  And I've modified some of them subsequently before understanding some of the "nuances" of the various Tk implementations.)
msg215007 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-03-27 23:58
If there are no objections, I'd like to commit this cleanup soon.  It should make things a bit easier for people testing IDLE from development builds on OS X and fix some long-standing bugs when linking with the Tk X11 variant on OS X.
msg215010 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-03-28 00:39
If I understand the Bindings.py patch, the fragility changed from "If you edit menudefs, edit the Mac block that follows" to "If you change (e sections of) menudefs, edit macosxSupport.overrideRootMenu". That seems like a wash to me, except for the narrowing down of which sections might later be patched.

Every thing else that is not a change to macosSupport is guarded by macosSupport.xxx or 'darwin', so none from me.
msg215016 - (view) Author: Roundup Robot (python-dev) Date: 2014-03-28 03:52
New changeset f551740c26b6 by Ned Deily in branch '2.7':
Issue #17654: Ensure IDLE menus are customized properly on OS X for
http://hg.python.org/cpython/rev/f551740c26b6

New changeset 67a7a49e7b78 by Ned Deily in branch '3.4':
Issue #17654: Ensure IDLE menus are customized properly on OS X for
http://hg.python.org/cpython/rev/67a7a49e7b78

New changeset d8659dbebfd1 by Ned Deily in branch 'default':
Issue #17654: merge from 3.4
http://hg.python.org/cpython/rev/d8659dbebfd1
msg215017 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-03-28 04:07
Thanks for the review, Terry. The reasons for moving the menders changes are two.  As noted in the comments, the menudefs were being customized early in IDLE initialization before calling Tk to create the root object and, therefore, we did not know at that point which kind of Tk we were running under.  To properly customize, we need to know that, as we are now more careful to customize menus depending on the OS X Tk variant.  Also, there already were other menu customizations being done in macosxSupport; now it is all in one place. It would be nice to reduce the fragility in the menu management. I would encourage anyone interested in working on IDLE to tackle it as a separate issue.

Applied for release in 3.5.0, 3.4.1, and 2.7.7.
History
Date User Action Args
2014-03-28 04:07:20ned.deilysetstatus: open -> closed
resolution: fixed
messages: + msg215017

stage: commit review -> resolved
2014-03-28 03:52:03python-devsetnosy: + python-dev
messages: + msg215016
2014-03-28 00:39:37terry.reedysetmessages: + msg215010
2014-03-27 23:58:17ned.deilysetversions: + Python 3.5, - Python 3.3
nosy: + terry.reedy

messages: + msg215007

stage: patch review -> commit review
2014-02-10 10:52:53ned.deilysetmessages: + msg210823
2014-02-10 10:32:11ned.deilysetfiles: + issue17654.patch
keywords: + patch
messages: + msg210820

stage: needs patch -> patch review
2013-04-10 14:51:15ronaldoussorensetnosy: + ronaldoussoren
messages: + msg186500
2013-04-08 00:54:28ned.deilysetassignee: ned.deily
stage: needs patch
title: IDLE: Right click menu not working on OS X -> IDLE only customizes correctly for OS X when using framework build
versions: + Python 3.3
2013-04-08 00:51:46ned.deilysetmessages: + msg186258
2013-04-08 00:14:56Todd.Rovitocreate