This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE on OS X popup menus do not work: cannot set/clear breakpoints
Type: behavior Stage: resolved
Components: IDLE, macOS Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: r.david.murray Nosy List: Bruce.Sherwood, benjamin.peterson, eric.araujo, georg.brandl, kbk, ned.deily, r.david.murray, ronaldoussoren, taleinat, terry.reedy
Priority: critical Keywords:

Created on 2010-11-13 08:39 by ned.deily, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue10404-idle_no_context_menus.txt ned.deily, 2010-11-13 08:43
Messages (15)
msg121118 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-11-13 08:39
In several contexts, IDLE binds clicking of the right mouse button to context popup menus, most importantly, to provide the Set Breakpoint and Clear Breakpoint actions in edit windows.  On OS X systems, however, one cannot assume there will be more than one (e.g. the left) mouse button.  Further, Aqua Tk, the default on OS X, binds a right button if present to <Button-2>, rather than <Button-3> as with other Tk implementations and ignores <Button-3> bindings.  The net effect is that there is currently no way to use IDLE's breakpoint facility with Aqua Tk, with or without a multi-button mouse.
msg121119 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-11-13 08:43
The attached patch modifies IDLE on OS X to bind popup menus to Control-Click (of the main or "left" button), as is commonly done elsewhere in OS X.
msg121851 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-21 03:19
Platform consistency is a worthy criterion for changes, but I suspect such a behavior change can’t make it into stable branches.
msg121852 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-11-21 03:23
IMO, it's not s behavior change, it's a serious bug in the OS X version as released in the python.org installer.  Important functionality is broken.
msg121938 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-21 15:15
Apologies, I had misread your message: I thought the keybinding was wrong but working.  Your fix should be committed.
msg123559 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-12-07 15:58
The patch binds the menu to Ctrl-Button-1 (that is, the way you open context menu's on OSX systems with a single button), however rightclick still doens't work (but does an X11-style paste operation).

I propose adding an explicit binding for button-2 as well:

            text.bind("<Control-Button-1>",self.right_menu_event)
            text.bind("<Button-2>",self.right_menu_event)

This ensures that the context menu can be opened using the expected mouse button.

An IMO additional bonus is that the odd X11-style pasting behaviour is disabled (that is, right-click is no longer equivalent to Cmd-V), although one could claim that this breaks backward compatibility.
msg123572 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-12-07 18:04
Unfortunately, just adding the binding to <button-2> does not work because the Tk Text widget already has a documented binding of "paste-text" to <button-2> and this does not override that.  With the binding added, I found that the button-2 behavior for breakpoints did not work correctly as both events would be triggered and the resulting breakpoint lines were incorrect.  That, plus the compatibility issue, is why I thought it best to just stick to control-click.
msg123594 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-12-08 08:21
Yet another prove of how much Tk sucks on OSX.

I'm not too happy about only binding Ctrl+<button-1>, because users will expect that this is means that <button-2> works as well. But if we cannot disable the default <button-2> binding we'll have to live with this crap.
msg123595 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-12-08 08:21
Oops, 's/prove/proof/'
msg123596 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-12-08 09:00
It could be worse.  As I noted in Issue10405, the IDLE breakpoint facility appears to be officially undocumented on any platform so it's hard to know what users' expectations are.  And there are still Macs out there with only one button.  As a side note, there are still OS X X11 versions of Tkinter for current Python releases; for example, the default MacPorts Tk configuration is X11-based; it does have the advantage of working without quirks in 64-bit builds.
msg124244 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-12-17 18:13
I think this should be applied for 3.2 (and 2.7 and 3.1). The risk is low and the benefit to OS X IDLE users is great, since without it there is no way to use IDLE's breakpoint facility.
msg124296 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-12-18 17:01
Looks fine, David, do you want to commit?
msg124298 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-18 17:22
Committed to py3k in r87374, 3.1 in r87375, and 2.7 in r87376.
msg251383 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-09-23 01:16
Right click for context menu in Mac Aqua is fixed in ##24570.
msg251385 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-09-23 01:19
Sorry, #24801.
History
Date User Action Args
2022-04-11 14:57:08adminsetgithub: 54613
2015-09-23 01:19:24terry.reedysetmessages: + msg251385
2015-09-23 01:16:13terry.reedysetnosy: + terry.reedy
messages: + msg251383
2010-12-18 17:22:51r.david.murraysetstatus: open -> closed
nosy: georg.brandl, kbk, ronaldoussoren, taleinat, benjamin.peterson, ned.deily, eric.araujo, r.david.murray, Bruce.Sherwood
messages: + msg124298

resolution: fixed
stage: patch review -> resolved
2010-12-18 17:01:14georg.brandlsetassignee: ronaldoussoren -> r.david.murray

messages: + msg124296
nosy: + r.david.murray
2010-12-17 18:13:03ned.deilysetnosy: + georg.brandl
messages: + msg124244
2010-12-08 09:00:17ned.deilysetmessages: + msg123596
2010-12-08 08:21:54ronaldoussorensetmessages: + msg123595
2010-12-08 08:21:33ronaldoussorensetmessages: + msg123594
2010-12-07 18:04:31ned.deilysetmessages: + msg123572
2010-12-07 15:58:41ronaldoussorensetmessages: + msg123559
2010-11-21 15:15:20eric.araujosetmessages: + msg121938
2010-11-21 07:58:34ned.deilylinkissue7226 superseder
2010-11-21 03:23:38ned.deilysetmessages: + msg121852
2010-11-21 03:19:24eric.araujosetnosy: + eric.araujo, benjamin.peterson
messages: + msg121851
2010-11-13 08:55:31ned.deilysetnosy: + kbk, taleinat, Bruce.Sherwood
2010-11-13 08:43:22ned.deilysetfiles: + issue10404-idle_no_context_menus.txt

messages: + msg121119
2010-11-13 08:39:21ned.deilycreate