summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorSteven M. Gava <elguavas@python.net>2002-03-18 02:38:44 (GMT)
committerSteven M. Gava <elguavas@python.net>2002-03-18 02:38:44 (GMT)
commitdbfe92cd27f08d38cc8a2882c147c4289b6b5db1 (patch)
treeb355dee4ab82b43470acd8304a08c18b3d949781 /Lib/idlelib
parentb845f3b4dd2074b22eb2915ba4514bd2d5a87769 (diff)
downloadcpython-dbfe92cd27f08d38cc8a2882c147c4289b6b5db1.zip
cpython-dbfe92cd27f08d38cc8a2882c147c4289b6b5db1.tar.gz
cpython-dbfe92cd27f08d38cc8a2882c147c4289b6b5db1.tar.bz2
further work on dynamic reconfiguration;
keybindings
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/EditorWindow.py33
-rw-r--r--Lib/idlelib/configDialog.py1
2 files changed, 34 insertions, 0 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 99f40a7..49f9869 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -492,6 +492,39 @@ class EditorWindow:
idleConf.GetOption('main','EditorWindow','font-size'),
fontWeight))
+ def ResetKeybindings(self):
+ #this function is called from configDialog.py
+ #to update the keybindings if they are changed
+ self.Bindings.default_keydefs=idleConf.GetCurrentKeySet()
+ keydefs = self.Bindings.default_keydefs
+ for event, keylist in keydefs.items():
+ self.text.event_delete(event)
+ self.apply_bindings()
+ #update menu accelerators
+ menuEventDict={}
+ for menu in self.Bindings.menudefs:
+ menuEventDict[menu[0]]={}
+ for item in menu[1]:
+ if item:
+ 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')
+ if accel:
+ itemName=menu.entrycget(index,'label')
+ event=''
+ if menuEventDict.has_key(menubarItem):
+ if menuEventDict[menubarItem].has_key(itemName):
+ event=menuEventDict[menubarItem][itemName]
+ if event:
+ #print 'accel was:',accel
+ accel=get_accelerator(keydefs, event)
+ menu.entryconfig(index,accelerator=accel)
+ #print 'accel now:',accel,'\n'
+
def saved_change_hook(self):
short = self.short_title()
long = self.long_title()
diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py
index a7ad530..bff86d9 100644
--- a/Lib/idlelib/configDialog.py
+++ b/Lib/idlelib/configDialog.py
@@ -1096,6 +1096,7 @@ class ConfigDialog(Toplevel):
for instance in winInstances:
instance.ResetColorizer()
instance.ResetFont()
+ instance.ResetKeybindings()
def Cancel(self):
self.destroy()