mirror of
https://github.com/python/cpython.git
synced 2025-10-03 05:35:59 +00:00
1. Made advanced keybinding dialog functional.
2. Allow binding of movement keys
This commit is contained in:
parent
e3faaeb1d6
commit
5c6e0a1a0c
2 changed files with 27 additions and 13 deletions
|
@ -1,7 +1,14 @@
|
||||||
What's New in IDLE 1.2a0?
|
What's New in IDLE 1.2a0?
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
*Release date: XX-XXX-2005*
|
*Release date: XX-XXX-2006*
|
||||||
|
|
||||||
|
- Options / Keys / Advanced dialog made functional. Also, allow binding
|
||||||
|
of 'movement' keys.
|
||||||
|
|
||||||
|
- 'syntax' patch adds improved calltips and a new class attribute listbox.
|
||||||
|
MultiCall module allows binding multiple actions to an event.
|
||||||
|
Patch 906702 Noam Raphael
|
||||||
|
|
||||||
- Better indentation after first line of string continuation.
|
- Better indentation after first line of string continuation.
|
||||||
IDLEfork Patch 681992, Noam Raphael
|
IDLEfork Patch 681992, Noam Raphael
|
||||||
|
|
|
@ -26,12 +26,13 @@ class GetKeysDialog(Toplevel):
|
||||||
self.result=''
|
self.result=''
|
||||||
self.keyString=StringVar(self)
|
self.keyString=StringVar(self)
|
||||||
self.keyString.set('')
|
self.keyString.set('')
|
||||||
self.SetModifiersForPlatform()
|
self.SetModifiersForPlatform() # set self.modifiers, self.modifier_label
|
||||||
self.modifier_vars = []
|
self.modifier_vars = []
|
||||||
for modifier in self.modifiers:
|
for modifier in self.modifiers:
|
||||||
variable = StringVar(self)
|
variable = StringVar(self)
|
||||||
variable.set('')
|
variable.set('')
|
||||||
self.modifier_vars.append(variable)
|
self.modifier_vars.append(variable)
|
||||||
|
self.advanced = False
|
||||||
self.CreateWidgets()
|
self.CreateWidgets()
|
||||||
self.LoadFinalKeyList()
|
self.LoadFinalKeyList()
|
||||||
self.withdraw() #hide while setting geometry
|
self.withdraw() #hide while setting geometry
|
||||||
|
@ -136,7 +137,7 @@ class GetKeysDialog(Toplevel):
|
||||||
self.modifiers = ['Shift', 'Control', 'Option', 'Command']
|
self.modifiers = ['Shift', 'Control', 'Option', 'Command']
|
||||||
else:
|
else:
|
||||||
self.modifiers = ['Control', 'Alt', 'Shift']
|
self.modifiers = ['Control', 'Alt', 'Shift']
|
||||||
self.modifier_label = {'Control': 'Ctrl'}
|
self.modifier_label = {'Control': 'Ctrl'} # short name
|
||||||
|
|
||||||
def ToggleLevel(self):
|
def ToggleLevel(self):
|
||||||
if self.buttonLevel.cget('text')[:8]=='Advanced':
|
if self.buttonLevel.cget('text')[:8]=='Advanced':
|
||||||
|
@ -145,11 +146,13 @@ class GetKeysDialog(Toplevel):
|
||||||
self.frameKeySeqAdvanced.lift()
|
self.frameKeySeqAdvanced.lift()
|
||||||
self.frameHelpAdvanced.lift()
|
self.frameHelpAdvanced.lift()
|
||||||
self.entryKeysAdvanced.focus_set()
|
self.entryKeysAdvanced.focus_set()
|
||||||
|
self.advanced = True
|
||||||
else:
|
else:
|
||||||
self.ClearKeySeq()
|
self.ClearKeySeq()
|
||||||
self.buttonLevel.config(text='Advanced Key Binding Entry >>')
|
self.buttonLevel.config(text='Advanced Key Binding Entry >>')
|
||||||
self.frameKeySeqBasic.lift()
|
self.frameKeySeqBasic.lift()
|
||||||
self.frameControlsBasic.lift()
|
self.frameControlsBasic.lift()
|
||||||
|
self.advanced = False
|
||||||
|
|
||||||
def FinalKeySelected(self,event):
|
def FinalKeySelected(self,event):
|
||||||
self.BuildKeyString()
|
self.BuildKeyString()
|
||||||
|
@ -208,7 +211,7 @@ class GetKeysDialog(Toplevel):
|
||||||
return key
|
return key
|
||||||
|
|
||||||
def OK(self, event=None):
|
def OK(self, event=None):
|
||||||
if self.KeysOK():
|
if self.advanced or self.KeysOK(): # doesn't check advanced string yet
|
||||||
self.result=self.keyString.get()
|
self.result=self.keyString.get()
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
|
@ -217,7 +220,12 @@ class GetKeysDialog(Toplevel):
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
def KeysOK(self):
|
def KeysOK(self):
|
||||||
"Validity check on user's keybinding selection"
|
'''Validity check on user's 'basic' keybinding selection.
|
||||||
|
|
||||||
|
Doesn't check the string produced by the advanced dialog because
|
||||||
|
'modifiers' isn't set.
|
||||||
|
|
||||||
|
'''
|
||||||
keys = self.keyString.get()
|
keys = self.keyString.get()
|
||||||
keys.strip()
|
keys.strip()
|
||||||
finalKey = self.listKeysFinal.get(ANCHOR)
|
finalKey = self.listKeysFinal.get(ANCHOR)
|
||||||
|
@ -232,20 +240,19 @@ class GetKeysDialog(Toplevel):
|
||||||
elif not keys.endswith('>'):
|
elif not keys.endswith('>'):
|
||||||
tkMessageBox.showerror(title=title, parent=self,
|
tkMessageBox.showerror(title=title, parent=self,
|
||||||
message='Missing the final Key')
|
message='Missing the final Key')
|
||||||
elif not modifiers and finalKey not in self.functionKeys:
|
elif (not modifiers
|
||||||
|
and finalKey not in self.functionKeys + self.moveKeys):
|
||||||
tkMessageBox.showerror(title=title, parent=self,
|
tkMessageBox.showerror(title=title, parent=self,
|
||||||
message='No modifier key(s) specified.')
|
message='No modifier key(s) specified.')
|
||||||
elif (modifiers == ['Shift']) \
|
elif (modifiers == ['Shift']) \
|
||||||
and (finalKey not in
|
and (finalKey not in
|
||||||
self.functionKeys + ('Tab', 'Space')):
|
self.functionKeys + self.moveKeys + ('Tab', 'Space')):
|
||||||
msg = 'The shift modifier by itself may not be used with' \
|
msg = 'The shift modifier by itself may not be used with'\
|
||||||
' this key symbol; only with F1-F12, Tab, or Space'
|
' this key symbol.'
|
||||||
tkMessageBox.showerror(title=title, parent=self,
|
tkMessageBox.showerror(title=title, parent=self, message=msg)
|
||||||
message=msg)
|
|
||||||
elif keySequence in self.currentKeySequences:
|
elif keySequence in self.currentKeySequences:
|
||||||
msg = 'This key combination is already in use.'
|
msg = 'This key combination is already in use.'
|
||||||
tkMessageBox.showerror(title=title, parent=self,
|
tkMessageBox.showerror(title=title, parent=self, message=msg)
|
||||||
message=msg)
|
|
||||||
else:
|
else:
|
||||||
keysOK = True
|
keysOK = True
|
||||||
return keysOK
|
return keysOK
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue