Issue #27245: IDLE: Cleanly delete custom themes and key bindings.

Previously, when IDLE was started from a console or by import, a cascade
of warnings was emitted.  Patch by Serhiy Storchaka.
This commit is contained in:
Terry Jan Reedy 2016-06-14 00:53:18 -04:00
parent 53e9f83486
commit 92390ab932
1 changed files with 6 additions and 2 deletions

View File

@ -767,6 +767,7 @@ class ConfigDialog(Toplevel):
if not tkMessageBox.askyesno(
'Delete Key Set', delmsg % keySetName, parent=self):
return
self.DeactivateCurrentConfig()
#remove key set from config
idleConf.userCfg['keys'].remove_section(keySetName)
if keySetName in self.changedItems['keys']:
@ -785,7 +786,8 @@ class ConfigDialog(Toplevel):
self.keysAreBuiltin.set(idleConf.defaultCfg['main'].Get('Keys', 'default'))
self.builtinKeys.set(idleConf.defaultCfg['main'].Get('Keys', 'name'))
#user can't back out of these changes, they must be applied now
self.Apply()
self.SaveAllChangedConfigs()
self.ActivateConfigChanges()
self.SetKeysType()
def DeleteCustomTheme(self):
@ -794,6 +796,7 @@ class ConfigDialog(Toplevel):
if not tkMessageBox.askyesno(
'Delete Theme', delmsg % themeName, parent=self):
return
self.DeactivateCurrentConfig()
#remove theme from config
idleConf.userCfg['highlight'].remove_section(themeName)
if themeName in self.changedItems['highlight']:
@ -812,7 +815,8 @@ class ConfigDialog(Toplevel):
self.themeIsBuiltin.set(idleConf.defaultCfg['main'].Get('Theme', 'default'))
self.builtinTheme.set(idleConf.defaultCfg['main'].Get('Theme', 'name'))
#user can't back out of these changes, they must be applied now
self.Apply()
self.SaveAllChangedConfigs()
self.ActivateConfigChanges()
self.SetThemeType()
def GetColour(self):