@@ -153,114 +153,117 @@ def create_action_buttons(self):
153
153
def create_page_font_tab (self ):
154
154
"""Return frame of widgets for Font/Tabs tab.
155
155
156
- Enable users to provisionally change font face, size, or
156
+ Fonts: Enable users to provisionally change font face, size, or
157
157
boldness and to see the consequence of proposed choices. Each
158
158
action set 3 options in changes structuree and changes the
159
159
corresponding aspect of the font sample on this page and
160
160
highlight sample on highlight page.
161
161
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.
163
165
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.
170
169
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 .
173
172
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.
180
185
181
186
Widget Structure: (*) widgets bound to self
182
- frame
187
+ frame (of tab_pages)
183
188
frame_font: LabelFrame
184
189
frame_font_name: Frame
185
190
font_name_title: Label
186
- (*)fontlist: ListBox
191
+ (*)fontlist: ListBox - font_name
187
192
scroll_font: Scrollbar
188
193
frame_font_param: Frame
189
194
font_size_title: Label
190
- (*)opt_menu_font_size : DynOptionMenu - font_size
195
+ (*)sizelist : DynOptionMenu - font_size
191
196
(*)bold_toggle: Checkbutton - font_bold
192
197
frame_font_sample: Frame
193
198
(*)font_sample: Label
194
199
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
198
202
"""
199
203
parent = self .parent
200
204
self .font_name = StringVar (parent )
201
205
self .font_size = StringVar (parent )
202
206
self .font_bold = BooleanVar (parent )
203
207
self .space_num = IntVar (parent )
204
- self .edit_font = tkFont .Font (parent , ('courier' , 10 , 'normal' ))
205
208
206
- # Create widgets.
209
+ # Create widgets:
207
210
# body and body section frames.
208
211
frame = self .tab_pages .pages ['Fonts/Tabs' ].frame
209
212
frame_font = LabelFrame (
210
213
frame , borderwidth = 2 , relief = GROOVE , text = ' Base Editor Font ' )
211
214
frame_indent = LabelFrame (
212
215
frame , borderwidth = 2 , relief = GROOVE , text = ' Indentation Width ' )
213
- # frame_font
216
+ # frame_font.
214
217
frame_font_name = Frame (frame_font )
215
218
frame_font_param = Frame (frame_font )
216
219
font_name_title = Label (
217
220
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 )
220
223
self .fontlist .bind ('<ButtonRelease-1>' , self .on_fontlist_select )
221
224
self .fontlist .bind ('<KeyRelease-Up>' , self .on_fontlist_select )
222
225
self .fontlist .bind ('<KeyRelease-Down>' , self .on_fontlist_select )
223
226
scroll_font = Scrollbar (frame_font_name )
224
227
scroll_font .config (command = self .fontlist .yview )
225
228
self .fontlist .config (yscrollcommand = scroll_font .set )
226
229
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 )
229
232
self .bold_toggle = Checkbutton (
230
233
frame_font_param , variable = self .font_bold , onvalue = 1 ,
231
234
offvalue = 0 , text = 'Bold' , command = self .set_samples )
232
235
frame_font_sample = Frame (frame_font , relief = SOLID , borderwidth = 1 )
236
+ temp_font = tkFont .Font (parent , ('courier' , 10 , 'normal' ))
233
237
self .font_sample = Label (
234
- frame_font_sample , justify = LEFT , font = self . edit_font ,
238
+ frame_font_sample , justify = LEFT , font = temp_font ,
235
239
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 ,
240
243
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 ,
243
246
orient = 'horizontal' , tickinterval = 2 , from_ = 2 , to = 16 )
244
247
245
- # Pack widgets.
246
- # body
248
+ # Pack widgets:
249
+ # body.
247
250
frame_font .pack (side = LEFT , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
248
251
frame_indent .pack (side = LEFT , padx = 5 , pady = 5 , fill = Y )
249
- # frame_font
252
+ # frame_font.
250
253
frame_font_name .pack (side = TOP , padx = 5 , pady = 5 , fill = X )
251
254
frame_font_param .pack (side = TOP , padx = 5 , pady = 5 , fill = X )
252
255
font_name_title .pack (side = TOP , anchor = W )
253
256
self .fontlist .pack (side = LEFT , expand = TRUE , fill = X )
254
257
scroll_font .pack (side = LEFT , fill = Y )
255
258
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 )
257
260
self .bold_toggle .pack (side = LEFT , anchor = W , padx = 20 )
258
261
frame_font_sample .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
259
262
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 )
264
267
265
268
return frame
266
269
@@ -1410,7 +1413,7 @@ def load_font_cfg(self):
1410
1413
Attributes updated:
1411
1414
fontlist: Populate with fonts from tkinter.font.
1412
1415
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
1414
1417
to current size.
1415
1418
font_bold: Set to current font weight.
1416
1419
@@ -1437,9 +1440,9 @@ def load_font_cfg(self):
1437
1440
except ValueError :
1438
1441
pass
1439
1442
# 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 )
1443
1446
# Set font weight.
1444
1447
self .font_bold .set (font_bold )
1445
1448
# Set font sample.
0 commit comments