diff options
author | Steven M. Gava <elguavas@python.net> | 2002-01-19 10:33:21 (GMT) |
---|---|---|
committer | Steven M. Gava <elguavas@python.net> | 2002-01-19 10:33:21 (GMT) |
commit | c628a06c709dcf0d96ad55a475a5a1318d06dba4 (patch) | |
tree | 6a08e02872fbe4f059def12dde386a554400fb2c /Lib/idlelib/keybindingDialog.py | |
parent | 68d7336cb06ce84c01ee4307cd9fd23d5b273519 (diff) | |
download | cpython-c628a06c709dcf0d96ad55a475a5a1318d06dba4.zip cpython-c628a06c709dcf0d96ad55a475a5a1318d06dba4.tar.gz cpython-c628a06c709dcf0d96ad55a475a5a1318d06dba4.tar.bz2 |
further work on keybinding configuration
Diffstat (limited to 'Lib/idlelib/keybindingDialog.py')
-rw-r--r-- | Lib/idlelib/keybindingDialog.py | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py index 0958578..c510257 100644 --- a/Lib/idlelib/keybindingDialog.py +++ b/Lib/idlelib/keybindingDialog.py @@ -161,9 +161,10 @@ class GetKeysDialog(Toplevel): keyList=keyList+modifiers if finalKey: if (not modifiers) and (finalKey in self.functionKeys): - finalKey='<'+finalKey + finalKey='<'+self.TranslateKey(finalKey) + else: + finalKey=self.TranslateKey(finalKey) keyList.append(finalKey+'>') - keyStr=string.join(keyList,'-') self.keyString.set(keyStr) @@ -189,15 +190,34 @@ class GetKeysDialog(Toplevel): #these tuples are also available for use in validity checks self.functionKeys=('F1','F2','F2','F4','F5','F6','F7','F8','F9', 'F10','F11','F12') - self.punctuationKeys=tuple('~!@#%^&*()_-+={}[]|;:,./?') - self.specialKeys=('tab','space') self.alphanumKeys=tuple(string.ascii_lowercase+string.digits) + self.punctuationKeys=tuple('~!@#%^&*()_-+={}[]|;:,.<>/?') + self.whitespaceKeys=('Tab','Space','Return') + self.editKeys=('BackSpace','Delete','Insert') + self.moveKeys=('Home','End','Page Up','Page Down','Left Arrow', + 'Right Arrow','Up Arrow','Down Arrow') #make a tuple of most of the useful common 'final' keys - keys=(self.alphanumKeys+self.punctuationKeys+self.specialKeys+ - self.functionKeys) + keys=(self.alphanumKeys+self.punctuationKeys+self.functionKeys+ + self.whitespaceKeys+self.editKeys+self.moveKeys) apply(self.listKeysFinal.insert, (END,)+keys) + def TranslateKey(self,key): + #translate from key list value to tkinter key-id + translateDict={'~':'asciitilde','!':'exclam','@':'at','#':'numbersign', + '%':'percent','^':'asciicircum','&':'ampersand','*':'asterisk', + '(':'parenleft',')':'parenright','_':'underscore','-':'minus', + '+':'plus','=':'equal','{':'braceleft','}':'braceright', + '[':'bracketleft',']':'bracketright','|':'bar',';':'semicolon', + ':':'colon',',':'comma','.':'period','<':'less','>':'greater', + '/':'slash','?':'question','Page Up':'Prior','Page Down':'Next', + 'Left Arrow':'Left','Right Arrow':'Right','Up Arrow':'Up', + 'Down Arrow': 'Down'} + if key in translateDict.keys(): + key=translateDict[key] + key='Key-'+key + return key + def Ok(self, event=None): if self.KeysOk(): self.result=self.keyString.get() |