Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Lib/idlelib/colorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def make_pat():
idprog = re.compile(r"\s+(\w+)", re.S)

def color_config(text): # Called from htest, Editor, and Turtle Demo.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This inline comment wouldn't be true anymore after this change.

'''Set color opitons of Text widget.
"""Set color options of Text widget.

Should be called whenever ColorDelegator is called.
'''
"""
# Not automatic because ColorDelegator does not know 'text'.
theme = idleConf.CurrentTheme()
normal_colors = idleConf.GetHighlight(theme, 'normal')
Expand All @@ -50,6 +50,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):
Expand Down Expand Up @@ -285,6 +286,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)
Expand Down
9 changes: 4 additions & 5 deletions Lib/idlelib/textview.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from tkinter.ttk import Frame, Scrollbar, Button
from tkinter.messagebox import showerror

from idlelib.colorizer import color_config


class TextFrame(Frame):
"Display text with scrollbar."
Expand All @@ -18,12 +20,9 @@ def __init__(self, parent, rawtext):
super().__init__(parent)
self['relief'] = 'sunken'
self['height'] = 700
# TODO: get fg/bg from theme.
self.bg = '#ffffff'
self.fg = '#000000'

self.text = text = Text(self, wrap='word', highlightthickness=0,
fg=self.fg, bg=self.bg)
self.text = text = Text(self, wrap='word', highlightthickness=0)
color_config(self.text)
Comment thread
terryjreedy marked this conversation as resolved.
Outdated
self.scroll = scroll = Scrollbar(self, orient='vertical',
takefocus=False, command=text.yview)
text['yscrollcommand'] = scroll.set
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make TextView use the text colors from the main IDLE configuration.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terry will probably adjust the blurb to be clearer when he merges this (he has uncanny knack for writing succinctly and accurately). However, I think it should say something more like 'use the colors from the selected configuration theme.'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tal is a core developer and may be the one who merges this, making the final choice of blurb (usually aimed at users) and commit message (aimed at other developers and future IDLE maintainers, including ourselves.

In the meanwhile, I replaced the above with "Use user-selected color theme for read-only text views." I don't like 'Make' when another verb is available. Since this change is visible to users, I replaced the internal name 'TextView'.

If I write decent blurbs, it is because I edit and rewrite. I sometimes rewrite again before committing to the IDLE news file viewable from About IDLE.