Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b158541

Browse files
author
Steven M. Gava
committed
further work on dynamic config changes;
editor font
1 parent 314bae5 commit b158541

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

Lib/idlelib/EditorWindow.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,12 @@ def __init__(self, flist=None, filename=None, key=None, root=None):
159159
vbar.pack(side=RIGHT, fill=Y)
160160

161161
text['yscrollcommand'] = vbar.set
162+
fontWeight='normal'
163+
if idleConf.GetOption('main','EditorWindow','font-bold',type='bool'):
164+
fontWeight='bold'
162165
text.config(font=(idleConf.GetOption('main','EditorWindow','font'),
163-
idleConf.GetOption('main','EditorWindow','font-size')))
166+
idleConf.GetOption('main','EditorWindow','font-size'),
167+
fontWeight))
164168
text_frame.pack(side=LEFT, fill=BOTH, expand=1)
165169
text.pack(side=TOP, fill=BOTH, expand=1)
166170
text.focus_set()
@@ -478,6 +482,16 @@ def ResetColorizer(self):
478482
self.color = self.ColorDelegator()
479483
self.per.insertfilter(self.color)
480484

485+
def ResetFont(self):
486+
#this function is called from configDialog.py
487+
#to update the text widgets' font if it is changed
488+
fontWeight='normal'
489+
if idleConf.GetOption('main','EditorWindow','font-bold',type='bool'):
490+
fontWeight='bold'
491+
self.text.config(font=(idleConf.GetOption('main','EditorWindow','font'),
492+
idleConf.GetOption('main','EditorWindow','font-size'),
493+
fontWeight))
494+
481495
def saved_change_hook(self):
482496
short = self.short_title()
483497
long = self.long_title()

Lib/idlelib/configDialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,6 @@ def LoadThemeCfg(self):
939939
type='bool',default=1))
940940
##currently set theme
941941
currentOption=idleConf.CurrentTheme()
942-
print 'current option',currentOption
943942
##load available theme option menus
944943
if self.themeIsBuiltin.get(): #default theme selected
945944
itemList=idleConf.GetSectionList('default','highlight')
@@ -1096,6 +1095,7 @@ def ActivateConfigChanges(self):
10961095
winInstances=self.parent.instanceDict.keys()
10971096
for instance in winInstances:
10981097
instance.ResetColorizer()
1098+
instance.ResetFont()
10991099

11001100
def Cancel(self):
11011101
self.destroy()

0 commit comments

Comments
 (0)