From e28ee754b0749b2c4d1d6eb5f040dd3c8b01154a Mon Sep 17 00:00:00 2001 From: "Steven M. Gava" Date: Mon, 11 Feb 2002 03:45:22 +0000 Subject: improvement to keybinding re-use check --- Lib/idlelib/config-extensions.def | 1 + Lib/idlelib/config-keys.def | 136 +++++++++++++++++++------------------- Lib/idlelib/configDialog.py | 11 ++- Lib/idlelib/keybindingDialog.py | 18 ----- 4 files changed, 80 insertions(+), 86 deletions(-) diff --git a/Lib/idlelib/config-extensions.def b/Lib/idlelib/config-extensions.def index c0439e6..acdb359 100644 --- a/Lib/idlelib/config-extensions.def +++ b/Lib/idlelib/config-extensions.def @@ -10,6 +10,7 @@ # extension that are not sensibly re-configurable. If present, # ExtensionName_cfgBindings defines virtual event bindings for the extension # that may be sensibly re-configured. +# See config-keys.def for notes on specifying keys. [FormatParagraph] enable=1 diff --git a/Lib/idlelib/config-keys.def b/Lib/idlelib/config-keys.def index 7aa127f..6e3b8f3 100644 --- a/Lib/idlelib/config-keys.def +++ b/Lib/idlelib/config-keys.def @@ -2,74 +2,76 @@ # file is the default config file for idle key binding settings. # Where multiple keys are specified for an action: if they are separated # by a space (eg. action= ) then the keys are altenatives, if -# there is no space (eg. action=key2>) then the keys comprise a -# single 'emacs style' multi-keystoke binding. +# there is no space (eg. action=) then the keys comprise a +# single 'emacs style' multi-keystoke binding. The tk event specifier 'Key' +# is used in all cases, for consistency in auto key conflict checking in the +# configuration gui. [IDLE Classic Windows] -copy= -cut= -paste= -beginning-of-line= -center-insert= -close-all-windows= -close-window= -end-of-file= -python-docs= -python-context-help= -history-next= -history-previous= -interrupt-execution= -open-class-browser= -open-module= -open-new-window= -open-window-from-file= -plain-newline-and-indent= -redo= -remove-selection= -save-copy-of-window-as-file= -save-window-as-file= -save-window= -select-all= -toggle-auto-coloring= -undo= -find= -find-again= -find-in-files= -find-selection= -replace= -goto-line= +copy= +cut= +paste= +beginning-of-line= +center-insert= +close-all-windows= +close-window= +end-of-file= +python-docs= +python-context-help= +history-next= +history-previous= +interrupt-execution= +open-class-browser= +open-module= +open-new-window= +open-window-from-file= +plain-newline-and-indent= +redo= +remove-selection= +save-copy-of-window-as-file= +save-window-as-file= +save-window= +select-all= +toggle-auto-coloring= +undo= +find= +find-again= +find-in-files= +find-selection= +replace= +goto-line= [IDLE Classic Unix] -copy= -cut= -paste= -beginning-of-line= -center-insert= -close-all-windows= -close-window= -do-nothing= -end-of-file= -history-next= -history-previous= -interrupt-execution= -open-class-browser= -open-module= -open-new-window= -open-window-from-file= -plain-newline-and-indent= -python-docs= -python-context-help= -redo= -remove-selection= -save-copy-of-window-as-file= -save-window-as-file= -save-window= -select-all= -toggle-auto-coloring= -undo= -find= -find-again= -find-in-files= -find-selection= -replace= -goto-line= +copy= +cut= +paste= +beginning-of-line= +center-insert= +close-all-windows= +close-window= +do-nothing= +end-of-file= +history-next= +history-previous= +interrupt-execution= +open-class-browser= +open-module= +open-new-window= +open-window-from-file= +plain-newline-and-indent= +python-docs= +python-context-help= +redo= +remove-selection= +save-copy-of-window-as-file= +save-window-as-file= +save-window= +select-all= +toggle-auto-coloring= +undo= +find= +find-again= +find-in-files= +find-selection= +replace= +goto-line= diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py index cb3cf4d..025bf81 100644 --- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -561,7 +561,16 @@ class ConfigDialog(Toplevel): listIndex=self.listBindings.index(ANCHOR) binding=self.listBindings.get(listIndex) bindName=binding.split()[0] #first part, up to first space - currentKeySequences=idleConf.GetCurrentKeySet().values() + if self.keysAreBuiltin.get(): + currentKeySetName=self.builtinKeys.get() + else: + currentKeySetName=self.customKeys.get() + currentBindings=idleConf.GetCurrentKeySet() + if currentKeySetName in self.changedItems['keys'].keys(): #unsaved changes + keySetChanges=self.changedItems['keys'][currentKeySetName] + for event in keySetChanges.keys(): + currentBindings[event]=keySetChanges[event].split() + currentKeySequences=currentBindings.values() newKeys=GetKeysDialog(self,'Get New Keys',bindName, currentKeySequences).result if newKeys: #new keys were specified diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py index d226a99..3b1ddba 100644 --- a/Lib/idlelib/keybindingDialog.py +++ b/Lib/idlelib/keybindingDialog.py @@ -30,19 +30,10 @@ class GetKeysDialog(Toplevel): self.keyCtrl.set('') self.keyAlt=StringVar(self) self.keyAlt.set('') -# self.keyMeta=StringVar(self) -# self.keyMeta.set('') self.keyShift=StringVar(self) self.keyShift.set('') -# self.keyFinal1=StringVar(self) -# self.keyFinal1.set('') -# self.keyFinal2=StringVar(self) -# self.keyFinal2.set('') -# self.keyFn1=IntVar(self) -# self.keyFn2=IntVar(self) self.CreateWidgets() self.LoadFinalKeyList() - #self.buttonOk.focus_set() self.withdraw() #hide while setting geometry self.update_idletasks() self.geometry("+%d+%d" % @@ -91,10 +82,6 @@ class GetKeysDialog(Toplevel): command=self.BuildKeyString, text='Alt',variable=self.keyAlt,onvalue='Alt',offvalue='') checkAlt.grid(row=0,column=1,padx=2,sticky=W) -# checkMeta=Checkbutton(self.frameControlsBasic, -# command=self.BuildKeyString, -# text='Meta',variable=self.keyMeta,onvalue='Meta',offvalue='') -# checkMeta.grid(row=0,column=2,padx=2,sticky=W) checkShift=Checkbutton(self.frameControlsBasic, command=self.BuildKeyString, text='Shift',variable=self.keyShift,onvalue='Shift',offvalue='') @@ -102,21 +89,16 @@ class GetKeysDialog(Toplevel): labelFnAdvice=Label(self.frameControlsBasic,justify=LEFT, text="Select the desired modifier\n"+ "keys above, and final key\n"+ -# "keys above, and final key(s)\n"+ "from the list on the right.") labelFnAdvice.grid(row=1,column=0,columnspan=4,padx=2,sticky=W) self.listKeysFinal=Listbox(self.frameControlsBasic,width=15,height=10, selectmode=SINGLE) -# selectmode=MULTIPLE) self.listKeysFinal.bind('',self.FinalKeySelected) self.listKeysFinal.grid(row=0,column=4,rowspan=4,sticky=NS) scrollKeysFinal=Scrollbar(self.frameControlsBasic,orient=VERTICAL, command=self.listKeysFinal.yview) self.listKeysFinal.config(yscrollcommand=scrollKeysFinal.set) scrollKeysFinal.grid(row=0,column=5,rowspan=4,sticky=NS) -# self.buttonAddNew=Button(self.frameControlsBasic, -# text='Accept Key Sequence',width=25,command=None) -# self.buttonAddNew.grid(row=2,column=0,columnspan=4) self.buttonClear=Button(self.frameControlsBasic, text='Clear Keys',command=self.ClearKeySeq) self.buttonClear.grid(row=2,column=0,columnspan=4) -- cgit v0.12