@@ -153,114 +153,117 @@ def create_action_buttons(self):
153153 def create_page_font_tab (self ):
154154 """Return frame of widgets for Font/Tabs tab.
155155
156- Enable users to provisionally change font face, size, or
156+ Fonts: Enable users to provisionally change font face, size, or
157157 boldness and to see the consequence of proposed choices. Each
158158 action set 3 options in changes structuree and changes the
159159 corresponding aspect of the font sample on this page and
160160 highlight sample on highlight page.
161161
162- Enable users to change spaces entered for indent tabs.
162+ Fontlist: mouse button 1 click or up or down key invoke
163+ on_fontlist_select(), which sets Var font_name and calls
164+ set_samples.
163165
164- Tk Variables:
165- font_name: Font face.
166- font_size: Font size.
167- font_bold: Select font bold or not.
168- Note: these 3 share var_changed_font callback.
169- space_num: Indentation width.
166+ Sizelist: clicking the menubutton opens the dropdown menu. A
167+ mouse button 1 click or return key invokes an internal command
168+ which sets Var font_size and calls set_samples.
170169
171- Data Attribute:
172- edit_font: Font with default font name, size, and weight .
170+ Bold_toggle, clicking the box toggles font_bold and calls
171+ set_samples .
173172
174- Methods:
175- load_font_cfg: Set vars and fontlist.
176- on_fontlist_select: Bound to fontlist button release
177- or key release.
178- set_samples: Notify both samples of any font change.
179- load_tab_cfg: Get current.
173+ Setting any of the font vars invokes var_changed_font, which
174+ adds all 3 font options to changes. Set_samples applies a new
175+ font constructed from the font vars to font_sample and
176+ highlight_sample on the hightlight page.
177+
178+ Tabs: Enable users to change spaces entered for indent tabs.
179+ Changing indent_scale value with the mouse sets Var space_num,
180+ which invokes var_changed_space_num, which adds an entry to
181+ changes.
182+
183+ Load_font_cfg and load_tab_cfg initialize vars and widgets from
184+ idleConf entries.
180185
181186 Widget Structure: (*) widgets bound to self
182- frame
187+ frame (of tab_pages)
183188 frame_font: LabelFrame
184189 frame_font_name: Frame
185190 font_name_title: Label
186- (*)fontlist: ListBox
191+ (*)fontlist: ListBox - font_name
187192 scroll_font: Scrollbar
188193 frame_font_param: Frame
189194 font_size_title: Label
190- (*)opt_menu_font_size : DynOptionMenu - font_size
195+ (*)sizelist : DynOptionMenu - font_size
191196 (*)bold_toggle: Checkbutton - font_bold
192197 frame_font_sample: Frame
193198 (*)font_sample: Label
194199 frame_indent: LabelFrame
195- frame_indent_size: Frame
196- indent_size_title: Label
197- (*)scale_indent_size: Scale - space_num
200+ indent_title: Label
201+ (*)indent_scale: Scale - space_num
198202 """
199203 parent = self .parent
200204 self .font_name = StringVar (parent )
201205 self .font_size = StringVar (parent )
202206 self .font_bold = BooleanVar (parent )
203207 self .space_num = IntVar (parent )
204- self .edit_font = tkFont .Font (parent , ('courier' , 10 , 'normal' ))
205208
206- # Create widgets.
209+ # Create widgets:
207210 # body and body section frames.
208211 frame = self .tab_pages .pages ['Fonts/Tabs' ].frame
209212 frame_font = LabelFrame (
210213 frame , borderwidth = 2 , relief = GROOVE , text = ' Base Editor Font ' )
211214 frame_indent = LabelFrame (
212215 frame , borderwidth = 2 , relief = GROOVE , text = ' Indentation Width ' )
213- # frame_font
216+ # frame_font.
214217 frame_font_name = Frame (frame_font )
215218 frame_font_param = Frame (frame_font )
216219 font_name_title = Label (
217220 frame_font_name , justify = LEFT , text = 'Font Face :' )
218- self .fontlist = Listbox (
219- frame_font_name , height = 5 , takefocus = FALSE , exportselection = FALSE )
221+ self .fontlist = Listbox (frame_font_name , height = 5 ,
222+ takefocus = FALSE , exportselection = FALSE )
220223 self .fontlist .bind ('<ButtonRelease-1>' , self .on_fontlist_select )
221224 self .fontlist .bind ('<KeyRelease-Up>' , self .on_fontlist_select )
222225 self .fontlist .bind ('<KeyRelease-Down>' , self .on_fontlist_select )
223226 scroll_font = Scrollbar (frame_font_name )
224227 scroll_font .config (command = self .fontlist .yview )
225228 self .fontlist .config (yscrollcommand = scroll_font .set )
226229 font_size_title = Label (frame_font_param , text = 'Size :' )
227- self .opt_menu_font_size = DynOptionMenu (
228- frame_font_param , self . font_size , None , command = self .set_samples )
230+ self .sizelist = DynOptionMenu (frame_font_param , self . font_size ,
231+ None , command = self .set_samples )
229232 self .bold_toggle = Checkbutton (
230233 frame_font_param , variable = self .font_bold , onvalue = 1 ,
231234 offvalue = 0 , text = 'Bold' , command = self .set_samples )
232235 frame_font_sample = Frame (frame_font , relief = SOLID , borderwidth = 1 )
236+ temp_font = tkFont .Font (parent , ('courier' , 10 , 'normal' ))
233237 self .font_sample = Label (
234- frame_font_sample , justify = LEFT , font = self . edit_font ,
238+ frame_font_sample , justify = LEFT , font = temp_font ,
235239 text = 'AaBbCcDdEe\n FfGgHhIiJjK\n 1234567890\n #:+=(){}[]' )
236- # frame_indent
237- frame_indent_size = Frame (frame_indent )
238- indent_size_title = Label (
239- frame_indent_size , justify = LEFT ,
240+ # frame_indent.
241+ indent_title = Label (
242+ frame_indent , justify = LEFT ,
240243 text = 'Python Standard: 4 Spaces!' )
241- self .scale_indent_size = Scale (
242- frame_indent_size , variable = self .space_num ,
244+ self .indent_scale = Scale (
245+ frame_indent , variable = self .space_num ,
243246 orient = 'horizontal' , tickinterval = 2 , from_ = 2 , to = 16 )
244247
245- # Pack widgets.
246- # body
248+ # Pack widgets:
249+ # body.
247250 frame_font .pack (side = LEFT , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
248251 frame_indent .pack (side = LEFT , padx = 5 , pady = 5 , fill = Y )
249- # frame_font
252+ # frame_font.
250253 frame_font_name .pack (side = TOP , padx = 5 , pady = 5 , fill = X )
251254 frame_font_param .pack (side = TOP , padx = 5 , pady = 5 , fill = X )
252255 font_name_title .pack (side = TOP , anchor = W )
253256 self .fontlist .pack (side = LEFT , expand = TRUE , fill = X )
254257 scroll_font .pack (side = LEFT , fill = Y )
255258 font_size_title .pack (side = LEFT , anchor = W )
256- self .opt_menu_font_size .pack (side = LEFT , anchor = W )
259+ self .sizelist .pack (side = LEFT , anchor = W )
257260 self .bold_toggle .pack (side = LEFT , anchor = W , padx = 20 )
258261 frame_font_sample .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
259262 self .font_sample .pack (expand = TRUE , fill = BOTH )
260- # frame_indent
261- frame_indent_size .pack (side = TOP , fill = X )
262- indent_size_title .pack (side = TOP , anchor = W , padx = 5 )
263- self .scale_indent_size .pack (side = TOP , padx = 5 , fill = X )
263+ # frame_indent.
264+ frame_indent .pack (side = TOP , fill = X )
265+ indent_title .pack (side = TOP , anchor = W , padx = 5 )
266+ self .indent_scale .pack (side = TOP , padx = 5 , fill = X )
264267
265268 return frame
266269
@@ -1410,7 +1413,7 @@ def load_font_cfg(self):
14101413 Attributes updated:
14111414 fontlist: Populate with fonts from tkinter.font.
14121415 font_name: Set to current font.
1413- opt_menu_font_size : Populate valid options tuple and set
1416+ sizelist : Populate valid options tuple and set
14141417 to current size.
14151418 font_bold: Set to current font weight.
14161419
@@ -1437,9 +1440,9 @@ def load_font_cfg(self):
14371440 except ValueError :
14381441 pass
14391442 # Set font size dropdown.
1440- self .opt_menu_font_size .SetMenu (('7' , '8' , '9' , '10' , '11' , '12' , '13' ,
1441- '14 ' , '16 ' , '18 ' , '20 ' , '22' ,
1442- '25' , '29' , '34' , '40' ), font_size )
1443+ self .sizelist .SetMenu (('7' , '8' , '9' , '10' , '11' , '12' , '13' , '14 ' ,
1444+ '16' , '18' , '20' , '22 ' , '25 ' , '29 ' , '34 ' , '40' ) ,
1445+ font_size )
14431446 # Set font weight.
14441447 self .font_bold .set (font_bold )
14451448 # Set font sample.
0 commit comments