summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/keybindingDialog.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2002-12-31 16:03:23 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2002-12-31 16:03:23 (GMT)
commit6655e4bc2752f1114a2e1f9a63ffd4191fa50d0d (patch)
tree94c162d82dacd500b7e59403255c8af854b38f51 /Lib/idlelib/keybindingDialog.py
parent9532298c82d8384a6c469136ac87842990ec10dd (diff)
downloadcpython-6655e4bc2752f1114a2e1f9a63ffd4191fa50d0d.zip
cpython-6655e4bc2752f1114a2e1f9a63ffd4191fa50d0d.tar.gz
cpython-6655e4bc2752f1114a2e1f9a63ffd4191fa50d0d.tar.bz2
Whitespace Normalization
Diffstat (limited to 'Lib/idlelib/keybindingDialog.py')
-rw-r--r--Lib/idlelib/keybindingDialog.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py
index 427da5c..df024e7 100644
--- a/Lib/idlelib/keybindingDialog.py
+++ b/Lib/idlelib/keybindingDialog.py
@@ -1,5 +1,5 @@
"""
-dialog for building tkinter accelerator key bindings
+dialog for building tkinter accelerator key bindings
"""
from Tkinter import *
import tkMessageBox
@@ -11,7 +11,7 @@ class GetKeysDialog(Toplevel):
action - string, the name of the virtual event these keys will be
mapped to
currentKeys - list, a list of all key sequence lists currently mapped
- to virtual events, for overlap checking
+ to virtual events, for overlap checking
"""
Toplevel.__init__(self, parent)
self.configure(borderwidth=5)
@@ -36,14 +36,14 @@ class GetKeysDialog(Toplevel):
self.LoadFinalKeyList()
self.withdraw() #hide while setting geometry
self.update_idletasks()
- self.geometry("+%d+%d" %
+ self.geometry("+%d+%d" %
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)) )) ) #centre dialog over parent
self.deiconify() #geometry set, unhide
self.wait_window()
-
+
def CreateWidgets(self):
frameMain = Frame(self,borderwidth=2,relief=SUNKEN)
frameMain.pack(side=TOP,expand=TRUE,fill=BOTH)
@@ -143,19 +143,19 @@ class GetKeysDialog(Toplevel):
self.ClearKeySeq()
self.buttonLevel.config(text='Advanced Key Binding Entry >>')
self.frameKeySeqBasic.lift()
- self.frameControlsBasic.lift()
-
+ self.frameControlsBasic.lift()
+
def FinalKeySelected(self,event):
self.BuildKeyString()
-
+
def BuildKeyString(self):
keyList=[]
modifiers=self.GetModifiers()
finalKey=self.listKeysFinal.get(ANCHOR)
if modifiers: modifiers[0]='<'+modifiers[0]
keyList=keyList+modifiers
- if finalKey:
- if (not modifiers) and (finalKey not
+ if finalKey:
+ if (not modifiers) and (finalKey not
in self.alphanumKeys+self.punctuationKeys):
finalKey='<'+self.TranslateKey(finalKey)
else:
@@ -163,7 +163,7 @@ class GetKeysDialog(Toplevel):
keyList.append(finalKey+'>')
keyStr=string.join(keyList,'-')
self.keyString.set(keyStr)
-
+
def GetModifiers(self):
modList = [variable.get() for variable in self.modifier_vars]
return filter(None, modList)
@@ -174,7 +174,7 @@ class GetKeysDialog(Toplevel):
for variable in self.modifier_vars:
variable.set('')
self.keyString.set('')
-
+
def LoadFinalKeyList(self):
#these tuples are also available for use in validity checks
self.functionKeys=('F1','F2','F2','F4','F5','F6','F7','F8','F9',
@@ -190,7 +190,7 @@ class GetKeysDialog(Toplevel):
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',
@@ -206,16 +206,16 @@ class GetKeysDialog(Toplevel):
key=translateDict[key]
key='Key-'+key
return key
-
+
def Ok(self, event=None):
if self.KeysOk():
self.result=self.keyString.get()
self.destroy()
-
+
def Cancel(self, event=None):
self.result=''
self.destroy()
-
+
def KeysOk(self):
#simple validity check
keysOk=1
@@ -232,13 +232,13 @@ class GetKeysDialog(Toplevel):
tkMessageBox.showerror(title='Key Sequence Error',
message='No final key specified.')
keysOk=0
- elif (not modifiers) and (finalKey in
+ elif (not modifiers) and (finalKey in
self.alphanumKeys+self.punctuationKeys):
#modifier required
tkMessageBox.showerror(title='Key Sequence Error',
message='No modifier key(s) specified.')
keysOk=0
- elif (modifiers==['Shift']) and (finalKey not
+ elif (modifiers==['Shift']) and (finalKey not
in self.functionKeys+('Tab',)):
#shift alone is only a useful modifier with a function key
tkMessageBox.showerror(title='Key Sequence Error',
@@ -250,7 +250,7 @@ class GetKeysDialog(Toplevel):
message='This key combination is already in use.')
keysOk=0
return keysOk
-
+
if __name__ == '__main__':
#test the dialog
root=Tk()