From 84f4803f4f7ccf40cd777d1e9627528c30bc9053 Mon Sep 17 00:00:00 2001 From: "Kurt B. Kaiser" Date: Thu, 26 Sep 2002 22:13:22 +0000 Subject: 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 --- Lib/idlelib/EditorWindow.py | 24 +++++++++++++++++++++++- Lib/idlelib/config-keys.def | 2 ++ Lib/idlelib/configHandler.py | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) 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("<>", self.close_event) + text.bind("<>", self.cut) + text.bind("<>", self.copy) + text.bind("<>", self.paste) text.bind("<>", self.center_insert_event) text.bind("<>", self.help_dialog) text.bind("<>", 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("<>") + return "break" + + def copy(self,event): + self.text.event_generate("<>") + return "break" + + def paste(self,event): + self.text.event_generate("<>") + 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= center-insert= close-all-windows= close-window= +do-nothing= end-of-file= python-docs= python-context-help= @@ -108,6 +109,7 @@ beginning-of-line= center-insert= close-all-windows= close-window= +do-nothing= end-of-file= python-docs= python-context-help= 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: '<>': [''], '<>': [''], '<>': [''], + '<>': [''], '<>': [''], '<>': [''], '<>': [''], -- cgit v0.12