Issue 1207589: IDLE: Right Click Context Menu (original) (raw)
Created on 2005-05-24 08:31 by michael.foord, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (34)
Author: Michael Foord (michael.foord) *
Date: 2005-05-24 08:31
It would be useful if the right click context menu had the usual 'cut/paste/copy' options - as in most other IDEs.
I regularly lose my selection because IDLE doesn't behave the same way as most other editors in this regard.
Author: Raymond Hettinger (rhettinger) *
Date: 2005-05-26 07:06
Logged In: YES user_id=80475
+0
Control-X, Control-C, and Control-V work fine for me.
Still, the OP's suggestion is a standard way of doing things.
Author: Michael Foord (michael.foord) *
Date: 2005-05-26 07:46
Logged In: YES user_id=1123892
It's a standard way of doing things (and so an ingrained habit for at least windoze users) - and also if you're using the mouse to make a selection and then change focus to another window to paste into it; it's easier to be able to do the whole operation with the mouse than change to the keyboard and back again.
Author: Kurt B. Kaiser (kbk) *
Date: 2005-05-26 15:38
Logged In: YES user_id=149084
This came up on idle-dev, as I remember.
Seems like a reasonable suggestion to me.
Maybe OP could write a patch? All the pertinent code should be in EditorWindow.py.
Author: Nashev (Nashev)
Date: 2008-01-10 12:31
- in file EditorWindow.py 2 editings:
a) remove selection-killer command on popup
def right_menu_event(self, event):
-- self.text.tag_remove("sel", "1.0", "end")
b) add ability to make separators in popup menu
def make_rmenu(self):
rmenu = Menu(self.text, tearoff=0)
for label, eventname in self.rmenu_specs:
++ if label != "-": def command(text=self.text, eventname=eventname): text.event_generate(eventname) rmenu.add_command(label=label, command=command) ++ else: ++ rmenu.add_separator() self.rmenu = rmenu
in PyShell.py extend rmenu_specs
rmenu_specs = [
++ ("Cut", "<>"), ++ ("Copy", "<>"), ++ ("Paste", "<>"), ++ ("-", ""), ("Set Breakpoint", "<>"), ("Clear Breakpoint", "<>") ]
done...
And now I can't find easy way to next two desired features:
- disable cut/copy commands in case no selection (but it is not exists in main menu too)
- display assigned hot keys in popup menu
Author: Guilherme Polo (gpolo) *
Date: 2009-08-10 17:46
What do you think about adding a third element for each tuple in rmenu_specs ? This new element would be a string determining the name of a function that would be called to define the state of each entry in the right menu. If None is used in place of a string, then it is assumed that the entry doesn't require such thing.
Attaching a patch that does that. It also adds cut/copy/paste to the right menu in IDLE shell.
Author: Guilherme Polo (gpolo) *
Date: 2009-08-10 17:48
- display assigned hot keys in popup menu
Is that really necessary ? I've looked for that on some applications I use most and none of them include hot keys in right menus.
Author: Tal Einat (taleinat) *
Date: 2010-07-20 14:12
I agree with Guilherme: shortcuts don't need to appear in the context menu.
Guilherme's patch looks pretty good overall, but I have a few remarks:
Pasting should be disabled in the Shell window when the cursor is before the I/O mark. (the behavior for cutting is correct)
Code relevant to the Shell window should be in PyShell, not in EditorWindow with a getattr(self, 'interp', None) check.
Tk.Text.compare can receive names of tags to compare (don't have to do Tk.Text.index(''))
So I made these changes. Attached are patches against current trunk (2.x) and py3k branch.
My testing on Windows7 with both 2.7 and 3.1.2 showed this change works well. This should be tested on OSX and Linux since it interacts with the clipboard, which works differently on these platforms.
Author: Nashev (Nashev)
Date: 2012-08-22 07:13
display assigned hot keys in popup menu is must-have feature, that allow users to teach them while using commands by menu or by context menu. For examples look Delphi IDE
Author: Todd Rovito (Todd.Rovito) *
Date: 2012-10-19 01:51
I used taleinat's patch as the start for a patch that works with 3.4. Lots of code was changed from 2010 to 2012 so I basically hand merged the patch into 3.4. This patch was tested with Python 3.4.0a0 on both Mac OS X and Linux. As suggested by taleinat and Guilherme the shortcuts keys are not included in the context menu.
Author: Todd Rovito (Todd.Rovito) *
Date: 2012-10-19 02:00
This time I ran make patchcheck on the patch and it corrected a single white space.
I used taleinat's patch as the start for a patch that works with 3.4. Lots of code was changed from 2010 to 2012 so I basically hand merged the patch into 3.4. This patch was tested with Python 3.4.0a0 on both Mac OS X and Linux. As suggested by taleinat and Guilherme the shortcuts keys are not included in the context menu.
Author: Todd Rovito (Todd.Rovito) *
Date: 2012-10-19 02:43
I used taleinat's patch as the start for a patch that works with 2.7. Lots of code was changed from 2010 to 2012 so I basically hand merged the patch into 2.7. This patch was tested with Python 2.7.3 on both Mac OS X and Linux. As suggested by taleinat and Guilherme the shortcuts keys are not included in the context menu.
Author: Todd Rovito (Todd.Rovito) *
Date: 2012-10-19 02:46
Changed the version to make it clear this issue as a patch for 3.4 and 2.7.
Author: Todd Rovito (Todd.Rovito) *
Date: 2012-10-21 03:21
Same patch as before but updated the documentation and help.txt file for IDLE. This is for Python 2.7.
Author: Todd Rovito (Todd.Rovito) *
Date: 2012-10-21 03:22
Same patch as before but updated the documentation and help.txt file for IDLE. This is for Python 3.4.
Author: Roundup Robot (python-dev)
Date: 2012-11-01 20:44
New changeset 639dd6e62de4 by Andrew Svetlov in branch '2.7': Issue #1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu http://hg.python.org/cpython/rev/639dd6e62de4
New changeset 66643fcf6ee9 by Andrew Svetlov in branch '3.2': Issue #1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu http://hg.python.org/cpython/rev/66643fcf6ee9
New changeset 3f3b72ab9d65 by Andrew Svetlov in branch '3.3': Merge issue #1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu http://hg.python.org/cpython/rev/3f3b72ab9d65
New changeset e6bf779111a8 by Andrew Svetlov in branch 'default': Merge issue #1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu http://hg.python.org/cpython/rev/e6bf779111a8
Author: Andrew Svetlov (asvetlov) *
Date: 2012-11-01 20:48
Committed. Thanks to all. Keeping in mind idlelib is a bit specific part of stdlib which cannot make backward incompatibility I've committed to 2.7, 3.2, 3.3 and 3.4.
Author: Ned Deily (ned.deily) *
Date: 2012-11-02 06:32
Andrew, this is clearly a new feature, not a bug. What is your rationale for adding it to the maintenance branches (2.7, 3.2, and 3.3)?
Author: Andrew Svetlov (asvetlov) *
Date: 2012-11-02 11:02
I thought it's desirable feature which cannot produce backward incompatibility problems. Can revert commits for 2.7-3.3 if needed.
Author: Todd Rovito (Todd.Rovito) *
Date: 2012-11-02 11:40
Ned, I respectfully disagree that this is not a new feature. IDLE could always copy/cut/paste from the edit menu and it had a right click menu. All this patch does is add options to right click menu and call the same functions as the edit menu does. I could be biased because I worked on the patch and I am a new contributor but I think Andrew's logic of commenting the patch makes sense. Python is a great scripting language but IDLE is really falling behind and it is often the first thing a user sees. Thanks for your attention in this matter and I will respect any solution you and Amdrew come up with.
Author: R. David Murray (r.david.murray) *
Date: 2012-11-02 12:00
The reason for our "no new features" policy is that if a program works with version x.y, it should work for all x versions (modulo failing on an earlier version because of a bug...and conversely if it works on x.y, it should work on all later versions of x, which is why we also sometimes don't fix certain bugs in maintenance releases).
In this case, if I understand correctly, there are no programs that can depend on the feature, just humans. So I think putting this in to bugfix releases is more analogous to the fixes-that-look-like-enhancements we occasionally put into the build infrastructure for Python itself (as opposed to distutils, which is governed by the normal backward compatibility rules).
So, it's a judgment call and other developers might not agree with me, but I think it is OK.
Author: Terry J. Reedy (terry.reedy) *
Date: 2012-11-02 14:30
It it not a new library feature that anyone would use in other code. I have been meaning to raise this issue on pydev to see what others think. There are advantages to keeping the human interaction with IDLE consistent between releases.
Author: Roger Serwy (roger.serwy) *
Date: 2012-11-02 16:13
In a strict sense, the patch does break backward compatibility for third-party IDLE extensions that modify the rmenu_specs contents. It is not a "private" value since it lacks an initial underscore in its name. But given how undocumented IDLE is, especially its extension facility, I don't think poses any problems.
(For what it's worth, I'm the developer of IdleX and I already released a trivial workaround for this change. I welcome this improvement to IDLE, especially when it deprecates an existing IdleX extension.)
While keeping UI consistency may be desirable, keeping it crippled is not. Even Window's Notepad has a decent right-click menu.
Author: R. David Murray (r.david.murray) *
Date: 2012-11-02 16:20
Ah. Well, we prefer to err on the side of strictness for backward compatibility, so I think we should treat this as an enhancement, then.
Author: Ned Deily (ned.deily) *
Date: 2012-11-02 17:15
I think it is clear that this is an enhancement. So then the question is: is there a good reason to make an exception here to the "no new features in maintenance releases" policy? David mentioned some considerations. I would add testing and documentation. Testing is a big concern with IDLE since IDLE is so dependent on Tk and we know from long experience that there can be differences among the various platform-specific Tk implementations (we currently support at least 4 different Tk varieties) and we have no standard automated tests for IDLE. So that increases the risk that we could break something in a maintenance release which we try really hard not to do. On the other hand, there is something to be said about maintaining compatibility as best as possible across IDLE version.
I'm not fundamentally opposed to including this enhancement in maintenance releases. But I think it is important to recognize that it is an exception to policy and to have this discussion about it. Personally, I'm +0 on the whole feature - it's not something I would use - so I don't really have a stake in it. I do have a bit of a stake in the testing part and for that reason I'm -0 on the backports. I'm glad to see Todd tested on Linux and OS X - presumably someone has tested on Windows. If the backports remain, the feature should at least be smoke-tested at some point on all four of the branches and with all of the major Tk versions (Windows, X11, OS X Cocoa Tk 8.5, OS X Carbon Tk 8.4). Since he has the most experience in this area, I'm willing to defer to Roger's judgement call on the impact of this change with regard to IDLE extensions.
Author: Terry J. Reedy (terry.reedy) *
Date: 2012-11-02 20:58
On pydev, I explained why I think the bug-enhancement policy does not necessarily apply to IDLE, starting the the fact that IDLE was treated as exceptional and not considered bound to normal policy when it was considered for deletion and ending with the fact that exclusionary dichotomous classification is inherently ambiguous in the absence of specification.
Leaving that aside, the right-click context menu is not mentioned in the brief Library manual chapter on IDLE. It is a GUI matter. I suspect that the docs also do not specify the right-click behavior of the standard interpreter either.
The apparent external GUI standard, at least on Windows, is that context menus have copy, cut, and paste entries as appropriate. I am pretty sure that this could be found in an MS document entitled something like Human Useability Guidelines. By that standard, it was a bug for those to be missing. I know Apple has interface standards docs also, but I don't know what the standard is.
For instance, Firefox has Cut Copy and Paste within this edit box, with the first two activated when a selection is made. Outside the edit box, only Cut appears, when a selection is active.
I think one could reasonably say that this feature is both a bug fix and an enhancement. After all, all bug fixes are enhancements and all enhancements fix the bug of their absence. We use documented intention to tip the scale one way or the other, but that is completely missing for this feature and mostly missing, except for existence and the common, non-Python-specific meaning of words like 'search box', for everything else.
Author: Andrew Svetlov (asvetlov) *
Date: 2012-11-02 22:01
I guess the schema: keep the current state a while. Please test context menu for all configurations you have.
If you will have any problem — commits will be reverted. If anybody will report about backward incompatibility problems — I'll revert changes.
Modifying IDLE extensions is not big deal if somebody need it.
Author: Ned Deily (ned.deily) *
Date: 2012-11-03 00:10
"Leaving that aside, the right-click context menu is not mentioned in the brief Library manual chapter on IDLE."
FTR, as I pointed out on python-dev, this is no longer true. The IDLE section of the Standard Library documentation, as well as the IDLE help file, were updated by the changes for Issue10405. The changes committed for this issue (#1207589) further updated those to document this new feature. See for instance:
http://docs.python.org/2/library/idle.html#edit-context-menu
Author: Roger Serwy (roger.serwy) *
Date: 2012-11-03 03:19
On IDLE Extensions: The public ecosystem of IDLE extensions is small, and even smaller are those that modify rmenu_specs. Changing it is trivial. However, existing users of the Squeezer extension under 2.7 will experience bugs, like triggering on Windows.
It is possible to make the code in make_rmenu backwards compatible. The attached patch against 2.7 (and 3.4) does it.
Author: Andrew Svetlov (asvetlov) *
Date: 2012-11-03 08:44
LGTM
Author: Roundup Robot (python-dev)
Date: 2013-04-07 17:16
New changeset 3fad938e9d4e by Roger Serwy in branch '2.7': #1207589: Backwards-compatibility patch for right-click menu in IDLE. http://hg.python.org/cpython/rev/3fad938e9d4e
New changeset c26ec5897c5a by Roger Serwy in branch '3.3': #1207589: Backwards-compatibility patch for right-click menu in IDLE. http://hg.python.org/cpython/rev/c26ec5897c5a
New changeset 5219c1271156 by Roger Serwy in branch 'default': #1207589: merge with 3.3. http://hg.python.org/cpython/rev/5219c1271156
Author: Todd Rovito (Todd.Rovito) *
Date: 2013-04-07 23:39
Very strange but I noticed the right click menu is not working on Mac OS X. Before and after Roger's latest backwards_compat.patch. I must be losing my mind but I thought this was working on OS X. The right click activation I am trying is control-click and I am running 10.8.3.
Should I file a separate bug report for this issue?
Author: Roger Serwy (roger.serwy) *
Date: 2013-04-07 23:58
Please do open a separate issue. We'll resolve it there.
Author: Todd Rovito (Todd.Rovito) *
Date: 2013-04-08 00:05
No problem I will open a separate issue. Hopefully it is a mistake on my end and I have something dorked up.
History
Date
User
Action
Args
2022-04-11 14:56:11
admin
set
github: 42008
2013-04-08 00:05:29
Todd.Rovito
set
messages: +
2013-04-07 23:58:12
roger.serwy
set
messages: +
2013-04-07 23:39:42
Todd.Rovito
set
messages: +
2013-04-07 17:16:59
python-dev
set
messages: +
2012-11-03 08:44:14
asvetlov
set
messages: +
2012-11-03 03:19:48
roger.serwy
set
files: + backwards_compat.patch
messages: +
2012-11-03 00:10:07
ned.deily
set
messages: +
2012-11-02 22:01:36
asvetlov
set
messages: +
2012-11-02 20:58:04
terry.reedy
set
messages: +
2012-11-02 17:15:05
ned.deily
set
messages: +
2012-11-02 16:20:34
r.david.murray
set
messages: +
2012-11-02 16:13:01
roger.serwy
set
messages: +
2012-11-02 14:30:37
terry.reedy
set
messages: +
2012-11-02 12:00:20
r.david.murray
set
nosy: + r.david.murray
messages: +
2012-11-02 11:40:05
Todd.Rovito
set
messages: +
2012-11-02 11:02:53
asvetlov
set
messages: +
2012-11-02 06:34:40
georg.brandl
set
nosy: + georg.brandl
2012-11-02 06:32:44
ned.deily
set
nosy: + ned.deily
messages: +
2012-11-01 20:48:13
asvetlov
set
status: open -> closed
versions: + Python 3.2, Python 3.3
messages: +
resolution: accepted -> fixed
stage: patch review -> resolved
2012-11-01 20:44:58
python-dev
set
nosy: + python-dev
messages: +
2012-11-01 13:23:24
asvetlov
set
nosy: + asvetlov
2012-10-21 03:22:13
Todd.Rovito
set
files: + RightClickContextMenuUpdatedWithDocs3point4.patch
messages: +
2012-10-21 03:21:41
Todd.Rovito
set
files: + RightClickContextMenuUpdatedWithDocs2point7.patch
messages: +
2012-10-21 03:20:33
Todd.Rovito
set
files: - RightClickContextMenuUpdatedFor2point7.patch
2012-10-21 03:20:26
Todd.Rovito
set
files: - RightClickContextMenuUpdatedFor3point4.patch
2012-10-19 02:46:21
Todd.Rovito
set
messages: +
versions: + Python 3.4
2012-10-19 02:43:48
Todd.Rovito
set
files: + RightClickContextMenuUpdatedFor2point7.patch
messages: +
versions: + Python 2.7, - Python 3.4
2012-10-19 02:00:29
Todd.Rovito
set
files: + RightClickContextMenuUpdatedFor3point4.patch
messages: +
2012-10-19 01:57:34
Todd.Rovito
set
files: - RightClickContextMenuUpdatedFor3point4.patch
2012-10-19 01:52:01
Todd.Rovito
set
files: + RightClickContextMenuUpdatedFor3point4.patch
messages: +
2012-10-18 15:40:36
terry.reedy
set
title: Right Click Context Menu -> IDLE: Right Click Context Menu
2012-10-18 15:21:29
Todd.Rovito
set
nosy: + Todd.Rovito
2012-08-22 14:52:15
terry.reedy
set
nosy: + roger.serwy
2012-08-22 07:13:15
Nashev
set
messages: +
2012-08-22 00:44:13
r.david.murray
set
versions: + Python 3.4, - Python 3.2
2010-07-20 14:13:20
taleinat
set
files: + IDLE_rmenu_py3k.patch
2010-07-20 14:12:45
taleinat
set
files: + IDLE_rmenu_trunk.patch
nosy: + taleinat
messages: +
2010-07-16 13:09:37
BreamoreBoy
set
nosy: + terry.reedy
versions: + Python 3.2, - Python 3.1, Python 2.7
2009-08-10 17:48:59
gpolo
set
messages: +
2009-08-10 17:46:38
gpolo
set
files: + rightmenu_copypastecut.diff
messages: +
2009-04-26 22:19:22
ajaksu2
set
keywords: + patch
nosy: + gpolo
stage: test needed -> patch review
2009-03-04 15:16:37
ajaksu2
set
stage: test needed
versions: + Python 3.1, Python 2.7
2008-01-10 12:31:43
Nashev
set
nosy: + Nashev
messages: +
2005-05-24 08:31:45
mjfoord
create