Fix Bug 612886 copy/paste menu items fail
(cut vs. Cut etc.)
Fix Bug 613006 Ctrl-x Unix Binding Clears Selection
(do-nothing does something :)
Leave some debugging prints behind, commented out
M EditorWindow.py
M config-keys.def
M configHandler.py
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index ef8e122..45481ed 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -80,6 +80,9 @@
self.top.protocol("WM_DELETE_WINDOW", self.close)
self.top.bind("<<close-window>>", self.close_event)
+ text.bind("<<cut>>", self.cut)
+ text.bind("<<copy>>", self.copy)
+ text.bind("<<paste>>", self.paste)
text.bind("<<center-insert>>", self.center_insert_event)
text.bind("<<help>>", self.help_dialog)
text.bind("<<good-advice>>", self.good_advice)
@@ -311,6 +314,18 @@
def display_docs(self, url):
webbrowser.open(url)
+ def cut(self,event):
+ self.text.event_generate("<<Cut>>")
+ return "break"
+
+ def copy(self,event):
+ self.text.event_generate("<<Copy>>")
+ return "break"
+
+ def paste(self,event):
+ self.text.event_generate("<<Paste>>")
+ return "break"
+
def select_all(self, event=None):
self.text.tag_add("sel", "1.0", "end-1c")
self.text.mark_set("insert", "1.0")
@@ -743,6 +758,7 @@
text = self.text
text.keydefs = keydefs
for event, keylist in keydefs.items():
+ ##print>>sys.__stderr__, "event, list: ", event, keylist
if keylist:
apply(text.event_add, (event,) + tuple(keylist))
@@ -755,6 +771,7 @@
defs = self.Bindings.menudefs
if keydefs is None:
keydefs = self.Bindings.default_keydefs
+ ##print>>sys.__stderr__, "*keydefs: " , keydefs
menudict = self.menudict
text = self.text
for mname, itemlist in defs:
@@ -770,6 +787,7 @@
if checkbutton:
label = label[1:]
underline, label = prepstr(label)
+ ##print>>sys.__stderr__, "*Event: " , event
accelerator = get_accelerator(keydefs, event)
def command(text=text, event=event):
text.event_generate(event)
@@ -779,8 +797,12 @@
command=command, accelerator=accelerator,
variable=var)
else:
+ ##print>>sys.__stderr__, "label, ul, cmd, accel: ",
+ ## label, underline, command,
+ ## accelerator
menu.add_command(label=label, underline=underline,
- command=command, accelerator=accelerator)
+ command=command,
+ accelerator=accelerator)
def getvar(self, name):
var = self.getrawvar(name)
diff --git a/Lib/idlelib/config-keys.def b/Lib/idlelib/config-keys.def
index 0c81b17..ebaffd4 100644
--- a/Lib/idlelib/config-keys.def
+++ b/Lib/idlelib/config-keys.def
@@ -15,6 +15,7 @@
center-insert=<Control-Key-l>
close-all-windows=<Control-Key-q>
close-window=<Alt-Key-F4>
+do-nothing=<Control-Key-F12>
end-of-file=<Control-Key-d>
python-docs=<Key-F1>
python-context-help=<Shift-Key-F1>
@@ -108,6 +109,7 @@
center-insert=<Control-Key-l>
close-all-windows=<Command-Key-q>
close-window=<Command-Key-w>
+do-nothing=<Control-Key-F12>
end-of-file=<Control-Key-d>
python-docs=<Key-F1>
python-context-help=<Shift-Key-F1>
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py
index 2dd46e2..d3a88f2 100644
--- a/Lib/idlelib/configHandler.py
+++ b/Lib/idlelib/configHandler.py
@@ -496,6 +496,7 @@
'<<center-insert>>': ['<Control-l>'],
'<<close-all-windows>>': ['<Control-q>'],
'<<close-window>>': ['<Alt-F4>'],
+ '<<do-nothing>>': ['<Control-x>'],
'<<end-of-file>>': ['<Control-d>'],
'<<python-docs>>': ['<F1>'],
'<<python-context-help>>': ['<Shift-F1>'],