bpo-34548: IDLE: use configured theme colors in TextView (GH-9008)

https://bugs.python.org/issue34548
This commit is contained in:
Tal Einat 2018-09-23 15:23:15 +03:00 committed by Miss Islington (bot)
parent 24b447edf2
commit c87d9f406b
3 changed files with 12 additions and 9 deletions

View file

@ -31,11 +31,12 @@ def make_pat():
prog = re.compile(make_pat(), re.S)
idprog = re.compile(r"\s+(\w+)", re.S)
def color_config(text): # Called from htest, Editor, and Turtle Demo.
'''Set color opitons of Text widget.
def color_config(text):
"""Set color options of Text widget.
Should be called whenever ColorDelegator is called.
'''
If ColorDelegator is used, this should be called first.
"""
# Called from htest, TextFrame, Editor, and Turtledemo.
# Not automatic because ColorDelegator does not know 'text'.
theme = idleConf.CurrentTheme()
normal_colors = idleConf.GetHighlight(theme, 'normal')
@ -50,6 +51,7 @@ def color_config(text): # Called from htest, Editor, and Turtle Demo.
inactiveselectbackground=select_colors['background'], # new in 8.5
)
class ColorDelegator(Delegator):
def __init__(self):
@ -285,6 +287,7 @@ def _color_delegator(parent): # htest #
d = ColorDelegator()
p.insertfilter(d)
if __name__ == "__main__":
from unittest import main
main('idlelib.idle_test.test_colorizer', verbosity=2, exit=False)