Following 'syntax' patch, accelerator keys in menus weren't being
updated after a keyset change. Also, formatted ApplyKeyBindings()
This commit is contained in:
parent
09f0dd5842
commit
5a67f9b815
|
@ -566,47 +566,46 @@ class EditorWindow(object):
|
||||||
def RemoveKeybindings(self):
|
def RemoveKeybindings(self):
|
||||||
"Remove the keybindings before they are changed."
|
"Remove the keybindings before they are changed."
|
||||||
# Called from configDialog.py
|
# Called from configDialog.py
|
||||||
self.Bindings.default_keydefs=idleConf.GetCurrentKeySet()
|
self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
|
||||||
keydefs = self.Bindings.default_keydefs
|
|
||||||
for event, keylist in keydefs.items():
|
for event, keylist in keydefs.items():
|
||||||
self.text.event_delete(event, *keylist)
|
self.text.event_delete(event, *keylist)
|
||||||
for extensionName in self.get_standard_extension_names():
|
for extensionName in self.get_standard_extension_names():
|
||||||
keydefs = idleConf.GetExtensionBindings(extensionName)
|
xkeydefs = idleConf.GetExtensionBindings(extensionName)
|
||||||
if keydefs:
|
if xkeydefs:
|
||||||
for event, keylist in keydefs.items():
|
for event, keylist in xkeydefs.items():
|
||||||
self.text.event_delete(event, *keylist)
|
self.text.event_delete(event, *keylist)
|
||||||
|
|
||||||
def ApplyKeybindings(self):
|
def ApplyKeybindings(self):
|
||||||
"Update the keybindings after they are changed"
|
"Update the keybindings after they are changed"
|
||||||
# Called from configDialog.py
|
# Called from configDialog.py
|
||||||
self.Bindings.default_keydefs=idleConf.GetCurrentKeySet()
|
self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
|
||||||
self.apply_bindings()
|
self.apply_bindings()
|
||||||
for extensionName in self.get_standard_extension_names():
|
for extensionName in self.get_standard_extension_names():
|
||||||
keydefs = idleConf.GetExtensionBindings(extensionName)
|
xkeydefs = idleConf.GetExtensionBindings(extensionName)
|
||||||
if keydefs:
|
if xkeydefs:
|
||||||
self.apply_bindings(keydefs)
|
self.apply_bindings(xkeydefs)
|
||||||
#update menu accelerators
|
#update menu accelerators
|
||||||
menuEventDict={}
|
menuEventDict = {}
|
||||||
for menu in self.Bindings.menudefs:
|
for menu in self.Bindings.menudefs:
|
||||||
menuEventDict[menu[0]]={}
|
menuEventDict[menu[0]] = {}
|
||||||
for item in menu[1]:
|
for item in menu[1]:
|
||||||
if item:
|
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():
|
for menubarItem in self.menudict.keys():
|
||||||
menu=self.menudict[menubarItem]
|
menu = self.menudict[menubarItem]
|
||||||
end=menu.index(END)+1
|
end = menu.index(END) + 1
|
||||||
for index in range(0,end):
|
for index in range(0, end):
|
||||||
if menu.type(index)=='command':
|
if menu.type(index) == 'command':
|
||||||
accel=menu.entrycget(index,'accelerator')
|
accel = menu.entrycget(index, 'accelerator')
|
||||||
if accel:
|
if accel:
|
||||||
itemName=menu.entrycget(index,'label')
|
itemName = menu.entrycget(index, 'label')
|
||||||
event=''
|
event = ''
|
||||||
if menuEventDict.has_key(menubarItem):
|
if menuEventDict.has_key(menubarItem):
|
||||||
if menuEventDict[menubarItem].has_key(itemName):
|
if menuEventDict[menubarItem].has_key(itemName):
|
||||||
event=menuEventDict[menubarItem][itemName]
|
event = menuEventDict[menubarItem][itemName]
|
||||||
if event:
|
if event:
|
||||||
accel=get_accelerator(keydefs, event)
|
accel = get_accelerator(keydefs, event)
|
||||||
menu.entryconfig(index,accelerator=accel)
|
menu.entryconfig(index, accelerator=accel)
|
||||||
|
|
||||||
def set_notabs_indentwidth(self):
|
def set_notabs_indentwidth(self):
|
||||||
"Update the indentwidth if changed and not using tabs in this window"
|
"Update the indentwidth if changed and not using tabs in this window"
|
||||||
|
|
Loading…
Reference in New Issue