summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorSteven M. Gava <elguavas@python.net>2002-02-11 03:45:22 (GMT)
committerSteven M. Gava <elguavas@python.net>2002-02-11 03:45:22 (GMT)
commite28ee754b0749b2c4d1d6eb5f040dd3c8b01154a (patch)
tree469763cc3c1af3c23041d3e6d7b23c605221ed72 /Lib/idlelib
parent9f25e67dd7cf1f7624421b420f117cf5478dcc39 (diff)
downloadcpython-e28ee754b0749b2c4d1d6eb5f040dd3c8b01154a.zip
cpython-e28ee754b0749b2c4d1d6eb5f040dd3c8b01154a.tar.gz
cpython-e28ee754b0749b2c4d1d6eb5f040dd3c8b01154a.tar.bz2
improvement to keybinding re-use check
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/config-extensions.def1
-rw-r--r--Lib/idlelib/config-keys.def136
-rw-r--r--Lib/idlelib/configDialog.py11
-rw-r--r--Lib/idlelib/keybindingDialog.py18
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=<key1> <key2>) then the keys are altenatives, if
-# there is no space (eg. action=<key1>key2>) then the keys comprise a
-# single 'emacs style' multi-keystoke binding.
+# there is no space (eg. action=<key1><key2>) 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=<Control-c> <Control-C>
-cut=<Control-x> <Control-X>
-paste=<Control-v> <Control-V>
-beginning-of-line= <Home>
-center-insert=<Control-l>
-close-all-windows=<Control-q>
-close-window=<Alt-F4>
-end-of-file=<Control-d>
-python-docs=<F1>
-python-context-help=<Shift-F1>
-history-next=<Alt-n>
-history-previous=<Alt-p>
-interrupt-execution=<Control-c>
-open-class-browser=<Alt-c>
-open-module=<Alt-m>
-open-new-window=<Control-n>
-open-window-from-file=<Control-o>
-plain-newline-and-indent=<Control-j>
-redo=<Control-Shift-z>
-remove-selection=<Escape>
-save-copy-of-window-as-file=<Alt-Shift-s>
-save-window-as-file=<Alt-s>
-save-window=<Control-s>
-select-all=<Alt-a>
-toggle-auto-coloring=<Control-slash>
-undo=<Control-z>
-find=<Control-f>
-find-again=<Control-g> <F3>
-find-in-files=<Alt-F3>
-find-selection=<Control-F3>
-replace=<Control-h>
-goto-line=<Alt-g>
+copy=<Control-Key-c>
+cut=<Control-Key-x>
+paste=<Control-Key-v>
+beginning-of-line= <Key-Home>
+center-insert=<Control-Key-l>
+close-all-windows=<Control-Key-q>
+close-window=<Alt-Key-F4>
+end-of-file=<Control-Key-d>
+python-docs=<Key-F1>
+python-context-help=<Shift-Key-F1>
+history-next=<Alt-Key-n>
+history-previous=<Alt-Key-p>
+interrupt-execution=<Control-Key-c>
+open-class-browser=<Alt-Key-c>
+open-module=<Alt-Key-m>
+open-new-window=<Control-Key-n>
+open-window-from-file=<Control-Key-o>
+plain-newline-and-indent=<Control-Key-j>
+redo=<Control-Shift-Key-z>
+remove-selection=<Key-Escape>
+save-copy-of-window-as-file=<Alt-Shift-Key-s>
+save-window-as-file=<Alt-Key-s>
+save-window=<Control-Key-s>
+select-all=<Alt-Key-a>
+toggle-auto-coloring=<Control-Key-slash>
+undo=<Control-Key-z>
+find=<Control-Key-f>
+find-again=<Control-Key-g> <Key-F3>
+find-in-files=<Alt-Key-F3>
+find-selection=<Control-Key-F3>
+replace=<Control-Key-h>
+goto-line=<Alt-Key-g>
[IDLE Classic Unix]
-copy=<Alt-w> <Meta-w>
-cut=<Control-w>
-paste=<Control-y>
-beginning-of-line=<Control-a> <Home>
-center-insert=<Control-l>
-close-all-windows=<Control-x><Control-c>
-close-window=<Control-x><Control-0> <Control-x><Key-0>
-do-nothing=<Control-x>
-end-of-file=<Control-d>
-history-next=<Alt-n> <Meta-n>
-history-previous=<Alt-p> <Meta-p>
-interrupt-execution=<Control-c>
-open-class-browser=<Control-x><Control-b>
-open-module=<Control-x><Control-m>
-open-new-window=<Control-x><Control-n>
-open-window-from-file=<Control-x><Control-f>
-plain-newline-and-indent=<Control-j>
-python-docs=<Control-h>
-python-context-help=<Control-Shift-h>
-redo=<Alt-z> <Meta-z>
-remove-selection=<Escape>
-save-copy-of-window-as-file=<Control-x><w>
-save-window-as-file=<Control-x><Control-w>
-save-window=<Control-x><Control-s>
-select-all=<Alt-a> <Meta-a>
-toggle-auto-coloring=<Control-slash>
-undo=<Control-z>
-find=<Control-u><Control-u><Control-s>
-find-again=<Control-u><Control-s>
-find-in-files=<Alt-s> <Meta-s>
-find-selection=<Control-s>
-replace=<Control-r>
-goto-line=<Alt-g> <Meta-g>
+copy=<Alt-Key-w> <Meta-Key-w>
+cut=<Control-Key-w>
+paste=<Control-Key-y>
+beginning-of-line=<Control-Key-a> <Key-Home>
+center-insert=<Control-Key-l>
+close-all-windows=<Control-Key-x><Control-Key-c>
+close-window=<Control-Key-x><Control-Key-0>
+do-nothing=<Control-Key-x>
+end-of-file=<Control-Key-d>
+history-next=<Alt-Key-n> <Meta-Key-n>
+history-previous=<Alt-Key-p> <Meta-Key-p>
+interrupt-execution=<Control-Key-c>
+open-class-browser=<Control-Key-x><Control-Key-b>
+open-module=<Control-Key-x><Control-Key-m>
+open-new-window=<Control-Key-x><Control-Key-n>
+open-window-from-file=<Control-Key-x><Control-Key-f>
+plain-newline-and-indent=<Control-Key-j>
+python-docs=<Control-Key-h>
+python-context-help=<Control-Shift-Key-h>
+redo=<Alt-Key-z> <Meta-Key-z>
+remove-selection=<Key-Escape>
+save-copy-of-window-as-file=<Control-Key-x><Control-Key-y>
+save-window-as-file=<Control-Key-x><Control-Key-w>
+save-window=<Control-Key-x><Control-Key-s>
+select-all=<Alt-Key-a> <Meta-Key-a>
+toggle-auto-coloring=<Control-Key-slash>
+undo=<Control-Key-z>
+find=<Control-Key-u><Control-Key-u><Control-Key-s>
+find-again=<Control-Key-u><Control-Key-s>
+find-in-files=<Alt-Key-s> <Meta-Key-s>
+find-selection=<Control-Key-s>
+replace=<Control-Key-r>
+goto-line=<Alt-Key-g> <Meta-Key-g>
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('<ButtonRelease-1>',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)