Skip to content

Commit 48fcc72

Browse files
authored
[3.6] bpo-31083: IDLE: Describe the Page classes in configdialog (pythonGH-2965) (python#2973)
Add template as comment. Update existing classes to match outline. Initial patch by Cheryl Sabella. (cherry picked from commit 6f446be)
1 parent f9463b8 commit 48fcc72

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

Lib/idlelib/configdialog.py

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,11 +1382,27 @@ def save_all_changed_extensions(self):
13821382
self.ext_userCfg.Save()
13831383

13841384

1385+
# class TabPage(Frame): # A template for Page classes.
1386+
# def __init__(self, master):
1387+
# super().__init__(master)
1388+
# self.create_page_tab()
1389+
# self.load_tab_cfg()
1390+
# def create_page_tab(self):
1391+
# # Define tk vars and register var and callback with tracers.
1392+
# # Create subframes and widgets.
1393+
# # Pack widgets.
1394+
# def load_tab_cfg(self):
1395+
# # Initialize widgets with data from idleConf.
1396+
# def var_changed_var_name():
1397+
# # For each tk var that needs other than default callback.
1398+
# def other_methods():
1399+
# # Define tab-specific behavior.
1400+
1401+
13851402
class FontPage(Frame):
13861403

1387-
def __init__(self, parent, highpage):
1388-
super().__init__(parent)
1389-
self.parent = parent
1404+
def __init__(self, master, highpage):
1405+
super().__init__(master)
13901406
self.highlight_sample = highpage.highlight_sample
13911407
self.create_page_font_tab()
13921408
self.load_font_cfg()
@@ -1439,19 +1455,17 @@ def create_page_font_tab(self):
14391455
indent_title: Label
14401456
(*)indent_scale: Scale - space_num
14411457
"""
1442-
parent = self.parent
1443-
self.font_name = tracers.add(StringVar(parent), self.var_changed_font)
1444-
self.font_size = tracers.add(StringVar(parent), self.var_changed_font)
1445-
self.font_bold = tracers.add(BooleanVar(parent), self.var_changed_font)
1458+
self.font_name = tracers.add(StringVar(self), self.var_changed_font)
1459+
self.font_size = tracers.add(StringVar(self), self.var_changed_font)
1460+
self.font_bold = tracers.add(BooleanVar(self), self.var_changed_font)
14461461
self.space_num = tracers.add(IntVar(self), ('main', 'Indent', 'num-spaces'))
14471462

14481463
# Create widgets:
14491464
# body and body section frames.
1450-
frame = self
14511465
frame_font = LabelFrame(
1452-
frame, borderwidth=2, relief=GROOVE, text=' Base Editor Font ')
1466+
self, borderwidth=2, relief=GROOVE, text=' Base Editor Font ')
14531467
frame_indent = LabelFrame(
1454-
frame, borderwidth=2, relief=GROOVE, text=' Indentation Width ')
1468+
self, borderwidth=2, relief=GROOVE, text=' Indentation Width ')
14551469
# frame_font.
14561470
frame_font_name = Frame(frame_font)
14571471
frame_font_param = Frame(frame_font)
@@ -1471,7 +1485,7 @@ def create_page_font_tab(self):
14711485
frame_font_param, variable=self.font_bold,
14721486
onvalue=1, offvalue=0, text='Bold')
14731487
frame_font_sample = Frame(frame_font, relief=SOLID, borderwidth=1)
1474-
temp_font = tkFont.Font(parent, ('courier', 10, 'normal'))
1488+
temp_font = tkFont.Font(self, ('courier', 10, 'normal'))
14751489
self.font_sample = Label(
14761490
frame_font_sample, justify=LEFT, font=temp_font,
14771491
text='AaBbCcDdEe\nFfGgHhIiJj\n1234567890\n#:+=(){}[]')
@@ -1503,8 +1517,6 @@ def create_page_font_tab(self):
15031517
indent_title.pack(side=TOP, anchor=W, padx=5)
15041518
self.indent_scale.pack(side=TOP, padx=5, fill=X)
15051519

1506-
return frame
1507-
15081520
def load_font_cfg(self):
15091521
"""Load current configuration settings for the font options.
15101522
@@ -1597,8 +1609,8 @@ def var_changed_space_num(self, *params):
15971609

15981610
class GenPage(Frame):
15991611

1600-
def __init__(self, parent):
1601-
super().__init__(parent)
1612+
def __init__(self, master):
1613+
super().__init__(master)
16021614
self.create_page_general()
16031615
self.load_general_cfg()
16041616

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
IDLE - Add an outline of a TabPage class in configdialog.
2+
Update existing classes to match outline.
3+
Initial patch by Cheryl Sabella.

0 commit comments

Comments
 (0)