diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2005-11-22 01:47:14 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2005-11-22 01:47:14 (GMT) |
commit | 5a67f9b815fdd34617395c6ec5d9a679361b76ea (patch) | |
tree | 9cf9f4ee17e3a0654254be18ea3e17e3be58fd7b | |
parent | 09f0dd5842b7bb67ead5df59a367196261d87a71 (diff) | |
download | cpython-5a67f9b815fdd34617395c6ec5d9a679361b76ea.zip cpython-5a67f9b815fdd34617395c6ec5d9a679361b76ea.tar.gz cpython-5a67f9b815fdd34617395c6ec5d9a679361b76ea.tar.bz2 |
Following 'syntax' patch, accelerator keys in menus weren't being
updated after a keyset change. Also, formatted ApplyKeyBindings()
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 1cd496a..1c04d76 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -566,47 +566,46 @@ class EditorWindow(object): def RemoveKeybindings(self): "Remove the keybindings before they are changed." # Called from configDialog.py - self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() - keydefs = self.Bindings.default_keydefs + self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) for extensionName in self.get_standard_extension_names(): - keydefs = idleConf.GetExtensionBindings(extensionName) - if keydefs: - for event, keylist in keydefs.items(): + xkeydefs = idleConf.GetExtensionBindings(extensionName) + if xkeydefs: + for event, keylist in xkeydefs.items(): self.text.event_delete(event, *keylist) def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py - self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() + self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): - keydefs = idleConf.GetExtensionBindings(extensionName) - if keydefs: - self.apply_bindings(keydefs) + xkeydefs = idleConf.GetExtensionBindings(extensionName) + if xkeydefs: + self.apply_bindings(xkeydefs) #update menu accelerators - menuEventDict={} + menuEventDict = {} for menu in self.Bindings.menudefs: - menuEventDict[menu[0]]={} + menuEventDict[menu[0]] = {} for item in menu[1]: if item: - menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] + menuEventDict[menu[0]][prepstr(item[0])[1]] = item[1] for menubarItem in self.menudict.keys(): - menu=self.menudict[menubarItem] - end=menu.index(END)+1 - for index in range(0,end): - if menu.type(index)=='command': - accel=menu.entrycget(index,'accelerator') + menu = self.menudict[menubarItem] + end = menu.index(END) + 1 + for index in range(0, end): + if menu.type(index) == 'command': + accel = menu.entrycget(index, 'accelerator') if accel: - itemName=menu.entrycget(index,'label') - event='' + itemName = menu.entrycget(index, 'label') + event = '' if menuEventDict.has_key(menubarItem): if menuEventDict[menubarItem].has_key(itemName): - event=menuEventDict[menubarItem][itemName] + event = menuEventDict[menubarItem][itemName] if event: - accel=get_accelerator(keydefs, event) - menu.entryconfig(index,accelerator=accel) + accel = get_accelerator(keydefs, event) + menu.entryconfig(index, accelerator=accel) def set_notabs_indentwidth(self): "Update the indentwidth if changed and not using tabs in this window" |