diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2015-11-12 20:02:57 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2015-11-12 20:02:57 (GMT) |
commit | d0c0f0041c3eb561adfa57179bc41f4dae212317 (patch) | |
tree | 5c9d1a6b937f7f89aff55ffcb21802aacf95d875 /Lib/idlelib/configHandler.py | |
parent | 84023247b432afba7075e87090986bca72a0e8b0 (diff) | |
download | cpython-d0c0f0041c3eb561adfa57179bc41f4dae212317.zip cpython-d0c0f0041c3eb561adfa57179bc41f4dae212317.tar.gz cpython-d0c0f0041c3eb561adfa57179bc41f4dae212317.tar.bz2 |
Issue #25313: Change the handling of new built-in text color themes to better
address the compatibility problem introduced by the addition of IDLE Dark.
Consistently use the revised idleConf.CurrentTheme everywhere in idlelib.
Diffstat (limited to 'Lib/idlelib/configHandler.py')
-rw-r--r-- | Lib/idlelib/configHandler.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py index 83abad7..336d969 100644 --- a/Lib/idlelib/configHandler.py +++ b/Lib/idlelib/configHandler.py @@ -372,8 +372,32 @@ class IdleConf: return theme def CurrentTheme(self): - "Return the name of the currently active theme." - return self.GetOption('main', 'Theme', 'name', default='') + """Return the name of the currently active text color theme. + + idlelib.config-main.def includes this section + [Theme] + default= 1 + name= IDLE Classic + name2= + # name2 set in user config-main.cfg for themes added after 2015 Oct 1 + + Item name2 is needed because setting name to a new builtin + causes older IDLEs to display multiple error messages or quit. + See https://bugs.python.org/issue25313. + When default = True, name2 takes precedence over name, + while older IDLEs will just use name. + """ + default = self.GetOption('main', 'Theme', 'default', + type='bool', default=True) + if default: + theme = self.GetOption('main', 'Theme', 'name2', default='') + if default and not theme or not default: + theme = self.GetOption('main', 'Theme', 'name', default='') + source = self.defaultCfg if default else self.userCfg + if source['highlight'].has_section(theme): + return theme + else: + return "IDLE Classic" def CurrentKeys(self): "Return the name of the currently active key set." |