@@ -211,14 +211,8 @@ def help(self):
211211 contents = help_common + help_pages .get (page , '' ))
212212
213213 def deactivate_current_config (self ):
214- """Remove current key bindings.
215- Iterate over window instances defined in parent and remove
216- the keybindings.
217- """
218- # Before a config is saved, some cleanup of current
219- # config must be done - remove the previous keybindings.
220- win_instances = self .parent .instance_dict .keys ()
221- for instance in win_instances :
214+ """Remove current key bindings in current windows."""
215+ for instance in self .parent .instance_dict :
222216 instance .RemoveKeybindings ()
223217
224218 def activate_config_changes (self ):
@@ -227,8 +221,7 @@ def activate_config_changes(self):
227221 Dynamically update the current parent window instances
228222 with some of the configuration changes.
229223 """
230- win_instances = self .parent .instance_dict .keys ()
231- for instance in win_instances :
224+ for instance in self .parent .instance_dict :
232225 instance .ResetColorizer ()
233226 instance .ResetFont ()
234227 instance .set_notabs_indentwidth ()
@@ -583,6 +576,8 @@ def create_page_highlight(self):
583576 (*)theme_message: Label
584577 """
585578 self .theme_elements = {
579+ # Display_name: ('internal_name, sort_number').
580+ # TODO: remove sort_number unneeded with dict ordering.
586581 'Normal Code or Text' : ('normal' , '00' ),
587582 'Code Context' : ('context' , '01' ),
588583 'Python Keywords' : ('keyword' , '02' ),
@@ -765,7 +760,7 @@ def load_theme_cfg(self):
765760 self .builtinlist .SetMenu (item_list , item_list [0 ])
766761 self .set_theme_type ()
767762 # Load theme element option menu.
768- theme_names = list (self .theme_elements . keys () )
763+ theme_names = list (self .theme_elements )
769764 theme_names .sort (key = lambda x : self .theme_elements [x ][1 ])
770765 self .targetlist .SetMenu (theme_names , theme_names [0 ])
771766 self .paint_theme_sample ()
@@ -1477,12 +1472,13 @@ def load_keys_list(self, keyset_name):
14771472 reselect = True
14781473 list_index = self .bindingslist .index (ANCHOR )
14791474 keyset = idleConf .GetKeySet (keyset_name )
1480- bind_names = list (keyset .keys ())
1475+ # 'set' is dict mapping virtual event to list of key events.
1476+ bind_names = list (keyset )
14811477 bind_names .sort ()
14821478 self .bindingslist .delete (0 , END )
14831479 for bind_name in bind_names :
14841480 key = ' ' .join (keyset [bind_name ])
1485- bind_name = bind_name [2 :- 2 ] # Trim off the angle brackets.
1481+ bind_name = bind_name [2 :- 2 ] # Trim double angle brackets.
14861482 if keyset_name in changes ['keys' ]:
14871483 # Handle any unsaved changes to this key set.
14881484 if bind_name in changes ['keys' ][keyset_name ]:
0 commit comments