summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2002-09-26 22:13:22 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2002-09-26 22:13:22 (GMT)
commit84f4803f4f7ccf40cd777d1e9627528c30bc9053 (patch)
treeb409ab2d8e41f3288b4249827c44009b652c8a7d
parentd404bee2e2a354627ac540336408225648feffe9 (diff)
downloadcpython-84f4803f4f7ccf40cd777d1e9627528c30bc9053.zip
cpython-84f4803f4f7ccf40cd777d1e9627528c30bc9053.tar.gz
cpython-84f4803f4f7ccf40cd777d1e9627528c30bc9053.tar.bz2
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
-rw-r--r--Lib/idlelib/EditorWindow.py24
-rw-r--r--Lib/idlelib/config-keys.def2
-rw-r--r--Lib/idlelib/configHandler.py1
3 files changed, 26 insertions, 1 deletions
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 @@ class EditorWindow:
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 @@ class EditorWindow:
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 @@ class EditorWindow:
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 @@ class EditorWindow:
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 @@ class EditorWindow:
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 @@ class EditorWindow:
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 @@ beginning-of-line= <Key-Home>
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 @@ beginning-of-line= <Key-Home>
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 @@ class IdleConf:
'<<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>'],