Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE only customizes correctly for OS X when using framework build #61854

Closed
rovitotv mannequin opened this issue Apr 8, 2013 · 9 comments
Closed

IDLE only customizes correctly for OS X when using framework build #61854

rovitotv mannequin opened this issue Apr 8, 2013 · 9 comments
Assignees
Labels
topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@rovitotv
Copy link
Mannequin

rovitotv mannequin commented Apr 8, 2013

BPO 17654
Nosy @terryjreedy, @ronaldoussoren, @ned-deily, @serwy, @rovitotv
Files
  • issue17654.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ned-deily'
    closed_at = <Date 2014-03-28.04:07:20.148>
    created_at = <Date 2013-04-08.00:14:55.947>
    labels = ['expert-IDLE', 'type-bug']
    title = 'IDLE only customizes correctly for OS X when using framework build'
    updated_at = <Date 2014-03-28.04:07:20.147>
    user = 'https://github.com/rovitotv'

    bugs.python.org fields:

    activity = <Date 2014-03-28.04:07:20.147>
    actor = 'ned.deily'
    assignee = 'ned.deily'
    closed = True
    closed_date = <Date 2014-03-28.04:07:20.148>
    closer = 'ned.deily'
    components = ['IDLE']
    creation = <Date 2013-04-08.00:14:55.947>
    creator = 'Todd.Rovito'
    dependencies = []
    files = ['34018']
    hgrepos = []
    issue_num = 17654
    keywords = ['patch']
    message_count = 9.0
    messages = ['186257', '186258', '186500', '210820', '210823', '215007', '215010', '215016', '215017']
    nosy_count = 6.0
    nosy_names = ['terry.reedy', 'ronaldoussoren', 'ned.deily', 'roger.serwy', 'Todd.Rovito', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue17654'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @rovitotv
    Copy link
    Mannequin Author

    rovitotv mannequin commented Apr 8, 2013

    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.

    @rovitotv rovitotv mannequin added topic-IDLE type-bug An unexpected behavior, bug, or error labels Apr 8, 2013
    @ned-deily
    Copy link
    Member

    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.

    @ned-deily ned-deily changed the title IDLE: Right click menu not working on OS X IDLE only customizes correctly for OS X when using framework build Apr 8, 2013
    @ned-deily ned-deily self-assigned this Apr 8, 2013
    @ronaldoussoren
    Copy link
    Contributor

    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.

    @ned-deily
    Copy link
    Member

    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: bpo-20580 addresses that.

    @ned-deily
    Copy link
    Member

    (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.)

    @ned-deily
    Copy link
    Member

    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.

    @terryjreedy
    Copy link
    Member

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 28, 2014

    New changeset f551740c26b6 by Ned Deily in branch '2.7':
    Issue bpo-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 bpo-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 bpo-17654: merge from 3.4
    http://hg.python.org/cpython/rev/d8659dbebfd1

    @ned-deily
    Copy link
    Member

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants