MCPcopy Index your code
hub / github.com/python/cpython / load_font_cfg

Method load_font_cfg

Lib/idlelib/configdialog.py:378–410  ·  view source on GitHub ↗

Load current configuration settings for the font options. Retrieve current font with idleConf.GetFont and font families from tk. Setup fontlist and set font_name. Setup sizelist, which sets font_size. Set font_bold. Call set_samples.

(self)

Source from the content-addressed store, hash-verified

376 font_sample_frame.pack(expand=TRUE, fill=BOTH)
377
378 def load_font_cfg(self):
379 """Load current configuration settings for the font options.
380
381 Retrieve current font with idleConf.GetFont and font families
382 from tk. Setup fontlist and set font_name. Setup sizelist,
383 which sets font_size. Set font_bold. Call set_samples.
384 """
385 configured_font = idleConf.GetFont(self, 'main', 'EditorWindow')
386 font_name = configured_font[0].lower()
387 font_size = configured_font[1]
388 font_bold = configured_font[2]=='bold'
389
390 # Set sorted no-duplicate editor font selection list and font_name.
391 fonts = sorted(set(tkfont.families(self)))
392 for font in fonts:
393 self.fontlist.insert(END, font)
394 self.font_name.set(font_name)
395 lc_fonts = [s.lower() for s in fonts]
396 try:
397 current_font_index = lc_fonts.index(font_name)
398 self.fontlist.see(current_font_index)
399 self.fontlist.select_set(current_font_index)
400 self.fontlist.select_anchor(current_font_index)
401 self.fontlist.activate(current_font_index)
402 except ValueError:
403 pass
404 # Set font size dropdown.
405 self.sizelist.SetMenu(('7', '8', '9', '10', '11', '12', '13', '14',
406 '16', '18', '20', '22', '25', '29', '34', '40'),
407 font_size)
408 # Set font weight.
409 self.font_bold.set(font_bold)
410 self.set_samples()
411
412 def var_changed_font(self, *params):
413 """Store changes to font attributes.

Callers 2

__init__Method · 0.95
test_load_font_cfgMethod · 0.80

Calls 10

set_samplesMethod · 0.95
setFunction · 0.85
GetFontMethod · 0.80
SetMenuMethod · 0.80
lowerMethod · 0.45
insertMethod · 0.45
setMethod · 0.45
indexMethod · 0.45
seeMethod · 0.45
activateMethod · 0.45

Tested by 1

test_load_font_cfgMethod · 0.64