diff options
author | Cheryl Sabella <cheryl.sabella@gmail.com> | 2018-06-02 01:45:54 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2018-06-02 01:45:54 (GMT) |
commit | de6516264e793be991f692fdd892707afb9104a7 (patch) | |
tree | 8323fe9858ead378731de9edd748fd874f125559 /Lib/idlelib/idle_test | |
parent | 63799136e6c0491bb5d6f4a234d5a775db3458db (diff) | |
download | cpython-de6516264e793be991f692fdd892707afb9104a7.zip cpython-de6516264e793be991f692fdd892707afb9104a7.tar.gz cpython-de6516264e793be991f692fdd892707afb9104a7.tar.bz2 |
bpo-33679: IDLE: Re-enable color configuration for code context (GH-7199)
The difference from before is that the settings are now on the
Highlights tab instead of the Extensions tab and only change one theme
at a time instead of all themes. The default for light themes is black
on light gray, as before. The default for the IDLE Dark theme is white
on dark gray, which better fits the dark theme.
When one starts IDLE from a console and loads a custom theme without
definitions for 'context', one will see a warning message on the console.
To stop the warning, go to Options => Configure IDLE => Highlights,
select the custom theme if not selected already, select 'Code Context',
and select foreground and background colors.
Diffstat (limited to 'Lib/idlelib/idle_test')
-rw-r--r-- | Lib/idlelib/idle_test/test_codecontext.py | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/Lib/idlelib/idle_test/test_codecontext.py b/Lib/idlelib/idle_test/test_codecontext.py index 4c775ee..d446090 100644 --- a/Lib/idlelib/idle_test/test_codecontext.py +++ b/Lib/idlelib/idle_test/test_codecontext.py @@ -110,6 +110,8 @@ class CodeContextTest(unittest.TestCase): def test_reload(self): codecontext.CodeContext.reload() + self.assertEqual(self.cc.colors, {'background': 'lightgray', + 'foreground': '#000000'}) self.assertEqual(self.cc.context_depth, 15) def test_toggle_code_context_event(self): @@ -125,8 +127,8 @@ class CodeContextTest(unittest.TestCase): eq(toggle(), 'break') self.assertIsNotNone(cc.label) eq(cc.label['font'], cc.textfont) - eq(cc.label['fg'], cc.fgcolor) - eq(cc.label['bg'], cc.bgcolor) + eq(cc.label['fg'], cc.colors['foreground']) + eq(cc.label['bg'], cc.colors['background']) eq(cc.label['text'], '') # Toggle off. @@ -275,11 +277,13 @@ class CodeContextTest(unittest.TestCase): self.cc.timer_event() mock_update.assert_called() - def test_font_timer_event(self): + def test_config_timer_event(self): eq = self.assertEqual cc = self.cc save_font = cc.text['font'] + save_colors = codecontext.CodeContext.colors test_font = 'FakeFont' + test_colors = {'background': '#222222', 'foreground': '#ffff00'} # Ensure code context is not active. if cc.label: @@ -287,24 +291,42 @@ class CodeContextTest(unittest.TestCase): # Nothing updates on inactive code context. cc.text['font'] = test_font - cc.font_timer_event() + codecontext.CodeContext.colors = test_colors + cc.config_timer_event() eq(cc.textfont, save_font) + eq(cc.contextcolors, save_colors) - # Activate code context, but no change to font. + # Activate code context, but no change to font or color. cc.toggle_code_context_event() cc.text['font'] = save_font - cc.font_timer_event() + codecontext.CodeContext.colors = save_colors + cc.config_timer_event() eq(cc.textfont, save_font) + eq(cc.contextcolors, save_colors) eq(cc.label['font'], save_font) + eq(cc.label['background'], save_colors['background']) + eq(cc.label['foreground'], save_colors['foreground']) # Active code context, change font. cc.text['font'] = test_font - cc.font_timer_event() + cc.config_timer_event() eq(cc.textfont, test_font) + eq(cc.contextcolors, save_colors) eq(cc.label['font'], test_font) + eq(cc.label['background'], save_colors['background']) + eq(cc.label['foreground'], save_colors['foreground']) + # Active code context, change color. cc.text['font'] = save_font - cc.font_timer_event() + codecontext.CodeContext.colors = test_colors + cc.config_timer_event() + eq(cc.textfont, save_font) + eq(cc.contextcolors, test_colors) + eq(cc.label['font'], save_font) + eq(cc.label['background'], test_colors['background']) + eq(cc.label['foreground'], test_colors['foreground']) + codecontext.CodeContext.colors = save_colors + cc.config_timer_event() class HelperFunctionText(unittest.TestCase): |