diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2015-11-12 20:02:50 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2015-11-12 20:02:50 (GMT) |
commit | 35aa5d07a2865f34d178e7c35c1f1eeb73289eac (patch) | |
tree | c4a7f58dbb41a8c924040717a8da6e675bd39314 /Lib/idlelib/configHandler.py | |
parent | 0d649406aeda1c78ddd1061e5ece0c58120367ba (diff) | |
download | cpython-35aa5d07a2865f34d178e7c35c1f1eeb73289eac.zip cpython-35aa5d07a2865f34d178e7c35c1f1eeb73289eac.tar.gz cpython-35aa5d07a2865f34d178e7c35c1f1eeb73289eac.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 899e50a..7d1e388 100644 --- a/Lib/idlelib/configHandler.py +++ b/Lib/idlelib/configHandler.py @@ -373,8 +373,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." |