Skip to content

Commit 136066b

Browse files
committed
New FontPage with changes from 30853
1 parent fdacf6d commit 136066b

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

Lib/idlelib/configdialog.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ def create_page_font_tab(self):
18481848
corresponding aspect of the font sample on this page and
18491849
highlight sample on highlight page.
18501850
1851-
Load_font_cfg initializes font vars and widgets from
1851+
Funtion load_font_cfg initializes font vars and widgets from
18521852
idleConf entries and tk.
18531853
18541854
Fontlist: mouse button 1 click or up or down key invoke
@@ -1866,7 +1866,7 @@ def create_page_font_tab(self):
18661866
18671867
Tabs: Enable users to change spaces entered for indent tabs.
18681868
Changing indent_scale value with the mouse sets Var space_num,
1869-
which invokes var_changed_space_num, which adds an entry to
1869+
which invokes the default callback to add an entry to
18701870
changes. Load_tab_cfg initializes space_num to default.
18711871
18721872
Widget Structure: (*) widgets bound to self
@@ -1887,10 +1887,10 @@ def create_page_font_tab(self):
18871887
(*)indent_scale: Scale - space_num
18881888
"""
18891889
parent = self.parent
1890-
self.font_name = StringVar(parent)
1891-
self.font_size = StringVar(parent)
1892-
self.font_bold = BooleanVar(parent)
1893-
self.space_num = IntVar(parent)
1890+
self.font_name = tracers.add(StringVar(parent), self.var_changed_font)
1891+
self.font_size = tracers.add(StringVar(parent), self.var_changed_font)
1892+
self.font_bold = tracers.add(BooleanVar(parent), self.var_changed_font)
1893+
self.space_num = tracers.add(IntVar(parent), ('main', 'Indent', 'num-spaces'))
18941894

18951895
# Create widgets:
18961896
# body and body section frames.
@@ -1963,7 +1963,7 @@ def load_font_cfg(self):
19631963
configured_font = idleConf.GetFont(self.parent, 'main', 'EditorWindow')
19641964
font_name = configured_font[0].lower()
19651965
font_size = configured_font[1]
1966-
font_bold = configured_font[2]=='bold'
1966+
font_bold = configured_font[2]=='bold'
19671967

19681968
# Set editor font selection list and font_name.
19691969
fonts = list(tkFont.families(self.parent))
@@ -1987,16 +1987,6 @@ def load_font_cfg(self):
19871987
# Set font weight.
19881988
self.font_bold.set(font_bold)
19891989

1990-
def on_fontlist_select(self, event):
1991-
"""Handle selecting a font from the list.
1992-
1993-
Event can result from either mouse click or Up or Down key.
1994-
Set font_name and example displays to selection.
1995-
"""
1996-
font = self.fontlist.get(
1997-
ACTIVE if event.type.name == 'KeyRelease' else ANCHOR)
1998-
self.font_name.set(font.lower())
1999-
20001990
def var_changed_font(self, *params):
20011991
"""Store changes to font attributes.
20021992
@@ -2012,6 +2002,16 @@ def var_changed_font(self, *params):
20122002
changes.add_option('main', 'EditorWindow', 'font-bold', value)
20132003
self.set_samples()
20142004

2005+
def on_fontlist_select(self, event):
2006+
"""Handle selecting a font from the list.
2007+
2008+
Event can result from either mouse click or Up or Down key.
2009+
Set font_name and example displays to selection.
2010+
"""
2011+
font = self.fontlist.get(
2012+
ACTIVE if event.type.name == 'KeyRelease' else ANCHOR)
2013+
self.font_name.set(font.lower())
2014+
20152015
def set_samples(self, event=None):
20162016
"""Update update both screen samples with the font settings.
20172017
@@ -2036,11 +2036,6 @@ def load_tab_cfg(self):
20362036
'main', 'Indent', 'num-spaces', default=4, type='int')
20372037
self.space_num.set(space_num)
20382038

2039-
def var_changed_space_num(self, *params):
2040-
"Store change to indentation size."
2041-
value = self.space_num.get()
2042-
changes.add_option('main', 'Indent', 'num-spaces', value)
2043-
20442039

20452040
class VarTrace:
20462041
"""Maintain Tk variables trace state."""

0 commit comments

Comments
 (0)