diff options
| author | Terry Jan Reedy <tjreedy@udel.edu> | 2015-08-01 22:57:27 (GMT) |
|---|---|---|
| committer | Terry Jan Reedy <tjreedy@udel.edu> | 2015-08-01 22:57:27 (GMT) |
| commit | 1235214945c72e7e0193cdbf3a89da7cff02f1af (patch) | |
| tree | 658abbb1ddf71e35b860eeac810d31e7d019fcf1 /Lib/idlelib/configDialog.py | |
| parent | 3f32b979d5de5db2e07359502797e1a0e7e7cd1c (diff) | |
| download | cpython-1235214945c72e7e0193cdbf3a89da7cff02f1af.zip cpython-1235214945c72e7e0193cdbf3a89da7cff02f1af.tar.gz cpython-1235214945c72e7e0193cdbf3a89da7cff02f1af.tar.bz2 | |
Issue 24745: Switch from Courier to platform-sensitive TkFixedFont as default
editor font. This should not affect current customized font selections.
Patch by Mark Roseman.
Diffstat (limited to 'Lib/idlelib/configDialog.py')
| -rw-r--r-- | Lib/idlelib/configDialog.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py index 41b76e8..6d152bd 100644 --- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -482,9 +482,9 @@ class ConfigDialog(Toplevel): return frame def AttachVarCallbacks(self): - self.fontSize.trace_variable('w', self.VarChanged_fontSize) - self.fontName.trace_variable('w', self.VarChanged_fontName) - self.fontBold.trace_variable('w', self.VarChanged_fontBold) + self.fontSize.trace_variable('w', self.VarChanged_font) + self.fontName.trace_variable('w', self.VarChanged_font) + self.fontBold.trace_variable('w', self.VarChanged_font) self.spaceNum.trace_variable('w', self.VarChanged_spaceNum) self.colour.trace_variable('w', self.VarChanged_colour) self.builtinTheme.trace_variable('w', self.VarChanged_builtinTheme) @@ -501,15 +501,15 @@ class ConfigDialog(Toplevel): self.autoSave.trace_variable('w', self.VarChanged_autoSave) self.encoding.trace_variable('w', self.VarChanged_encoding) - def VarChanged_fontSize(self, *params): - value = self.fontSize.get() - self.AddChangedItem('main', 'EditorWindow', 'font-size', value) - - def VarChanged_fontName(self, *params): + def VarChanged_font(self, *params): + '''When one font attribute changes, save them all, as they are + not independent from each other. In particular, when we are + overriding the default font, we need to write out everything. + ''' value = self.fontName.get() self.AddChangedItem('main', 'EditorWindow', 'font', value) - - def VarChanged_fontBold(self, *params): + value = self.fontSize.get() + self.AddChangedItem('main', 'EditorWindow', 'font-size', value) value = self.fontBold.get() self.AddChangedItem('main', 'EditorWindow', 'font-bold', value) @@ -975,24 +975,24 @@ class ConfigDialog(Toplevel): fonts.sort() for font in fonts: self.listFontName.insert(END, font) - configuredFont = idleConf.GetOption( - 'main', 'EditorWindow', 'font', default='courier') - lc_configuredFont = configuredFont.lower() - self.fontName.set(lc_configuredFont) + configuredFont = idleConf.GetFont(self, 'main', 'EditorWindow') + fontName = configuredFont[0].lower() + fontSize = configuredFont[1] + fontBold = configuredFont[2]=='bold' + self.fontName.set(fontName) lc_fonts = [s.lower() for s in fonts] - if lc_configuredFont in lc_fonts: - currentFontIndex = lc_fonts.index(lc_configuredFont) + try: + currentFontIndex = lc_fonts.index(fontName) self.listFontName.see(currentFontIndex) self.listFontName.select_set(currentFontIndex) self.listFontName.select_anchor(currentFontIndex) + except ValueError: + pass ##font size dropdown - fontSize = idleConf.GetOption( - 'main', 'EditorWindow', 'font-size', type='int', default='10') self.optMenuFontSize.SetMenu(('7', '8', '9', '10', '11', '12', '13', '14', '16', '18', '20', '22'), fontSize ) ##fontWeight - self.fontBold.set(idleConf.GetOption( - 'main', 'EditorWindow', 'font-bold', default=0, type='bool')) + self.fontBold.set(fontBold) ##font sample self.SetFontSample() |
