@@ -268,27 +268,28 @@ def create_page_extensions(self):
268268 set_extension_value: Set in userCfg['extensions'].
269269 save_all_changed_extensions: Call extension page Save().
270270 """
271- parent = self .parent
272- frame = Frame (self .note )
273271 self .ext_defaultCfg = idleConf .defaultCfg ['extensions' ]
274272 self .ext_userCfg = idleConf .userCfg ['extensions' ]
275273 self .is_int = self .register (is_int )
276274 self .load_extensions ()
277275 # Create widgets - a listbox shows all available extensions, with the
278276 # controls for the extension selected in the listbox to the right.
279277 self .extension_names = StringVar (self )
280- frame .rowconfigure (0 , weight = 1 )
281- frame .columnconfigure (2 , weight = 1 )
282- self .extension_list = Listbox (frame , listvariable = self .extension_names ,
278+ frame = Frame (self .note )
279+ frame_ext = LabelFrame (frame , borderwidth = 2 , relief = GROOVE ,
280+ text = ' Feature Extensions ' )
281+ frame_ext .rowconfigure (0 , weight = 1 )
282+ frame_ext .columnconfigure (2 , weight = 1 )
283+ self .extension_list = Listbox (frame_ext , listvariable = self .extension_names ,
283284 selectmode = 'browse' )
284285 self .extension_list .bind ('<<ListboxSelect>>' , self .extension_selected )
285- scroll = Scrollbar (frame , command = self .extension_list .yview )
286+ scroll = Scrollbar (frame_ext , command = self .extension_list .yview )
286287 self .extension_list .yscrollcommand = scroll .set
287- self .details_frame = LabelFrame (frame , width = 250 , height = 250 )
288+ self .details_frame = LabelFrame (frame_ext , width = 250 , height = 250 )
288289 self .extension_list .grid (column = 0 , row = 0 , sticky = 'nws' )
289290 scroll .grid (column = 1 , row = 0 , sticky = 'ns' )
290291 self .details_frame .grid (column = 2 , row = 0 , sticky = 'nsew' , padx = [10 , 0 ])
291- frame .configure (padding = 10 )
292+ frame_ext .configure (padding = 10 )
292293 self .config_frame = {}
293294 self .current_extension = None
294295
@@ -304,6 +305,13 @@ def create_page_extensions(self):
304305 self .extension_list .selection_set (0 )
305306 self .extension_selected (None )
306307
308+
309+ self .frame_help = HelpFrame (frame , borderwidth = 2 , relief = GROOVE ,
310+ text = ' Help Menu Extensions ' )
311+ frame_ext .grid (row = 0 , column = 0 , sticky = 'nsew' )
312+ Label (frame ).grid (row = 1 , column = 0 )
313+ self .frame_help .grid (row = 2 , column = 0 , sticky = 'sew' )
314+
307315 return frame
308316
309317 def load_extensions (self ):
@@ -1854,14 +1862,6 @@ def create_page_general(self):
18541862 frame_auto_squeeze_min_lines: Frame
18551863 auto_squeeze_min_lines_title: Label
18561864 (*)auto_squeeze_min_lines_int: Entry - auto_squeeze_min_lines
1857- frame_help: LabelFrame
1858- frame_helplist: Frame
1859- frame_helplist_buttons: Frame
1860- (*)button_helplist_edit
1861- (*)button_helplist_add
1862- (*)button_helplist_remove
1863- (*)helplist: ListBox
1864- scroll_helplist: Scrollbar
18651865 """
18661866 # Integer values need StringVar because int('') raises.
18671867 self .startup_edit = tracers .add (
@@ -1902,8 +1902,6 @@ def create_page_general(self):
19021902 text = ' Editor Preferences' )
19031903 frame_shell = LabelFrame (self , borderwidth = 2 , relief = GROOVE ,
19041904 text = ' Shell Preferences' )
1905- frame_help = LabelFrame (self , borderwidth = 2 , relief = GROOVE ,
1906- text = ' Additional Help Sources ' )
19071905 # Frame_window.
19081906 frame_run = Frame (frame_window , borderwidth = 0 )
19091907 startup_title = Label (frame_run , text = 'At Startup' )
@@ -1999,32 +1997,11 @@ def create_page_general(self):
19991997 validatecommand = self .digits_only , validate = 'key' ,
20001998 )
20011999
2002- # frame_help.
2003- frame_helplist = Frame (frame_help )
2004- frame_helplist_buttons = Frame (frame_helplist )
2005- self .helplist = Listbox (
2006- frame_helplist , height = 5 , takefocus = True ,
2007- exportselection = FALSE )
2008- scroll_helplist = Scrollbar (frame_helplist )
2009- scroll_helplist ['command' ] = self .helplist .yview
2010- self .helplist ['yscrollcommand' ] = scroll_helplist .set
2011- self .helplist .bind ('<ButtonRelease-1>' , self .help_source_selected )
2012- self .button_helplist_edit = Button (
2013- frame_helplist_buttons , text = 'Edit' , state = 'disabled' ,
2014- width = 8 , command = self .helplist_item_edit )
2015- self .button_helplist_add = Button (
2016- frame_helplist_buttons , text = 'Add' ,
2017- width = 8 , command = self .helplist_item_add )
2018- self .button_helplist_remove = Button (
2019- frame_helplist_buttons , text = 'Remove' , state = 'disabled' ,
2020- width = 8 , command = self .helplist_item_remove )
2021-
20222000 # Pack widgets:
20232001 # Body.
20242002 frame_window .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
20252003 frame_editor .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
20262004 frame_shell .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
2027- frame_help .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
20282005 # frame_run.
20292006 frame_run .pack (side = TOP , padx = 5 , pady = 0 , fill = X )
20302007 startup_title .pack (side = LEFT , anchor = W , padx = 5 , pady = 5 )
@@ -2077,17 +2054,12 @@ def create_page_general(self):
20772054 auto_squeeze_min_lines_title .pack (side = LEFT , anchor = W , padx = 5 , pady = 5 )
20782055 self .auto_squeeze_min_lines_int .pack (side = TOP , padx = 5 , pady = 5 )
20792056
2080- # frame_help.
2081- frame_helplist_buttons .pack (side = RIGHT , padx = 5 , pady = 5 , fill = Y )
2082- frame_helplist .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
2083- scroll_helplist .pack (side = RIGHT , anchor = W , fill = Y )
2084- self .helplist .pack (side = LEFT , anchor = E , expand = TRUE , fill = BOTH )
2085- self .button_helplist_edit .pack (side = TOP , anchor = W , pady = 5 )
2086- self .button_helplist_add .pack (side = TOP , anchor = W )
2087- self .button_helplist_remove .pack (side = TOP , anchor = W , pady = 5 )
2088-
20892057 def load_general_cfg (self ):
20902058 "Load current configuration settings for the general options."
2059+ self .load_windows_cfg ()
2060+ self .load_shelled_cfg ()
2061+
2062+ def load_windows_cfg (self ):
20912063 # Set variables for all windows.
20922064 self .startup_edit .set (idleConf .GetOption (
20932065 'main' , 'General' , 'editor-on-startup' , type = 'bool' ))
@@ -2106,6 +2078,7 @@ def load_general_cfg(self):
21062078 self .paren_bell .set (idleConf .GetOption (
21072079 'extensions' , 'ParenMatch' , 'bell' ))
21082080
2081+ def load_shelled_cfg (self ):
21092082 # Set variables for editor windows.
21102083 self .autosave .set (idleConf .GetOption (
21112084 'main' , 'General' , 'autosave' , default = 0 , type = 'bool' ))
@@ -2120,12 +2093,63 @@ def load_general_cfg(self):
21202093 self .auto_squeeze_min_lines .set (idleConf .GetOption (
21212094 'main' , 'PyShell' , 'auto-squeeze-min-lines' , type = 'int' ))
21222095
2123- # Set additional help sources.
2124- self .user_helplist = idleConf .GetAllExtraHelpSourcesList ()
2125- self .helplist .delete (0 , 'end' )
2126- for help_item in self .user_helplist :
2127- self .helplist .insert (END , help_item [0 ])
2128- self .set_add_delete_state ()
2096+
2097+ class HelpFrame (LabelFrame ):
2098+
2099+ def __init__ (self , master , ** cfg ):
2100+ super ().__init__ (master , ** cfg )
2101+ self .create_frame_help ()
2102+ self .load_helplist ()
2103+
2104+ def create_frame_help (self ):
2105+ """Create LabelFrame for additional help menu sources.
2106+
2107+ load_helplist loads list user_helplist with
2108+ name, position pairs and copies names to listbox helplist.
2109+ Clicking a name invokes help_source selected. Clicking
2110+ button_helplist_name invokes helplist_item_name, which also
2111+ changes user_helplist. These functions all call
2112+ set_add_delete_state. All but load call update_help_changes to
2113+ rewrite changes['main']['HelpFiles'].
2114+
2115+ Widgets for HelpFrame(LabelFrame): (*) widgets bound to self
2116+ frame_helplist: Frame
2117+ (*)helplist: ListBox
2118+ scroll_helplist: Scrollbar
2119+ frame_buttons: Frame
2120+ (*)button_helplist_edit
2121+ (*)button_helplist_add
2122+ (*)button_helplist_remove
2123+ """
2124+ # self = frame_help in dialog (until ExtPage class).
2125+ frame_helplist = Frame (self )
2126+ self .helplist = Listbox (
2127+ frame_helplist , height = 5 , takefocus = True ,
2128+ exportselection = FALSE )
2129+ scroll_helplist = Scrollbar (frame_helplist )
2130+ scroll_helplist ['command' ] = self .helplist .yview
2131+ self .helplist ['yscrollcommand' ] = scroll_helplist .set
2132+ self .helplist .bind ('<ButtonRelease-1>' , self .help_source_selected )
2133+
2134+ frame_buttons = Frame (self )
2135+ self .button_helplist_edit = Button (
2136+ frame_buttons , text = 'Edit' , state = 'disabled' ,
2137+ width = 8 , command = self .helplist_item_edit )
2138+ self .button_helplist_add = Button (
2139+ frame_buttons , text = 'Add' ,
2140+ width = 8 , command = self .helplist_item_add )
2141+ self .button_helplist_remove = Button (
2142+ frame_buttons , text = 'Remove' , state = 'disabled' ,
2143+ width = 8 , command = self .helplist_item_remove )
2144+
2145+ # Pack frame_help.
2146+ frame_helplist .pack (side = LEFT , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
2147+ self .helplist .pack (side = LEFT , anchor = E , expand = TRUE , fill = BOTH )
2148+ scroll_helplist .pack (side = RIGHT , anchor = W , fill = Y )
2149+ frame_buttons .pack (side = RIGHT , padx = 5 , pady = 5 , fill = Y )
2150+ self .button_helplist_edit .pack (side = TOP , anchor = W , pady = 5 )
2151+ self .button_helplist_add .pack (side = TOP , anchor = W )
2152+ self .button_helplist_remove .pack (side = TOP , anchor = W , pady = 5 )
21292153
21302154 def help_source_selected (self , event ):
21312155 "Handle event for selecting additional help."
@@ -2195,6 +2219,14 @@ def update_help_changes(self):
21952219 'main' , 'HelpFiles' , str (num ),
21962220 ';' .join (self .user_helplist [num - 1 ][:2 ]))
21972221
2222+ def load_helplist (self ):
2223+ # Set additional help sources.
2224+ self .user_helplist = idleConf .GetAllExtraHelpSourcesList ()
2225+ self .helplist .delete (0 , 'end' )
2226+ for help_item in self .user_helplist :
2227+ self .helplist .insert (END , help_item [0 ])
2228+ self .set_add_delete_state ()
2229+
21982230
21992231class VarTrace :
22002232 """Maintain Tk variables trace state."""
0 commit comments