[Python-checkins] [3.6] bpo-31083: IDLE: Describe the Page classes in configdialog (GH-2965) (#2973)

Terry Jan Reedy webhook-mailer at python.org
Tue Aug 1 01:00:38 EDT 2017


https://github.com/python/cpython/commit/48fcc72c83e1b47b200dd39f9dcc9f62fa0d4d17
commit: 48fcc72c83e1b47b200dd39f9dcc9f62fa0d4d17
branch: 3.6
author: Terry Jan Reedy <tjreedy at udel.edu>
committer: GitHub <noreply at github.com>
date: 2017-08-01T01:00:33-04:00
summary:

[3.6] bpo-31083: IDLE: Describe the Page classes in configdialog (GH-2965) (#2973)

Add template as comment. Update existing classes to match outline.
Initial patch by Cheryl Sabella.
(cherry picked from commit 6f446be)

files:
A Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst
M Lib/idlelib/configdialog.py

diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py
index 28070a51709..6d8a03b1c00 100644
--- a/Lib/idlelib/configdialog.py
+++ b/Lib/idlelib/configdialog.py
@@ -1382,11 +1382,27 @@ def save_all_changed_extensions(self):
             self.ext_userCfg.Save()
 
 
+# class TabPage(Frame):  # A template for Page classes.
+#     def __init__(self, master):
+#         super().__init__(master)
+#         self.create_page_tab()
+#         self.load_tab_cfg()
+#     def create_page_tab(self):
+#         # Define tk vars and register var and callback with tracers.
+#         # Create subframes and widgets.
+#         # Pack widgets.
+#     def load_tab_cfg(self):
+#         # Initialize widgets with data from idleConf.
+#     def var_changed_var_name():
+#         # For each tk var that needs other than default callback.
+#     def other_methods():
+#         # Define tab-specific behavior.
+
+
 class FontPage(Frame):
 
-    def __init__(self, parent, highpage):
-        super().__init__(parent)
-        self.parent = parent
+    def __init__(self, master, highpage):
+        super().__init__(master)
         self.highlight_sample = highpage.highlight_sample
         self.create_page_font_tab()
         self.load_font_cfg()
@@ -1439,19 +1455,17 @@ def create_page_font_tab(self):
                         indent_title: Label
                         (*)indent_scale: Scale - space_num
         """
-        parent = self.parent
-        self.font_name = tracers.add(StringVar(parent), self.var_changed_font)
-        self.font_size = tracers.add(StringVar(parent), self.var_changed_font)
-        self.font_bold = tracers.add(BooleanVar(parent), self.var_changed_font)
+        self.font_name = tracers.add(StringVar(self), self.var_changed_font)
+        self.font_size = tracers.add(StringVar(self), self.var_changed_font)
+        self.font_bold = tracers.add(BooleanVar(self), self.var_changed_font)
         self.space_num = tracers.add(IntVar(self), ('main', 'Indent', 'num-spaces'))
 
         # Create widgets:
         # body and body section frames.
-        frame = self
         frame_font = LabelFrame(
-                frame, borderwidth=2, relief=GROOVE, text=' Base Editor Font ')
+                self, borderwidth=2, relief=GROOVE, text=' Base Editor Font ')
         frame_indent = LabelFrame(
-                frame, borderwidth=2, relief=GROOVE, text=' Indentation Width ')
+                self, borderwidth=2, relief=GROOVE, text=' Indentation Width ')
         # frame_font.
         frame_font_name = Frame(frame_font)
         frame_font_param = Frame(frame_font)
@@ -1471,7 +1485,7 @@ def create_page_font_tab(self):
                 frame_font_param, variable=self.font_bold,
                 onvalue=1, offvalue=0, text='Bold')
         frame_font_sample = Frame(frame_font, relief=SOLID, borderwidth=1)
-        temp_font = tkFont.Font(parent, ('courier', 10, 'normal'))
+        temp_font = tkFont.Font(self, ('courier', 10, 'normal'))
         self.font_sample = Label(
                 frame_font_sample, justify=LEFT, font=temp_font,
                 text='AaBbCcDdEe\nFfGgHhIiJj\n1234567890\n#:+=(){}[]')
@@ -1503,8 +1517,6 @@ def create_page_font_tab(self):
         indent_title.pack(side=TOP, anchor=W, padx=5)
         self.indent_scale.pack(side=TOP, padx=5, fill=X)
 
-        return frame
-
     def load_font_cfg(self):
         """Load current configuration settings for the font options.
 
@@ -1597,8 +1609,8 @@ def var_changed_space_num(self, *params):
 
 class GenPage(Frame):
 
-    def __init__(self, parent):
-        super().__init__(parent)
+    def __init__(self, master):
+        super().__init__(master)
         self.create_page_general()
         self.load_general_cfg()
 
diff --git a/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst b/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst
new file mode 100644
index 00000000000..3bb337562de
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst
@@ -0,0 +1,3 @@
+IDLE - Add an outline of a TabPage class in configdialog.
+Update existing classes to match outline.
+Initial patch by Cheryl Sabella.



More information about the Python-checkins mailing list