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

Skip to content

Commit f31eec0

Browse files
author
Steven M. Gava
committed
further work on new config system
1 parent a8e1d81 commit f31eec0

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

Lib/idlelib/configDialog.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,10 @@ def VarChanged_customTheme(self,*params):
463463
def VarChanged_themeIsBuiltin(self,*params):
464464
value=self.themeIsBuiltin.get()
465465
self.AddChangedItem('main','Theme','default',value)
466-
self.PaintThemeSample()
466+
if value:
467+
self.VarChanged_builtinTheme()
468+
else:
469+
self.VarChanged_customTheme()
467470

468471
def VarChanged_highlightTarget(self,*params):
469472
self.SetHighlightTarget()
@@ -495,9 +498,9 @@ def VarChanged_keysAreBuiltin(self,*params):
495498
value=self.keysAreBuiltin.get()
496499
self.AddChangedItem('main','Keys','default',value)
497500
if value:
498-
self.LoadKeysList(self.builtinKeys.get())
501+
self.VarChanged_builtinKeys()
499502
else:
500-
self.LoadKeysList(self.customKeys.get())
503+
self.VarChanged_customKeys()
501504

502505
def VarChanged_winWidth(self,*params):
503506
value=self.winWidth.get()
@@ -936,24 +939,31 @@ def LoadThemeCfg(self):
936939
type='bool',default=1))
937940
##currently set theme
938941
currentOption=idleConf.CurrentTheme()
942+
print 'current option',currentOption
939943
##load available theme option menus
940944
if self.themeIsBuiltin.get(): #default theme selected
945+
print 'builtin theme'
941946
itemList=idleConf.GetSectionList('default','highlight')
942947
itemList.sort()
948+
print 'builtin items:',itemList
943949
self.optMenuThemeBuiltin.SetMenu(itemList,currentOption)
944950
itemList=idleConf.GetSectionList('user','highlight')
945951
itemList.sort()
952+
print 'user items:',itemList
946953
if not itemList:
947954
self.radioThemeCustom.config(state=DISABLED)
948955
self.customTheme.set('- no custom themes -')
949956
else:
950957
self.optMenuThemeCustom.SetMenu(itemList,itemList[0])
951958
else: #user theme selected
959+
print 'user theme'
952960
itemList=idleConf.GetSectionList('user','highlight')
953961
itemList.sort()
962+
print 'user items:',itemList
954963
self.optMenuThemeCustom.SetMenu(itemList,currentOption)
955964
itemList=idleConf.GetSectionList('default','highlight')
956965
itemList.sort()
966+
print 'builtin items:',itemList
957967
self.optMenuThemeBuiltin.SetMenu(itemList,itemList[0])
958968
self.SetThemeType()
959969
##load theme element option menu
@@ -1112,4 +1122,5 @@ def Help(self):
11121122
root=Tk()
11131123
Button(root,text='Dialog',
11141124
command=lambda:ConfigDialog(root,'Settings')).pack()
1125+
root.instanceDict={}
11151126
root.mainloop()

Lib/idlelib/keybindingDialog.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ def BuildKeyString(self):
142142
if modifiers: modifiers[0]='<'+modifiers[0]
143143
keyList=keyList+modifiers
144144
if finalKey:
145-
if (not modifiers) and (finalKey in self.functionKeys):
145+
if (not modifiers) and (finalKey not
146+
in self.alphanumKeys+self.punctuationKeys):
146147
finalKey='<'+self.TranslateKey(finalKey)
147148
else:
148149
finalKey=self.TranslateKey(finalKey)
@@ -225,16 +226,18 @@ def KeysOk(self):
225226
tkMessageBox.showerror(title='Key Sequence Error',
226227
message='No final key specified.')
227228
keysOk=0
228-
elif (not modifiers) and (finalKey not in self.functionKeys):
229-
#modifier required if not a function key
229+
elif (not modifiers) and (finalKey in
230+
self.alphanumKeys+self.punctuationKeys):
231+
#modifier required
230232
tkMessageBox.showerror(title='Key Sequence Error',
231233
message='No modifier key(s) specified.')
232234
keysOk=0
233-
elif (modifiers==['Shift']) and (finalKey not in self.functionKeys):
235+
elif (modifiers==['Shift']) and (finalKey not
236+
in self.functionKeys+('Tab',)):
234237
#shift alone is only a useful modifier with a function key
235238
tkMessageBox.showerror(title='Key Sequence Error',
236-
message='Shift alone is only a useful modifier '+
237-
'when used with a function key.')
239+
message='Shift alone is not a useful modifier '+
240+
'when used with this final key key.')
238241
keysOk=0
239242
elif keySequence in self.currentKeySequences: #keys combo already in use
240243
tkMessageBox.showerror(title='Key Sequence Error',

0 commit comments

Comments
 (0)