1 ##---------------------------------------------------------------------------##
3 ## idle - configuration dialog
6 ##---------------------------------------------------------------------------##
11 import tkMessageBox
, tkColorChooser
, tkFont
15 class ConfigDialog(Toplevel
):
17 configuration dialog for idle
19 def __init__(self
,parent
,title
,configDict
):
21 configDict - dictionary of configuration items
23 Toplevel
.__init
__(self
, parent
)
24 self
.configure(borderwidth
=5)
25 self
.geometry("+%d+%d" % (parent
.winfo_rootx()+20,
26 parent
.winfo_rooty()+30))
28 #elguavas - config placeholders til config stuff completed
29 self
.bg
=self
.cget('bg')
33 self
.resizable(height
=FALSE
,width
=FALSE
)
35 self
.transient(parent
)
37 self
.protocol("WM_DELETE_WINDOW", self
.Cancel
)
39 self
.framePages
.focus_set()
40 #key bindings for this dialog
41 self
.bind('<Escape>',self
.CancelBinding
) #dismiss dialog, no save
42 self
.bind('<Alt-a>',self
.ApplyBinding
) #apply changes, save
43 self
.bind('<F1>',self
.HelpBinding
) #context help
44 self
.bind('<Alt-f>',self
.ChangePageBinding
)
45 self
.bind('<Alt-h>',self
.ChangePageBinding
)
46 self
.bind('<Alt-k>',self
.ChangePageBinding
)
47 self
.bind('<Alt-g>',self
.ChangePageBinding
)
51 #self.configParser=IdleConf.idleconf
53 #self.workingConfig={}
55 #print self.configParser.getsection('Colors').options()
56 self
.workingTestColours
={
73 def CancelBinding(self
,event
):
76 def OkBinding(self
,event
):
79 def ApplyBinding(self
,event
):
82 def HelpBinding(self
,event
):
86 self
.pages
[self
.pageNum
.get()].lift()
87 self
.title('Settings - '+
88 self
.pageButtons
[self
.pageNum
.get()].cget('text'))
90 def ChangePageBinding(self
,event
):
91 pageKeys
=('f','h','k','g')
100 def SetThemeType(self
):
101 if self
.themeType
.get()==0:
102 self
.optMenuThemeBuiltin
.config(state
=NORMAL
)
103 self
.optMenuThemeCustom
.config(state
=DISABLED
)
104 self
.buttonDeleteCustomTheme
.config(state
=DISABLED
)
105 elif self
.themeType
.get()==1:
106 self
.optMenuThemeBuiltin
.config(state
=DISABLED
)
107 self
.optMenuThemeCustom
.config(state
=NORMAL
)
108 self
.buttonDeleteCustomTheme
.config(state
=NORMAL
)
110 def SetKeysType(self
):
111 if self
.keysType
.get()==0:
112 self
.optMenuKeysBuiltin
.config(state
=NORMAL
)
113 self
.optMenuKeysCustom
.config(state
=DISABLED
)
114 self
.buttonDeleteCustomKeys
.config(state
=DISABLED
)
115 elif self
.keysType
.get()==1:
116 self
.optMenuKeysBuiltin
.config(state
=DISABLED
)
117 self
.optMenuKeysCustom
.config(state
=NORMAL
)
118 self
.buttonDeleteCustomKeys
.config(state
=NORMAL
)
121 rgbTuplet
, colourString
= tkColorChooser
.askcolor(parent
=self
,
122 title
='Pick new colour for : '+self
.highlightTarget
.get(),
123 initialcolor
=self
.workingTestColours
['Foo-Bg'])#._root()
124 if colourString
: #user didn't cancel
125 self
.workingTestColours
['Foo-Bg']=colourString
126 self
.frameColourSet
.config(bg
=self
.workingTestColours
['Foo-Bg'])
127 self
.labelTestSample
.config(bg
=self
.workingTestColours
['Foo-Bg'])
128 self
.frameHighlightSample
.config(bg
=self
.workingTestColours
['Foo-Bg'])
129 self
.frameColourSet
.update() #redraw after dialog
130 self
.frameHighlightSample
.update() #redraw after dialog
131 self
.labelTestSample
.update()
133 def __LoadFontList(self
):
134 fonts
=list(tkFont
.families(self
))
137 self
.listFontName
.insert(END
,font
)
138 currentFontIndex
=fonts
.index('courier')
139 self
.listFontName
.see(currentFontIndex
)
140 self
.listFontName
.select_set(currentFontIndex
)
141 self
.fontSize
.set('12')
143 def __SetFontSample(self
,event
):
144 self
.newFont
.config(size
=self
.fontSize
.get(),weight
=NORMAL
,
145 family
=self
.listFontName
.get(self
.listFontName
.curselection()[0]))
147 def CreateWidgets(self
):
148 self
.framePages
= Frame(self
)
149 frameActionButtons
= Frame(self
)
150 framePageButtons
= Frame(self
.framePages
,borderwidth
=1,relief
=SUNKEN
)
152 self
.buttonHelp
= Button(frameActionButtons
,text
='Help',
153 command
=self
.Help
,takefocus
=FALSE
)
154 self
.buttonOk
= Button(frameActionButtons
,text
='Ok',
155 command
=self
.Ok
,takefocus
=FALSE
)
156 self
.buttonApply
= Button(frameActionButtons
,text
='Apply',
157 command
=self
.Apply
,underline
=0,takefocus
=FALSE
)
158 self
.buttonCancel
= Button(frameActionButtons
,text
='Cancel',
159 command
=self
.Cancel
,takefocus
=FALSE
)
161 self
.pageNum
=IntVar()
163 buttonPageFontTab
= Radiobutton(framePageButtons
,value
=0,
164 text
='Font/Tabs',padx
=5,pady
=5)
165 buttonPageHighlight
= Radiobutton(framePageButtons
,value
=1,
166 text
='Highlighting',padx
=5,pady
=5)
167 buttonPageKeys
= Radiobutton(framePageButtons
,value
=2,
168 text
='Keys',padx
=5,pady
=5)
169 buttonPageGeneral
= Radiobutton(framePageButtons
,value
=3,
170 text
='General',padx
=5,pady
=5)
171 self
.pageButtons
=(buttonPageFontTab
,buttonPageHighlight
,
172 buttonPageKeys
,buttonPageGeneral
)
173 for button
in self
.pageButtons
:
174 button
.config(command
=self
.ChangePage
,underline
=0,takefocus
=FALSE
,
175 indicatoron
=FALSE
,highlightthickness
=0,variable
=self
.pageNum
,
176 selectcolor
=self
.bg
,borderwidth
=1)
177 button
.pack(side
=LEFT
)
179 self
.pages
=(self
.CreatePageFontTab(),
180 self
.CreatePageHighlight(),
181 self
.CreatePageKeys(),
182 self
.CreatePageGeneral())
184 #grid in framePages so we can overlap pages
185 framePageButtons
.grid(row
=0,column
=0,sticky
=W
)
186 for page
in self
.pages
: page
.grid(row
=1,column
=0,sticky
=(N
,S
,E
,W
))
188 self
.buttonHelp
.pack(side
=RIGHT
,padx
=5,pady
=5)
189 self
.buttonOk
.pack(side
=LEFT
,padx
=5,pady
=5)
190 self
.buttonApply
.pack(side
=LEFT
,padx
=5,pady
=5)
191 self
.buttonCancel
.pack(side
=LEFT
,padx
=5,pady
=5)
192 frameActionButtons
.pack(side
=BOTTOM
)
193 self
.framePages
.pack(side
=TOP
,expand
=TRUE
,fill
=BOTH
)
195 def CreatePageFontTab(self
):
197 self
.fontSize
=StringVar()
198 self
.spaceNum
=IntVar()
199 self
.tabCols
=IntVar()
200 self
.indentType
=IntVar()
201 self
.newFont
=tkFont
.Font(self
,('courier',12,'normal'))
204 frame
=Frame(self
.framePages
,borderwidth
=2,relief
=SUNKEN
)
206 frameFont
=Frame(frame
,borderwidth
=2,relief
=GROOVE
)
207 frameIndent
=Frame(frame
,borderwidth
=2,relief
=GROOVE
)
209 labelFontTitle
=Label(frameFont
,text
='Set Base Editor Font')
210 frameFontName
=Frame(frameFont
)
211 frameFontSize
=Frame(frameFontName
)
212 labelFontNameTitle
=Label(frameFontName
,justify
=LEFT
,
214 self
.listFontName
=Listbox(frameFontName
,height
=5,takefocus
=FALSE
,
215 exportselection
=FALSE
)
216 self
.listFontName
.bind('<<ListboxSelect>>',self
.__SetFontSample
)
217 scrollFont
=Scrollbar(frameFontName
)
218 self
.__LoadFontList
()
219 scrollFont
.config(command
=self
.listFontName
.yview
)
220 self
.listFontName
.config(yscrollcommand
=scrollFont
.set)
221 labelFontSizeTitle
=Label(frameFontSize
,text
='Size :')
222 sizes
=('10','11','12','13','14','16','18','20','22')
223 args
=(frameFontSize
,self
.fontSize
)+sizes
224 keyArgs
={'command':self
.__SetFontSample
}
225 optFontSize
=apply(OptionMenu
,args
,keyArgs
)
226 #optFontSize.bind('<<MenuSelect>>',self.__SetFontSample)
227 frameFontSample
=Frame(frameFont
,relief
=SOLID
,borderwidth
=1,
228 bg
=self
.workingTestColours
['Foo-Bg'])
229 self
.labelFontSample
=Label(frameFontSample
,bg
=self
.workingTestColours
['Foo-Bg'],
230 fg
='#000000',text
='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]',
231 justify
=LEFT
,font
=self
.newFont
)
233 labelIndentTitle
=Label(frameIndent
,text
='Set Indentation Defaults')
234 frameIndentType
=Frame(frameIndent
)
235 frameIndentSize
=Frame(frameIndent
)
236 labelIndentTypeTitle
=Label(frameIndentType
,
237 text
='Choose indentation type :')
238 radioUseSpaces
=Radiobutton(frameIndentType
,variable
=self
.indentType
,
239 value
=0,text
='Tab key inserts spaces')
240 radioUseTabs
=Radiobutton(frameIndentType
,variable
=self
.indentType
,
241 value
=1,text
='Tab key inserts tabs')
242 labelIndentSizeTitle
=Label(frameIndentSize
,
243 text
='Choose indentation size :')
244 labelSpaceNumTitle
=Label(frameIndentSize
,justify
=LEFT
,
245 text
='when tab key inserts spaces,\nspaces per tab')
246 self
.scaleSpaceNum
=Scale(frameIndentSize
,variable
=self
.spaceNum
,
247 orient
='horizontal',tickinterval
=2,from_
=2,to
=8)
248 labeltabColsTitle
=Label(frameIndentSize
,justify
=LEFT
,
249 text
='when tab key inserts tabs,\ncolumns per tab')
250 self
.scaleTabCols
=Scale(frameIndentSize
,variable
=self
.tabCols
,
251 orient
='horizontal',tickinterval
=2,from_
=2,to
=8)
255 frameFont
.pack(side
=LEFT
,padx
=5,pady
=10,expand
=TRUE
,fill
=BOTH
)
256 frameIndent
.pack(side
=LEFT
,padx
=5,pady
=10,fill
=Y
)
258 labelFontTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
259 frameFontName
.pack(side
=TOP
,padx
=5,pady
=5)
260 frameFontSize
.pack(side
=RIGHT
,anchor
=N
,fill
=X
)
261 labelFontNameTitle
.pack(side
=TOP
,anchor
=W
)
262 self
.listFontName
.pack(side
=LEFT
,fill
=Y
)
263 scrollFont
.pack(side
=LEFT
,fill
=Y
)
264 labelFontSizeTitle
.pack(side
=TOP
,anchor
=W
)
265 optFontSize
.pack(side
=TOP
,anchor
=W
,fill
=X
)
266 frameFontSample
.pack(side
=TOP
,padx
=5,pady
=5,expand
=TRUE
,fill
=BOTH
)
267 self
.labelFontSample
.pack(expand
=TRUE
,fill
=BOTH
)
269 labelIndentTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
270 frameIndentType
.pack(side
=TOP
,padx
=5,fill
=X
)
271 frameIndentSize
.pack(side
=TOP
,padx
=5,pady
=5,fill
=BOTH
)
272 labelIndentTypeTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
273 radioUseSpaces
.pack(side
=TOP
,anchor
=W
,padx
=5)
274 radioUseTabs
.pack(side
=TOP
,anchor
=W
,padx
=5)
275 labelIndentSizeTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
276 labelSpaceNumTitle
.pack(side
=TOP
,anchor
=W
,padx
=5)
277 self
.scaleSpaceNum
.pack(side
=TOP
,padx
=5,fill
=X
)
278 labeltabColsTitle
.pack(side
=TOP
,anchor
=W
,padx
=5)
279 self
.scaleTabCols
.pack(side
=TOP
,padx
=5,fill
=X
)
282 def CreatePageHighlight(self
):
284 self
.highlightTarget
=StringVar()
285 self
.builtinTheme
=StringVar()
286 self
.customTheme
=StringVar()
287 self
.colour
=StringVar()
288 self
.fontName
=StringVar()
289 self
.fontBold
=StringVar()
290 self
.fontItalic
=StringVar()
291 self
.themeType
=IntVar()
294 frame
=Frame(self
.framePages
,borderwidth
=2,relief
=SUNKEN
)
296 frameCustom
=Frame(frame
,borderwidth
=2,relief
=GROOVE
)
297 frameTheme
=Frame(frame
,borderwidth
=2,relief
=GROOVE
)
299 frameTarget
=Frame(frameCustom
)
300 self
.frameHighlightSample
=Frame(frameCustom
,relief
=SOLID
,borderwidth
=1,
301 bg
=self
.workingTestColours
['Foo-Bg'],cursor
='hand2')
302 frameSet
=Frame(frameCustom
)
303 self
.frameColourSet
=Frame(frameSet
,relief
=SOLID
,borderwidth
=1,
304 bg
=self
.workingTestColours
['Foo-Bg'])
305 frameFontSet
=Frame(frameSet
)
306 labelCustomTitle
=Label(frameCustom
,text
='Set Custom Highlighting')
307 labelTargetTitle
=Label(frameTarget
,text
='for : ')
308 optMenuTarget
=OptionMenu(frameTarget
,
309 self
.highlightTarget
,'normal text background','test target interface item 2')
310 self
.highlightTarget
.set('normal text background')
311 buttonSetColour
=Button(self
.frameColourSet
,text
='Set Colour',
312 command
=self
.GetColour
)
313 labelFontTitle
=Label(frameFontSet
,text
='Set Font Style')
314 checkFontBold
=Checkbutton(frameFontSet
,variable
=self
.fontBold
,
315 onvalue
='Bold',offvalue
='',text
='Bold')
316 checkFontItalic
=Checkbutton(frameFontSet
,variable
=self
.fontItalic
,
317 onvalue
='Italic',offvalue
='',text
='Italic')
318 self
.labelTestSample
=Label(self
.frameHighlightSample
,justify
=LEFT
,font
=('courier',12,''),
319 text
='#when finished, this\n#sample area will\n#be interactive\n'+
320 'def Ahem(foo,bar):\n '+
321 '"""'+'doc hazard'+'"""'+
322 '\n test=foo\n text=bar\n return',
323 bg
=self
.workingTestColours
['Foo-Bg'])
324 buttonSaveCustomTheme
=Button(frameCustom
,
325 text
='Save as a Custom Theme')
327 #frameDivider=Frame(frameTheme,relief=SUNKEN,borderwidth=1,
329 labelThemeTitle
=Label(frameTheme
,text
='Select a Highlighting Theme')
330 labelTypeTitle
=Label(frameTheme
,text
='Select : ')
331 radioThemeBuiltin
=Radiobutton(frameTheme
,variable
=self
.themeType
,
332 value
=0,command
=self
.SetThemeType
,text
='a Built-in Theme')
333 radioThemeCustom
=Radiobutton(frameTheme
,variable
=self
.themeType
,
334 value
=1,command
=self
.SetThemeType
,text
='a Custom Theme')
335 self
.optMenuThemeBuiltin
=OptionMenu(frameTheme
,
336 self
.builtinTheme
,'test builtin junk','test builtin junk 2')
337 self
.builtinTheme
.set('test builtin junk')
338 self
.optMenuThemeCustom
=OptionMenu(frameTheme
,
339 self
.customTheme
,'test custom junk','test custom junk 2')
340 self
.customTheme
.set('test custom junk')
341 self
.themeType
.set(0)
342 self
.buttonDeleteCustomTheme
=Button(frameTheme
,text
='Delete Custom Theme')
346 frameCustom
.pack(side
=LEFT
,padx
=5,pady
=10,expand
=TRUE
,fill
=BOTH
)
347 frameTheme
.pack(side
=LEFT
,padx
=5,pady
=10,fill
=Y
)
349 labelCustomTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
350 frameTarget
.pack(side
=TOP
,padx
=5,pady
=5,fill
=X
)
351 self
.frameHighlightSample
.pack(side
=TOP
,padx
=5,pady
=5,expand
=TRUE
,fill
=BOTH
)
352 frameSet
.pack(side
=TOP
,fill
=X
)
353 self
.frameColourSet
.pack(side
=LEFT
,padx
=5,pady
=5,fill
=BOTH
)
354 frameFontSet
.pack(side
=RIGHT
,padx
=5,pady
=5,anchor
=W
)
355 labelTargetTitle
.pack(side
=LEFT
,anchor
=E
)
356 optMenuTarget
.pack(side
=RIGHT
,anchor
=W
,expand
=TRUE
,fill
=X
)
357 buttonSetColour
.pack(expand
=TRUE
,fill
=BOTH
,padx
=10,pady
=10)
358 labelFontTitle
.pack(side
=TOP
,anchor
=W
)
359 checkFontBold
.pack(side
=LEFT
,anchor
=W
,pady
=2)
360 checkFontItalic
.pack(side
=RIGHT
,anchor
=W
)
361 self
.labelTestSample
.pack(anchor
=CENTER
,expand
=TRUE
,fill
=BOTH
)
362 buttonSaveCustomTheme
.pack(side
=BOTTOM
,fill
=X
,padx
=5,pady
=5)
364 #frameDivider.pack(side=LEFT,fill=Y,padx=5,pady=5)
365 labelThemeTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
366 labelTypeTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
367 radioThemeBuiltin
.pack(side
=TOP
,anchor
=W
,padx
=5)
368 radioThemeCustom
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=2)
369 self
.optMenuThemeBuiltin
.pack(side
=TOP
,fill
=X
,padx
=5,pady
=5)
370 self
.optMenuThemeCustom
.pack(side
=TOP
,fill
=X
,anchor
=W
,padx
=5,pady
=5)
371 self
.buttonDeleteCustomTheme
.pack(side
=TOP
,fill
=X
,padx
=5,pady
=5)
374 def CreatePageKeys(self
):
376 self
.bindingTarget
=StringVar()
377 self
.builtinKeys
=StringVar()
378 self
.customKeys
=StringVar()
379 self
.keyChars
=StringVar()
380 self
.keyCtrl
=StringVar()
381 self
.keyAlt
=StringVar()
382 self
.keyShift
=StringVar()
383 self
.keysType
=IntVar()
386 frame
=Frame(self
.framePages
,borderwidth
=2,relief
=SUNKEN
)
388 frameCustom
=Frame(frame
,borderwidth
=2,relief
=GROOVE
)
389 frameKeySets
=Frame(frame
,borderwidth
=2,relief
=GROOVE
)
391 frameTarget
=Frame(frameCustom
)
392 frameSet
=Frame(frameCustom
)
393 labelCustomTitle
=Label(frameCustom
,text
='Set Custom Key Bindings')
394 labelTargetTitle
=Label(frameTarget
,text
='Action')
395 scrollTarget
=Scrollbar(frameTarget
)
396 listTarget
=Listbox(frameTarget
)
397 scrollTarget
.config(command
=listTarget
.yview
)
398 listTarget
.config(yscrollcommand
=scrollTarget
.set)
399 labelKeyBindTitle
=Label(frameSet
,text
='Binding')
400 labelModifierTitle
=Label(frameSet
,text
='Modifier:')
401 checkCtrl
=Checkbutton(frameSet
,text
='Ctrl')
402 checkAlt
=Checkbutton(frameSet
,text
='Alt')
403 checkShift
=Checkbutton(frameSet
,text
='Shift')
404 labelKeyEntryTitle
=Label(frameSet
,text
='Key:')
405 entryKey
=Entry(frameSet
,width
=4)
406 buttonSaveCustomKeys
=Button(frameCustom
,text
='Save as a Custom Key Set')
408 labelKeysTitle
=Label(frameKeySets
,text
='Select a Key Set')
409 labelTypeTitle
=Label(frameKeySets
,text
='Select : ')
410 radioKeysBuiltin
=Radiobutton(frameKeySets
,variable
=self
.keysType
,
411 value
=0,command
=self
.SetKeysType
,text
='a Built-in Key Set')
412 radioKeysCustom
=Radiobutton(frameKeySets
,variable
=self
.keysType
,
413 value
=1,command
=self
.SetKeysType
,text
='a Custom Key Set')
414 self
.optMenuKeysBuiltin
=OptionMenu(frameKeySets
,
415 self
.builtinKeys
,'test builtin junk','test builtin junk 2')
416 self
.builtinKeys
.set('test builtin junk')
417 self
.optMenuKeysCustom
=OptionMenu(frameKeySets
,
418 self
.customKeys
,'test custom junk','test custom junk 2')
419 self
.customKeys
.set('test custom junk')
421 self
.buttonDeleteCustomKeys
=Button(frameKeySets
,text
='Delete Custom Key Set')
425 frameCustom
.pack(side
=LEFT
,padx
=5,pady
=5,expand
=TRUE
,fill
=BOTH
)
426 frameKeySets
.pack(side
=LEFT
,padx
=5,pady
=5,fill
=Y
)
428 labelCustomTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
429 buttonSaveCustomKeys
.pack(side
=BOTTOM
,fill
=X
,padx
=5,pady
=5)
430 frameTarget
.pack(side
=LEFT
,padx
=5,pady
=5,fill
=Y
)
431 frameSet
.pack(side
=LEFT
,padx
=5,pady
=5,fill
=Y
)
432 labelTargetTitle
.pack(side
=TOP
,anchor
=W
)
433 scrollTarget
.pack(side
=RIGHT
,anchor
=W
,fill
=Y
)
434 listTarget
.pack(side
=TOP
,anchor
=W
,expand
=TRUE
,fill
=BOTH
)
435 labelKeyBindTitle
.pack(side
=TOP
,anchor
=W
)
436 labelModifierTitle
.pack(side
=TOP
,anchor
=W
,pady
=5)
437 checkCtrl
.pack(side
=TOP
,anchor
=W
)
438 checkAlt
.pack(side
=TOP
,anchor
=W
,pady
=2)
439 checkShift
.pack(side
=TOP
,anchor
=W
)
440 labelKeyEntryTitle
.pack(side
=TOP
,anchor
=W
,pady
=5)
441 entryKey
.pack(side
=TOP
,anchor
=W
)
443 labelKeysTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
444 labelTypeTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
445 radioKeysBuiltin
.pack(side
=TOP
,anchor
=W
,padx
=5)
446 radioKeysCustom
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=2)
447 self
.optMenuKeysBuiltin
.pack(side
=TOP
,fill
=X
,padx
=5,pady
=5)
448 self
.optMenuKeysCustom
.pack(side
=TOP
,fill
=X
,anchor
=W
,padx
=5,pady
=5)
449 self
.buttonDeleteCustomKeys
.pack(side
=TOP
,fill
=X
,padx
=5,pady
=5)
452 def CreatePageGeneral(self
):
454 self
.runType
=IntVar()
455 self
.winWidth
=StringVar()
456 self
.winHeight
=StringVar()
457 self
.extState
=IntVar()
460 frame
=Frame(self
.framePages
,borderwidth
=2,relief
=SUNKEN
)
462 frameRun
=Frame(frame
,borderwidth
=2,relief
=GROOVE
)
463 frameWinSize
=Frame(frame
,borderwidth
=2,relief
=GROOVE
)
464 frameExt
=Frame(frame
,borderwidth
=2,relief
=GROOVE
)
466 labelRunTitle
=Label(frameRun
,text
='Run Preferences')
467 labelRunChoiceTitle
=Label(frameRun
,text
='Run code : ')
468 radioRunInternal
=Radiobutton(frameRun
,variable
=self
.runType
,
469 value
=0,command
=self
.SetKeysType
,text
="in IDLE's Process")
470 radioRunSeparate
=Radiobutton(frameRun
,variable
=self
.runType
,
471 value
=1,command
=self
.SetKeysType
,text
='in a Separate Process')
473 labelWinSizeTitle
=Label(frameWinSize
,text
='Initial Window Size')
474 buttonWinSizeSet
=Button(frameWinSize
,text
='Set to current window size')
475 labelWinWidthTitle
=Label(frameWinSize
,text
='Width')
476 entryWinWidth
=Entry(frameWinSize
,textvariable
=self
.winWidth
,
478 labelWinHeightTitle
=Label(frameWinSize
,text
='Height')
479 entryWinHeight
=Entry(frameWinSize
,textvariable
=self
.winHeight
,
482 frameExtList
=Frame(frameExt
)
483 frameExtSet
=Frame(frameExt
)
484 labelExtTitle
=Label(frameExt
,text
='Configure IDLE Extensions')
485 labelExtListTitle
=Label(frameExtList
,text
='Extension')
486 scrollExtList
=Scrollbar(frameExtList
)
487 listExt
=Listbox(frameExtList
,height
=5)
488 scrollExtList
.config(command
=listExt
.yview
)
489 listExt
.config(yscrollcommand
=scrollExtList
.set)
490 labelExtSetTitle
=Label(frameExtSet
,text
='Settings')
491 radioEnableExt
=Radiobutton(frameExtSet
,variable
=self
.extState
,
492 value
=1,text
="enable")
493 radioDisableExt
=Radiobutton(frameExtSet
,variable
=self
.extState
,
494 value
=0,text
="disable")
496 buttonExtConfig
=Button(frameExtSet
,text
='Configure')
500 frameRun
.pack(side
=TOP
,padx
=5,pady
=5,fill
=X
)
501 frameWinSize
.pack(side
=TOP
,padx
=5,pady
=5,fill
=X
)
502 frameExt
.pack(side
=TOP
,padx
=5,pady
=5,expand
=TRUE
,fill
=BOTH
)
504 labelRunTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
505 labelRunChoiceTitle
.pack(side
=LEFT
,anchor
=W
,padx
=5,pady
=5)
506 radioRunInternal
.pack(side
=LEFT
,anchor
=W
,padx
=5,pady
=5)
507 radioRunSeparate
.pack(side
=LEFT
,anchor
=W
,padx
=5,pady
=5)
509 labelWinSizeTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
510 buttonWinSizeSet
.pack(side
=LEFT
,anchor
=W
,padx
=5,pady
=5)
511 labelWinWidthTitle
.pack(side
=LEFT
,anchor
=W
,padx
=5,pady
=5)
512 entryWinWidth
.pack(side
=LEFT
,anchor
=W
,padx
=5,pady
=5)
513 labelWinHeightTitle
.pack(side
=LEFT
,anchor
=W
,padx
=5,pady
=5)
514 entryWinHeight
.pack(side
=LEFT
,anchor
=W
,padx
=5,pady
=5)
516 labelExtTitle
.pack(side
=TOP
,anchor
=W
,padx
=5,pady
=5)
517 frameExtSet
.pack(side
=RIGHT
,padx
=5,pady
=5,fill
=Y
)
518 frameExtList
.pack(side
=RIGHT
,padx
=5,pady
=5,expand
=TRUE
,fill
=BOTH
)
519 labelExtListTitle
.pack(side
=TOP
,anchor
=W
)
520 scrollExtList
.pack(side
=RIGHT
,anchor
=W
,fill
=Y
)
521 listExt
.pack(side
=LEFT
,anchor
=E
,expand
=TRUE
,fill
=BOTH
)
522 labelExtSetTitle
.pack(side
=TOP
,anchor
=W
)
523 radioEnableExt
.pack(side
=TOP
,anchor
=W
)
524 radioDisableExt
.pack(side
=TOP
,anchor
=W
)
525 buttonExtConfig
.pack(side
=TOP
,anchor
=W
,pady
=5)
529 if __name__
== '__main__':
532 Button(root
,text
='Dialog',
533 command
=lambda:ConfigDialog(root
,'Settings',None)).pack()