summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/colorizer.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-09-23 13:31:51 (GMT)
committerGitHub <noreply@github.com>2018-09-23 13:31:51 (GMT)
commit6b48f9854e2ae35fd74bcd359451eb37ae65f798 (patch)
treef3aa344c5995497d779b200b80a462b86036e64e /Lib/idlelib/colorizer.py
parent0b67995bfa45393585e2e0017c82c706c4a04b04 (diff)
downloadcpython-6b48f9854e2ae35fd74bcd359451eb37ae65f798.zip
cpython-6b48f9854e2ae35fd74bcd359451eb37ae65f798.tar.gz
cpython-6b48f9854e2ae35fd74bcd359451eb37ae65f798.tar.bz2
bpo-34548: IDLE: use configured theme colors in TextView (GH-9008)
https://bugs.python.org/issue34548 (cherry picked from commit c87d9f406bb23657c1b4cd63017bb7bd7693a1fb) Co-authored-by: Tal Einat <taleinat+github@gmail.com>
Diffstat (limited to 'Lib/idlelib/colorizer.py')
-rw-r--r--Lib/idlelib/colorizer.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/idlelib/colorizer.py b/Lib/idlelib/colorizer.py
index 58cced2..f2de9fc 100644
--- a/Lib/idlelib/colorizer.py
+++ b/Lib/idlelib/colorizer.py
@@ -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)