diff -r 2c124e30a324 Lib/idlelib/EditorWindow.py --- a/Lib/idlelib/EditorWindow.py Fri Aug 07 00:43:39 2015 -0700 +++ b/Lib/idlelib/EditorWindow.py Mon Aug 10 14:34:18 2015 -0700 @@ -758,6 +758,19 @@ self.per.removefilter(self.color) self.color = None + + def configuration_will_change(self): + "Callback from configuration dialog before settings are applied." + self.RemoveKeybindings() + + def configuration_changed(self): + "Callback from configuration dialog after settings are applied." + self.ResetColorizer() + self.ResetFont() + self.set_notabs_indentwidth() + self.ApplyKeybindings() + self.reset_help_menu_entries() + def ResetColorizer(self): "Update the color theme" # Called from self.filename_change_hook and from configDialog.py diff -r 2c124e30a324 Lib/idlelib/FileList.py --- a/Lib/idlelib/FileList.py Fri Aug 07 00:43:39 2015 -0700 +++ b/Lib/idlelib/FileList.py Mon Aug 10 14:34:18 2015 -0700 @@ -109,6 +109,16 @@ filename = os.path.join(pwd, filename) return os.path.normpath(filename) + def configuration_will_change(self): + "Callback from configuration dialog before settings are applied." + for w in self.inversedict.keys(): + w.configuration_will_change() + + def configuration_changed(self): + "Callback from configuration dialog after settings are applied." + for w in self.inversedict.keys(): + w.configuration_changed() + def _test(): from idlelib.EditorWindow import fixwordbreaks diff -r 2c124e30a324 Lib/idlelib/configDialog.py --- a/Lib/idlelib/configDialog.py Fri Aug 07 00:43:39 2015 -0700 +++ b/Lib/idlelib/configDialog.py Mon Aug 10 14:34:18 2015 -0700 @@ -30,8 +30,16 @@ """ Toplevel.__init__(self, parent) self.parent = parent - if _htest: - parent.instance_dict = {} + # Hold onto the list of files the parent belongs to, as the parent + # may go away if we're not modal. The file list may not be present + # e.g. if testing where we won't be passed an editor window; to + # prevent an API change we'll try to extract it here, rather than + # asking it to be passed to us. + try: + self.flist = parent.flist + except AttributeError: + self.flist = None + self.wm_withdraw() self.configure(borderwidth=5) @@ -70,6 +78,7 @@ #self.bind('', self.Help) #context help self.LoadConfigs() self.AttachVarCallbacks() #avoid callbacks during LoadConfigs + self.parent = None # after start, can't guarantee parent still exists if not _utest: self.wm_deiconify() @@ -1140,19 +1149,13 @@ def DeactivateCurrentConfig(self): #Before a config is saved, some cleanup of current #config must be done - remove the previous keybindings - winInstances = self.parent.instance_dict.keys() - for instance in winInstances: - instance.RemoveKeybindings() + if self.flist: + self.flist.configuration_will_change() def ActivateConfigChanges(self): "Dynamically apply configuration changes" - winInstances = self.parent.instance_dict.keys() - for instance in winInstances: - instance.ResetColorizer() - instance.ResetFont() - instance.set_notabs_indentwidth() - instance.ApplyKeybindings() - instance.reset_help_menu_entries() + if self.flist: + self.flist.configuration_changed() def Cancel(self): self.destroy() diff -r 2c124e30a324 Lib/idlelib/macosxSupport.py --- a/Lib/idlelib/macosxSupport.py Fri Aug 07 00:43:39 2015 -0700 +++ b/Lib/idlelib/macosxSupport.py Mon Aug 10 14:34:18 2015 -0700 @@ -171,6 +171,7 @@ # argument to ConfigDialog) root.instance_dict = flist.inversedict root.instance_dict = flist.inversedict + root.flist = flist configDialog.ConfigDialog(root, 'Settings') def help_dialog(event=None):