2001-07-31 03:59:02 -03:00
|
|
|
"""
|
|
|
|
configuration dialog
|
|
|
|
"""
|
|
|
|
from Tkinter import *
|
2001-08-11 12:48:13 -03:00
|
|
|
import tkMessageBox, tkColorChooser, tkFont
|
2002-01-18 20:29:54 -04:00
|
|
|
import string
|
2001-07-31 03:59:02 -03:00
|
|
|
|
2001-09-24 06:43:17 -03:00
|
|
|
from configHandler import idleConf
|
2001-10-26 03:47:09 -03:00
|
|
|
from dynOptionMenuWidget import DynOptionMenu
|
2001-12-05 03:54:07 -04:00
|
|
|
from tabpage import TabPageSet
|
2002-01-18 20:29:54 -04:00
|
|
|
from keybindingDialog import GetKeysDialog
|
2001-08-04 10:58:22 -03:00
|
|
|
|
2001-07-31 03:59:02 -03:00
|
|
|
class ConfigDialog(Toplevel):
|
|
|
|
"""
|
2001-07-31 07:46:53 -03:00
|
|
|
configuration dialog for idle
|
|
|
|
"""
|
2001-11-21 01:56:26 -04:00
|
|
|
def __init__(self,parent,title):
|
2001-07-31 07:46:53 -03:00
|
|
|
Toplevel.__init__(self, parent)
|
|
|
|
self.configure(borderwidth=5)
|
|
|
|
self.geometry("+%d+%d" % (parent.winfo_rootx()+20,
|
|
|
|
parent.winfo_rooty()+30))
|
2001-11-03 10:54:25 -04:00
|
|
|
#Theme Elements. Each theme element key is it's display name.
|
|
|
|
#The first value of the tuple is the sample area tag name.
|
|
|
|
#The second value is the display name list sort index.
|
|
|
|
#The third value indicates whether the element can have a foreground
|
|
|
|
#or background colour or both.
|
2002-01-03 08:05:17 -04:00
|
|
|
self.themeElements={'Normal Text':('normal','00'),
|
|
|
|
'Python Keywords':('keyword','01'),
|
|
|
|
'Python Definitions':('definition','02'),
|
|
|
|
'Python Comments':('comment','03'),
|
|
|
|
'Python Strings':('string','04'),
|
|
|
|
'Selected Text':('hilite','05'),
|
|
|
|
'Found Text':('hit','06'),
|
|
|
|
'Cursor':('cursor','07'),
|
|
|
|
'Error Text':('error','08'),
|
|
|
|
'Shell Normal Text':('console','09'),
|
|
|
|
'Shell Stdout Text':('stdout','10'),
|
|
|
|
'Shell Stderr Text':('stderr','11')}
|
2001-07-31 07:46:53 -03:00
|
|
|
self.CreateWidgets()
|
|
|
|
self.resizable(height=FALSE,width=FALSE)
|
|
|
|
self.transient(parent)
|
|
|
|
self.grab_set()
|
|
|
|
self.protocol("WM_DELETE_WINDOW", self.Cancel)
|
|
|
|
self.parent = parent
|
2001-12-05 03:54:07 -04:00
|
|
|
self.tabPages.focus_set()
|
2001-07-31 07:46:53 -03:00
|
|
|
#key bindings for this dialog
|
|
|
|
self.bind('<Escape>',self.CancelBinding) #dismiss dialog, no save
|
2001-08-11 12:48:13 -03:00
|
|
|
self.bind('<Alt-a>',self.ApplyBinding) #apply changes, save
|
2001-08-03 01:43:44 -03:00
|
|
|
self.bind('<F1>',self.HelpBinding) #context help
|
2001-10-23 07:42:12 -03:00
|
|
|
self.LoadConfigs()
|
2001-07-31 07:46:53 -03:00
|
|
|
self.wait_window()
|
|
|
|
|
|
|
|
def Cancel(self):
|
|
|
|
self.destroy()
|
2001-07-31 03:59:02 -03:00
|
|
|
|
2001-08-11 12:48:13 -03:00
|
|
|
def Ok(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def Apply(self):
|
2001-07-31 07:46:53 -03:00
|
|
|
pass
|
2001-07-31 03:59:02 -03:00
|
|
|
|
2001-08-03 01:43:44 -03:00
|
|
|
def Help(self):
|
2001-07-31 07:46:53 -03:00
|
|
|
pass
|
2001-07-31 03:59:02 -03:00
|
|
|
|
2001-07-31 07:46:53 -03:00
|
|
|
def CancelBinding(self,event):
|
|
|
|
self.Cancel()
|
|
|
|
|
2001-08-11 12:48:13 -03:00
|
|
|
def OkBinding(self,event):
|
|
|
|
self.Ok()
|
|
|
|
|
|
|
|
def ApplyBinding(self,event):
|
|
|
|
self.Apply()
|
2001-07-31 03:59:02 -03:00
|
|
|
|
2001-08-03 01:43:44 -03:00
|
|
|
def HelpBinding(self,event):
|
|
|
|
self.Help()
|
2001-07-31 03:59:02 -03:00
|
|
|
|
2001-08-03 01:43:44 -03:00
|
|
|
def SetThemeType(self):
|
2001-11-04 07:53:10 -04:00
|
|
|
if self.themeIsBuiltin.get():
|
2001-08-03 01:43:44 -03:00
|
|
|
self.optMenuThemeBuiltin.config(state=NORMAL)
|
|
|
|
self.optMenuThemeCustom.config(state=DISABLED)
|
2001-08-04 10:58:22 -03:00
|
|
|
self.buttonDeleteCustomTheme.config(state=DISABLED)
|
2001-11-03 10:54:25 -04:00
|
|
|
else:
|
2001-08-03 01:43:44 -03:00
|
|
|
self.optMenuThemeBuiltin.config(state=DISABLED)
|
|
|
|
self.optMenuThemeCustom.config(state=NORMAL)
|
2001-08-04 10:58:22 -03:00
|
|
|
self.buttonDeleteCustomTheme.config(state=NORMAL)
|
|
|
|
|
|
|
|
def SetKeysType(self):
|
2001-11-04 07:53:10 -04:00
|
|
|
if self.keysAreDefault.get():
|
2001-08-04 10:58:22 -03:00
|
|
|
self.optMenuKeysBuiltin.config(state=NORMAL)
|
|
|
|
self.optMenuKeysCustom.config(state=DISABLED)
|
|
|
|
self.buttonDeleteCustomKeys.config(state=DISABLED)
|
2001-11-04 07:53:10 -04:00
|
|
|
else:
|
2001-08-04 10:58:22 -03:00
|
|
|
self.optMenuKeysBuiltin.config(state=DISABLED)
|
|
|
|
self.optMenuKeysCustom.config(state=NORMAL)
|
|
|
|
self.buttonDeleteCustomKeys.config(state=NORMAL)
|
2001-08-03 01:43:44 -03:00
|
|
|
|
2001-08-07 22:30:38 -03:00
|
|
|
def GetColour(self):
|
2001-11-03 10:54:25 -04:00
|
|
|
target=self.highlightTarget.get()
|
2001-08-07 22:30:38 -03:00
|
|
|
rgbTuplet, colourString = tkColorChooser.askcolor(parent=self,
|
2001-11-03 10:54:25 -04:00
|
|
|
title='Pick new colour for : '+target,
|
|
|
|
initialcolor=self.frameColourSet.cget('bg'))
|
2001-08-07 22:30:38 -03:00
|
|
|
if colourString: #user didn't cancel
|
2001-11-03 10:54:25 -04:00
|
|
|
self.frameColourSet.config(bg=colourString)#set sample
|
|
|
|
if self.fgHilite.get(): plane='foreground'
|
|
|
|
else: plane='background'
|
|
|
|
apply(self.textHighlightSample.tag_config,
|
|
|
|
(self.themeElements[target][0],),{plane:colourString})
|
|
|
|
|
2001-10-23 07:42:12 -03:00
|
|
|
def SetFontSampleBinding(self,event):
|
|
|
|
self.SetFontSample()
|
|
|
|
|
|
|
|
def SetFontSample(self):
|
|
|
|
self.editFont.config(size=self.fontSize.get(),weight=NORMAL,
|
2001-08-11 12:48:13 -03:00
|
|
|
family=self.listFontName.get(self.listFontName.curselection()[0]))
|
2001-10-29 04:05:34 -04:00
|
|
|
|
2001-11-03 01:07:28 -04:00
|
|
|
def SetHighlightTargetBinding(self,*args):
|
2001-10-29 07:19:46 -04:00
|
|
|
self.SetHighlightTarget()
|
2001-10-29 04:05:34 -04:00
|
|
|
|
2001-10-29 07:19:46 -04:00
|
|
|
def SetHighlightTarget(self):
|
2002-01-03 08:05:17 -04:00
|
|
|
if self.highlightTarget.get()=='Cursor': #bg not possible
|
2001-10-29 07:19:46 -04:00
|
|
|
self.radioFg.config(state=DISABLED)
|
|
|
|
self.radioBg.config(state=DISABLED)
|
2002-01-03 08:05:17 -04:00
|
|
|
self.fgHilite.set(1)
|
|
|
|
else: #both fg and bg can be set
|
2002-01-04 03:53:06 -04:00
|
|
|
self.radioFg.config(state=NORMAL)
|
|
|
|
self.radioBg.config(state=NORMAL)
|
2001-10-29 07:19:46 -04:00
|
|
|
self.fgHilite.set(1)
|
2001-11-21 01:56:26 -04:00
|
|
|
self.SetColourSample()
|
|
|
|
|
|
|
|
def SetColourSampleBinding(self,*args):
|
|
|
|
self.SetColourSample()
|
|
|
|
|
|
|
|
def SetColourSample(self):
|
|
|
|
#set the colour smaple area
|
|
|
|
tag=self.themeElements[self.highlightTarget.get()][0]
|
|
|
|
if self.fgHilite.get(): plane='foreground'
|
|
|
|
else: plane='background'
|
|
|
|
colour=self.textHighlightSample.tag_cget(tag,plane)
|
|
|
|
self.frameColourSet.config(bg=colour)
|
2001-08-11 12:48:13 -03:00
|
|
|
|
2001-07-31 07:46:53 -03:00
|
|
|
def CreateWidgets(self):
|
2001-12-05 03:54:07 -04:00
|
|
|
self.tabPages = TabPageSet(self,
|
|
|
|
pageNames=['Fonts/Tabs','Highlighting','Keys','General'])
|
2002-01-03 08:05:17 -04:00
|
|
|
self.tabPages.ChangePage()#activates default (first) page
|
2001-07-31 07:46:53 -03:00
|
|
|
frameActionButtons = Frame(self)
|
|
|
|
#action buttons
|
2001-08-03 01:43:44 -03:00
|
|
|
self.buttonHelp = Button(frameActionButtons,text='Help',
|
|
|
|
command=self.Help,takefocus=FALSE)
|
2001-08-11 12:48:13 -03:00
|
|
|
self.buttonOk = Button(frameActionButtons,text='Ok',
|
|
|
|
command=self.Ok,takefocus=FALSE)
|
|
|
|
self.buttonApply = Button(frameActionButtons,text='Apply',
|
|
|
|
command=self.Apply,underline=0,takefocus=FALSE)
|
2001-07-31 07:46:53 -03:00
|
|
|
self.buttonCancel = Button(frameActionButtons,text='Cancel',
|
|
|
|
command=self.Cancel,takefocus=FALSE)
|
2001-12-05 03:54:07 -04:00
|
|
|
self.CreatePageFontTab()
|
|
|
|
self.CreatePageHighlight()
|
|
|
|
self.CreatePageKeys()
|
|
|
|
self.CreatePageGeneral()
|
2001-08-11 12:48:13 -03:00
|
|
|
self.buttonHelp.pack(side=RIGHT,padx=5,pady=5)
|
|
|
|
self.buttonOk.pack(side=LEFT,padx=5,pady=5)
|
|
|
|
self.buttonApply.pack(side=LEFT,padx=5,pady=5)
|
2001-07-31 07:46:53 -03:00
|
|
|
self.buttonCancel.pack(side=LEFT,padx=5,pady=5)
|
|
|
|
frameActionButtons.pack(side=BOTTOM)
|
2001-12-05 03:54:07 -04:00
|
|
|
self.tabPages.pack(side=TOP,expand=TRUE,fill=BOTH)
|
|
|
|
|
2001-07-31 07:46:53 -03:00
|
|
|
|
2001-08-04 10:58:22 -03:00
|
|
|
def CreatePageFontTab(self):
|
2001-08-05 05:00:28 -03:00
|
|
|
#tkVars
|
2001-11-21 01:56:26 -04:00
|
|
|
self.fontSize=StringVar(self)
|
|
|
|
self.fontBold=StringVar(self)
|
|
|
|
self.spaceNum=IntVar(self)
|
|
|
|
self.tabCols=IntVar(self)
|
|
|
|
self.indentType=IntVar(self)
|
2001-10-23 07:42:12 -03:00
|
|
|
self.editFont=tkFont.Font(self,('courier',12,'normal'))
|
2001-08-05 05:00:28 -03:00
|
|
|
##widget creation
|
|
|
|
#body frame
|
2001-12-05 03:54:07 -04:00
|
|
|
frame=self.tabPages.pages['Fonts/Tabs']['page']
|
2001-08-05 05:00:28 -03:00
|
|
|
#body section frames
|
|
|
|
frameFont=Frame(frame,borderwidth=2,relief=GROOVE)
|
|
|
|
frameIndent=Frame(frame,borderwidth=2,relief=GROOVE)
|
|
|
|
#frameFont
|
|
|
|
labelFontTitle=Label(frameFont,text='Set Base Editor Font')
|
|
|
|
frameFontName=Frame(frameFont)
|
2001-11-03 01:07:28 -04:00
|
|
|
frameFontParam=Frame(frameFont)
|
2001-08-05 05:00:28 -03:00
|
|
|
labelFontNameTitle=Label(frameFontName,justify=LEFT,
|
2001-08-11 12:48:13 -03:00
|
|
|
text='Font :')
|
|
|
|
self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE,
|
|
|
|
exportselection=FALSE)
|
2001-10-23 07:42:12 -03:00
|
|
|
self.listFontName.bind('<<ListboxSelect>>',self.SetFontSampleBinding)
|
2001-08-11 12:48:13 -03:00
|
|
|
scrollFont=Scrollbar(frameFontName)
|
|
|
|
scrollFont.config(command=self.listFontName.yview)
|
|
|
|
self.listFontName.config(yscrollcommand=scrollFont.set)
|
2001-11-03 01:07:28 -04:00
|
|
|
labelFontSizeTitle=Label(frameFontParam,text='Size :')
|
|
|
|
self.optMenuFontSize=DynOptionMenu(frameFontParam,self.fontSize,None,
|
2001-10-26 03:47:09 -03:00
|
|
|
command=self.SetFontSampleBinding)
|
2001-11-03 01:07:28 -04:00
|
|
|
checkFontBold=Checkbutton(frameFontParam,variable=self.fontBold,
|
|
|
|
onvalue='Bold',offvalue='',text='Bold')
|
2001-09-24 06:43:17 -03:00
|
|
|
frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1)
|
|
|
|
self.labelFontSample=Label(frameFontSample,
|
|
|
|
text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]',
|
2001-10-23 07:42:12 -03:00
|
|
|
justify=LEFT,font=self.editFont)
|
2001-08-05 05:00:28 -03:00
|
|
|
#frameIndent
|
|
|
|
labelIndentTitle=Label(frameIndent,text='Set Indentation Defaults')
|
|
|
|
frameIndentType=Frame(frameIndent)
|
|
|
|
frameIndentSize=Frame(frameIndent)
|
|
|
|
labelIndentTypeTitle=Label(frameIndentType,
|
|
|
|
text='Choose indentation type :')
|
|
|
|
radioUseSpaces=Radiobutton(frameIndentType,variable=self.indentType,
|
2001-10-23 07:42:12 -03:00
|
|
|
value=1,text='Tab key inserts spaces')
|
2001-08-05 05:00:28 -03:00
|
|
|
radioUseTabs=Radiobutton(frameIndentType,variable=self.indentType,
|
2001-10-23 07:42:12 -03:00
|
|
|
value=0,text='Tab key inserts tabs')
|
2001-08-05 05:00:28 -03:00
|
|
|
labelIndentSizeTitle=Label(frameIndentSize,
|
|
|
|
text='Choose indentation size :')
|
|
|
|
labelSpaceNumTitle=Label(frameIndentSize,justify=LEFT,
|
|
|
|
text='when tab key inserts spaces,\nspaces per tab')
|
|
|
|
self.scaleSpaceNum=Scale(frameIndentSize,variable=self.spaceNum,
|
|
|
|
orient='horizontal',tickinterval=2,from_=2,to=8)
|
|
|
|
labeltabColsTitle=Label(frameIndentSize,justify=LEFT,
|
|
|
|
text='when tab key inserts tabs,\ncolumns per tab')
|
|
|
|
self.scaleTabCols=Scale(frameIndentSize,variable=self.tabCols,
|
|
|
|
orient='horizontal',tickinterval=2,from_=2,to=8)
|
|
|
|
#widget packing
|
|
|
|
#body
|
2001-08-11 12:48:13 -03:00
|
|
|
frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH)
|
|
|
|
frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y)
|
2001-08-05 05:00:28 -03:00
|
|
|
#frameFont
|
|
|
|
labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
2001-11-03 01:07:28 -04:00
|
|
|
frameFontName.pack(side=TOP,padx=5,pady=5,fill=X)
|
|
|
|
frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X)
|
2001-08-05 05:00:28 -03:00
|
|
|
labelFontNameTitle.pack(side=TOP,anchor=W)
|
2001-11-03 01:07:28 -04:00
|
|
|
self.listFontName.pack(side=LEFT,expand=TRUE,fill=X)
|
2001-08-11 12:48:13 -03:00
|
|
|
scrollFont.pack(side=LEFT,fill=Y)
|
2001-11-03 01:07:28 -04:00
|
|
|
labelFontSizeTitle.pack(side=LEFT,anchor=W)
|
|
|
|
self.optMenuFontSize.pack(side=LEFT,anchor=W)
|
|
|
|
checkFontBold.pack(side=LEFT,anchor=W,padx=20)
|
2001-08-05 05:00:28 -03:00
|
|
|
frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
|
2001-08-11 12:48:13 -03:00
|
|
|
self.labelFontSample.pack(expand=TRUE,fill=BOTH)
|
2001-08-05 05:00:28 -03:00
|
|
|
#frameIndent
|
|
|
|
labelIndentTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
|
|
|
frameIndentType.pack(side=TOP,padx=5,fill=X)
|
|
|
|
frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH)
|
|
|
|
labelIndentTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
|
|
|
radioUseSpaces.pack(side=TOP,anchor=W,padx=5)
|
|
|
|
radioUseTabs.pack(side=TOP,anchor=W,padx=5)
|
|
|
|
labelIndentSizeTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
|
|
|
labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5)
|
|
|
|
self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X)
|
|
|
|
labeltabColsTitle.pack(side=TOP,anchor=W,padx=5)
|
|
|
|
self.scaleTabCols.pack(side=TOP,padx=5,fill=X)
|
2001-08-03 01:43:44 -03:00
|
|
|
return frame
|
|
|
|
|
|
|
|
def CreatePageHighlight(self):
|
2001-11-21 01:56:26 -04:00
|
|
|
self.builtinTheme=StringVar(self)
|
|
|
|
self.customTheme=StringVar(self)
|
|
|
|
self.fgHilite=IntVar(self)
|
|
|
|
self.colour=StringVar(self)
|
|
|
|
self.fontName=StringVar(self)
|
|
|
|
self.themeIsBuiltin=IntVar(self)
|
|
|
|
self.highlightTarget=StringVar(self)
|
2001-11-03 01:07:28 -04:00
|
|
|
self.highlightTarget.trace_variable('w',self.SetHighlightTargetBinding)
|
2001-08-03 01:43:44 -03:00
|
|
|
##widget creation
|
|
|
|
#body frame
|
2001-12-05 03:54:07 -04:00
|
|
|
frame=self.tabPages.pages['Highlighting']['page']
|
2001-08-03 01:43:44 -03:00
|
|
|
#body section frames
|
|
|
|
frameCustom=Frame(frame,borderwidth=2,relief=GROOVE)
|
|
|
|
frameTheme=Frame(frame,borderwidth=2,relief=GROOVE)
|
|
|
|
#frameCustom
|
2001-11-03 01:07:28 -04:00
|
|
|
self.textHighlightSample=Text(frameCustom,relief=SOLID,borderwidth=1,
|
|
|
|
font=('courier',12,''),cursor='hand2',width=10,height=10,
|
|
|
|
takefocus=FALSE,highlightthickness=0)
|
|
|
|
text=self.textHighlightSample
|
|
|
|
text.bind('<Double-Button-1>',lambda e: 'break')
|
|
|
|
text.bind('<B1-Motion>',lambda e: 'break')
|
2001-11-03 10:54:25 -04:00
|
|
|
textAndTags=(('#you can click in here','comment'),('\n','normal'),
|
|
|
|
('#to choose items','comment'),('\n','normal'),('def','keyword'),
|
|
|
|
(' ','normal'),('func','definition'),('(param):','normal'),
|
|
|
|
('\n ','normal'),('"""string"""','string'),('\n var0 = ','normal'),
|
2001-11-04 07:53:10 -04:00
|
|
|
("'string'",'string'),('\n var1 = ','normal'),("'selected'",'hilite'),
|
|
|
|
('\n var2 = ','normal'),("'found'",'hit'),('\n\n','normal'),
|
2001-11-04 03:03:08 -04:00
|
|
|
(' error ','error'),(' ','normal'),('cursor |','cursor'),
|
2001-11-04 07:53:10 -04:00
|
|
|
('\n ','normal'),('shell','console'),(' ','normal'),('stdout','stdout'),
|
|
|
|
(' ','normal'),('stderr','stderr'),('\n','normal'))
|
2001-11-03 10:54:25 -04:00
|
|
|
for txTa in textAndTags:
|
|
|
|
text.insert(END,txTa[0],txTa[1])
|
|
|
|
for element in self.themeElements.keys():
|
|
|
|
text.tag_bind(self.themeElements[element][0],'<ButtonPress-1>',
|
|
|
|
lambda event,elem=element: event.widget.winfo_toplevel()
|
|
|
|
.highlightTarget.set(elem))
|
2001-11-03 01:07:28 -04:00
|
|
|
text.config(state=DISABLED)
|
|
|
|
self.frameColourSet=Frame(frameCustom,relief=SOLID,borderwidth=1)
|
2001-10-29 07:19:46 -04:00
|
|
|
frameFgBg=Frame(frameCustom)
|
2001-08-03 01:43:44 -03:00
|
|
|
labelCustomTitle=Label(frameCustom,text='Set Custom Highlighting')
|
2001-11-03 01:07:28 -04:00
|
|
|
buttonSetColour=Button(self.frameColourSet,text='Choose Colour for :',
|
2001-11-03 10:54:25 -04:00
|
|
|
command=self.GetColour,highlightthickness=0)
|
2001-11-03 01:07:28 -04:00
|
|
|
self.optMenuHighlightTarget=DynOptionMenu(self.frameColourSet,
|
2001-11-03 10:54:25 -04:00
|
|
|
self.highlightTarget,None,highlightthickness=0)#,command=self.SetHighlightTargetBinding
|
2001-10-29 07:19:46 -04:00
|
|
|
self.radioFg=Radiobutton(frameFgBg,variable=self.fgHilite,
|
2001-11-21 01:56:26 -04:00
|
|
|
value=1,text='Foreground',command=self.SetColourSampleBinding)
|
2001-10-29 07:19:46 -04:00
|
|
|
self.radioBg=Radiobutton(frameFgBg,variable=self.fgHilite,
|
2001-11-21 01:56:26 -04:00
|
|
|
value=0,text='Background',command=self.SetColourSampleBinding)
|
2001-10-29 07:19:46 -04:00
|
|
|
self.fgHilite.set(1)
|
2001-08-04 10:58:22 -03:00
|
|
|
buttonSaveCustomTheme=Button(frameCustom,
|
2001-08-03 01:43:44 -03:00
|
|
|
text='Save as a Custom Theme')
|
|
|
|
#frameTheme
|
|
|
|
labelThemeTitle=Label(frameTheme,text='Select a Highlighting Theme')
|
|
|
|
labelTypeTitle=Label(frameTheme,text='Select : ')
|
2001-11-04 07:53:10 -04:00
|
|
|
self.radioThemeBuiltin=Radiobutton(frameTheme,variable=self.themeIsBuiltin,
|
|
|
|
value=1,command=self.SetThemeType,text='a Built-in Theme')
|
|
|
|
self.radioThemeCustom=Radiobutton(frameTheme,variable=self.themeIsBuiltin,
|
|
|
|
value=0,command=self.SetThemeType,text='a Custom Theme')
|
2001-10-29 04:05:34 -04:00
|
|
|
self.optMenuThemeBuiltin=DynOptionMenu(frameTheme,
|
2001-10-29 07:19:46 -04:00
|
|
|
self.builtinTheme,None,command=None)
|
2001-10-29 04:05:34 -04:00
|
|
|
self.optMenuThemeCustom=DynOptionMenu(frameTheme,
|
2001-10-29 07:19:46 -04:00
|
|
|
self.customTheme,None,command=None)
|
2001-08-04 10:58:22 -03:00
|
|
|
self.buttonDeleteCustomTheme=Button(frameTheme,text='Delete Custom Theme')
|
2001-08-03 01:43:44 -03:00
|
|
|
##widget packing
|
|
|
|
#body
|
2001-08-04 10:58:22 -03:00
|
|
|
frameCustom.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH)
|
|
|
|
frameTheme.pack(side=LEFT,padx=5,pady=10,fill=Y)
|
2001-08-03 01:43:44 -03:00
|
|
|
#frameCustom
|
|
|
|
labelCustomTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
2001-11-03 01:07:28 -04:00
|
|
|
self.frameColourSet.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=X)
|
2001-10-29 07:19:46 -04:00
|
|
|
frameFgBg.pack(side=TOP,padx=5,pady=0)
|
2001-11-03 01:07:28 -04:00
|
|
|
self.textHighlightSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,
|
|
|
|
fill=BOTH)
|
2001-11-03 10:54:25 -04:00
|
|
|
buttonSetColour.pack(side=TOP,expand=TRUE,fill=X,padx=8,pady=4)
|
|
|
|
self.optMenuHighlightTarget.pack(side=TOP,expand=TRUE,fill=X,padx=8,pady=3)
|
2001-10-29 07:19:46 -04:00
|
|
|
self.radioFg.pack(side=LEFT,anchor=E)
|
|
|
|
self.radioBg.pack(side=RIGHT,anchor=W)
|
2001-08-04 10:58:22 -03:00
|
|
|
buttonSaveCustomTheme.pack(side=BOTTOM,fill=X,padx=5,pady=5)
|
2001-08-03 01:43:44 -03:00
|
|
|
#frameTheme
|
|
|
|
labelThemeTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
|
|
|
labelTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
2001-10-29 04:05:34 -04:00
|
|
|
self.radioThemeBuiltin.pack(side=TOP,anchor=W,padx=5)
|
|
|
|
self.radioThemeCustom.pack(side=TOP,anchor=W,padx=5,pady=2)
|
2001-08-03 01:43:44 -03:00
|
|
|
self.optMenuThemeBuiltin.pack(side=TOP,fill=X,padx=5,pady=5)
|
|
|
|
self.optMenuThemeCustom.pack(side=TOP,fill=X,anchor=W,padx=5,pady=5)
|
2001-08-04 10:58:22 -03:00
|
|
|
self.buttonDeleteCustomTheme.pack(side=TOP,fill=X,padx=5,pady=5)
|
2001-08-03 01:43:44 -03:00
|
|
|
return frame
|
|
|
|
|
|
|
|
def CreatePageKeys(self):
|
2001-08-04 10:58:22 -03:00
|
|
|
#tkVars
|
2001-11-21 01:56:26 -04:00
|
|
|
self.bindingTarget=StringVar(self)
|
|
|
|
self.builtinKeys=StringVar(self)
|
|
|
|
self.customKeys=StringVar(self)
|
|
|
|
self.keyChars=StringVar(self)
|
|
|
|
self.keyCtrl=StringVar(self)
|
|
|
|
self.keyAlt=StringVar(self)
|
|
|
|
self.keyShift=StringVar(self)
|
|
|
|
self.keysAreDefault=IntVar(self)
|
2001-08-04 10:58:22 -03:00
|
|
|
##widget creation
|
|
|
|
#body frame
|
2001-12-05 03:54:07 -04:00
|
|
|
frame=self.tabPages.pages['Keys']['page']
|
2001-08-04 10:58:22 -03:00
|
|
|
#body section frames
|
|
|
|
frameCustom=Frame(frame,borderwidth=2,relief=GROOVE)
|
|
|
|
frameKeySets=Frame(frame,borderwidth=2,relief=GROOVE)
|
|
|
|
#frameCustom
|
|
|
|
frameTarget=Frame(frameCustom)
|
|
|
|
labelCustomTitle=Label(frameCustom,text='Set Custom Key Bindings')
|
2002-01-18 20:29:54 -04:00
|
|
|
labelTargetTitle=Label(frameTarget,text='Action - Key(s)')
|
|
|
|
scrollTargetY=Scrollbar(frameTarget)
|
|
|
|
scrollTargetX=Scrollbar(frameTarget,orient=HORIZONTAL)
|
|
|
|
self.listBindings=Listbox(frameTarget)
|
|
|
|
scrollTargetY.config(command=self.listBindings.yview)
|
|
|
|
scrollTargetX.config(command=self.listBindings.xview)
|
|
|
|
self.listBindings.config(yscrollcommand=scrollTargetY.set)
|
|
|
|
self.listBindings.config(xscrollcommand=scrollTargetX.set)
|
|
|
|
buttonNewKeys=Button(frameCustom,text='Get New Keys for Selection',
|
|
|
|
command=self.GetNewKeys)
|
2001-08-04 10:58:22 -03:00
|
|
|
buttonSaveCustomKeys=Button(frameCustom,text='Save as a Custom Key Set')
|
|
|
|
#frameKeySets
|
2001-08-05 05:00:28 -03:00
|
|
|
labelKeysTitle=Label(frameKeySets,text='Select a Key Set')
|
2001-08-04 10:58:22 -03:00
|
|
|
labelTypeTitle=Label(frameKeySets,text='Select : ')
|
2001-11-04 07:53:10 -04:00
|
|
|
self.radioKeysBuiltin=Radiobutton(frameKeySets,variable=self.keysAreDefault,
|
|
|
|
value=1,command=self.SetKeysType,text='a Built-in Key Set')
|
|
|
|
self.radioKeysCustom=Radiobutton(frameKeySets,variable=self.keysAreDefault,
|
|
|
|
value=0,command=self.SetKeysType,text='a Custom Key Set')
|
2001-10-29 04:05:34 -04:00
|
|
|
self.optMenuKeysBuiltin=DynOptionMenu(frameKeySets,
|
|
|
|
self.builtinKeys,None,command=None)
|
|
|
|
self.optMenuKeysCustom=DynOptionMenu(frameKeySets,
|
|
|
|
self.customKeys,None,command=None)
|
2001-08-04 10:58:22 -03:00
|
|
|
self.buttonDeleteCustomKeys=Button(frameKeySets,text='Delete Custom Key Set')
|
|
|
|
##widget packing
|
|
|
|
#body
|
|
|
|
frameCustom.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
|
|
|
|
frameKeySets.pack(side=LEFT,padx=5,pady=5,fill=Y)
|
|
|
|
#frameCustom
|
|
|
|
labelCustomTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
|
|
|
buttonSaveCustomKeys.pack(side=BOTTOM,fill=X,padx=5,pady=5)
|
2002-01-18 20:29:54 -04:00
|
|
|
buttonNewKeys.pack(side=BOTTOM,fill=X,padx=5,pady=5)
|
|
|
|
frameTarget.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
|
|
|
|
#frame target
|
|
|
|
frameTarget.columnconfigure(0,weight=1)
|
|
|
|
frameTarget.rowconfigure(1,weight=1)
|
|
|
|
labelTargetTitle.grid(row=0,column=0,columnspan=2,sticky=W)
|
|
|
|
self.listBindings.grid(row=1,column=0,sticky=NSEW)
|
|
|
|
scrollTargetY.grid(row=1,column=1,sticky=NS)
|
|
|
|
scrollTargetX.grid(row=2,column=0,sticky=EW)
|
2001-08-04 10:58:22 -03:00
|
|
|
#frameKeySets
|
|
|
|
labelKeysTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
|
|
|
labelTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
2001-10-29 04:05:34 -04:00
|
|
|
self.radioKeysBuiltin.pack(side=TOP,anchor=W,padx=5)
|
|
|
|
self.radioKeysCustom.pack(side=TOP,anchor=W,padx=5,pady=2)
|
2001-08-04 10:58:22 -03:00
|
|
|
self.optMenuKeysBuiltin.pack(side=TOP,fill=X,padx=5,pady=5)
|
|
|
|
self.optMenuKeysCustom.pack(side=TOP,fill=X,anchor=W,padx=5,pady=5)
|
|
|
|
self.buttonDeleteCustomKeys.pack(side=TOP,fill=X,padx=5,pady=5)
|
2001-08-03 01:43:44 -03:00
|
|
|
return frame
|
|
|
|
|
|
|
|
def CreatePageGeneral(self):
|
2001-08-07 00:28:25 -03:00
|
|
|
#tkVars
|
2001-11-21 01:56:26 -04:00
|
|
|
self.runType=IntVar(self)
|
|
|
|
self.winWidth=StringVar(self)
|
|
|
|
self.winHeight=StringVar(self)
|
|
|
|
self.extState=IntVar(self)
|
2001-08-07 00:28:25 -03:00
|
|
|
#widget creation
|
|
|
|
#body
|
2001-12-05 03:54:07 -04:00
|
|
|
frame=self.tabPages.pages['General']['page']
|
2001-08-07 00:28:25 -03:00
|
|
|
#body section frames
|
|
|
|
frameRun=Frame(frame,borderwidth=2,relief=GROOVE)
|
|
|
|
frameWinSize=Frame(frame,borderwidth=2,relief=GROOVE)
|
|
|
|
frameExt=Frame(frame,borderwidth=2,relief=GROOVE)
|
|
|
|
#frameRun
|
|
|
|
labelRunTitle=Label(frameRun,text='Run Preferences')
|
|
|
|
labelRunChoiceTitle=Label(frameRun,text='Run code : ')
|
|
|
|
radioRunInternal=Radiobutton(frameRun,variable=self.runType,
|
|
|
|
value=0,command=self.SetKeysType,text="in IDLE's Process")
|
|
|
|
radioRunSeparate=Radiobutton(frameRun,variable=self.runType,
|
|
|
|
value=1,command=self.SetKeysType,text='in a Separate Process')
|
|
|
|
#frameWinSize
|
|
|
|
labelWinSizeTitle=Label(frameWinSize,text='Initial Window Size')
|
|
|
|
labelWinWidthTitle=Label(frameWinSize,text='Width')
|
|
|
|
entryWinWidth=Entry(frameWinSize,textvariable=self.winWidth,
|
|
|
|
width=3)
|
|
|
|
labelWinHeightTitle=Label(frameWinSize,text='Height')
|
|
|
|
entryWinHeight=Entry(frameWinSize,textvariable=self.winHeight,
|
|
|
|
width=3)
|
|
|
|
#frameExt
|
|
|
|
frameExtList=Frame(frameExt)
|
|
|
|
frameExtSet=Frame(frameExt)
|
|
|
|
labelExtTitle=Label(frameExt,text='Configure IDLE Extensions')
|
|
|
|
labelExtListTitle=Label(frameExtList,text='Extension')
|
|
|
|
scrollExtList=Scrollbar(frameExtList)
|
|
|
|
listExt=Listbox(frameExtList,height=5)
|
2001-08-11 12:48:13 -03:00
|
|
|
scrollExtList.config(command=listExt.yview)
|
|
|
|
listExt.config(yscrollcommand=scrollExtList.set)
|
2001-08-07 00:28:25 -03:00
|
|
|
labelExtSetTitle=Label(frameExtSet,text='Settings')
|
|
|
|
radioEnableExt=Radiobutton(frameExtSet,variable=self.extState,
|
|
|
|
value=1,text="enable")
|
|
|
|
radioDisableExt=Radiobutton(frameExtSet,variable=self.extState,
|
|
|
|
value=0,text="disable")
|
|
|
|
self.extState.set(1)
|
|
|
|
buttonExtConfig=Button(frameExtSet,text='Configure')
|
|
|
|
|
|
|
|
#widget packing
|
|
|
|
#body
|
|
|
|
frameRun.pack(side=TOP,padx=5,pady=5,fill=X)
|
|
|
|
frameWinSize.pack(side=TOP,padx=5,pady=5,fill=X)
|
|
|
|
frameExt.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
|
|
|
|
#frameRun
|
|
|
|
labelRunTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
|
|
|
labelRunChoiceTitle.pack(side=LEFT,anchor=W,padx=5,pady=5)
|
|
|
|
radioRunInternal.pack(side=LEFT,anchor=W,padx=5,pady=5)
|
|
|
|
radioRunSeparate.pack(side=LEFT,anchor=W,padx=5,pady=5)
|
|
|
|
#frameWinSize
|
2002-01-18 20:29:54 -04:00
|
|
|
labelWinSizeTitle.pack(side=LEFT,anchor=W,padx=5,pady=5)
|
|
|
|
entryWinHeight.pack(side=RIGHT,anchor=E,padx=10,pady=5)
|
|
|
|
labelWinHeightTitle.pack(side=RIGHT,anchor=E,pady=5)
|
|
|
|
entryWinWidth.pack(side=RIGHT,anchor=E,padx=10,pady=5)
|
|
|
|
labelWinWidthTitle.pack(side=RIGHT,anchor=E,pady=5)
|
2001-08-07 00:28:25 -03:00
|
|
|
#frameExt
|
|
|
|
labelExtTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
|
|
|
|
frameExtSet.pack(side=RIGHT,padx=5,pady=5,fill=Y)
|
|
|
|
frameExtList.pack(side=RIGHT,padx=5,pady=5,expand=TRUE,fill=BOTH)
|
|
|
|
labelExtListTitle.pack(side=TOP,anchor=W)
|
|
|
|
scrollExtList.pack(side=RIGHT,anchor=W,fill=Y)
|
|
|
|
listExt.pack(side=LEFT,anchor=E,expand=TRUE,fill=BOTH)
|
|
|
|
labelExtSetTitle.pack(side=TOP,anchor=W)
|
|
|
|
radioEnableExt.pack(side=TOP,anchor=W)
|
|
|
|
radioDisableExt.pack(side=TOP,anchor=W)
|
|
|
|
buttonExtConfig.pack(side=TOP,anchor=W,pady=5)
|
|
|
|
|
2001-08-03 01:43:44 -03:00
|
|
|
return frame
|
|
|
|
|
2001-11-03 10:54:25 -04:00
|
|
|
def PaintThemeSample(self):
|
2001-11-04 07:53:10 -04:00
|
|
|
if self.themeIsBuiltin.get(): #a default theme
|
2001-11-04 03:03:08 -04:00
|
|
|
theme=self.builtinTheme.get()
|
|
|
|
else: #a user theme
|
|
|
|
theme=self.customTheme.get()
|
2001-11-04 07:53:10 -04:00
|
|
|
for element in self.themeElements.keys():
|
|
|
|
colours=idleConf.GetHighlight(theme, self.themeElements[element][0])
|
2002-01-03 08:05:17 -04:00
|
|
|
if element=='Cursor': #cursor sample needs special painting
|
|
|
|
colours['background']=idleConf.GetHighlight(theme,
|
2002-01-04 03:53:06 -04:00
|
|
|
'normal', fgBg='bg')
|
2001-11-04 07:53:10 -04:00
|
|
|
apply(self.textHighlightSample.tag_config,
|
|
|
|
(self.themeElements[element][0],),colours)
|
2002-01-03 08:05:17 -04:00
|
|
|
|
2001-10-23 07:42:12 -03:00
|
|
|
def LoadFontCfg(self):
|
|
|
|
##base editor font selection list
|
2001-09-24 06:43:17 -03:00
|
|
|
fonts=list(tkFont.families(self))
|
|
|
|
fonts.sort()
|
|
|
|
for font in fonts:
|
|
|
|
self.listFontName.insert(END,font)
|
2001-10-26 03:47:09 -03:00
|
|
|
configuredFont=idleConf.GetOption('main','EditorWindow','font',
|
2001-10-23 07:42:12 -03:00
|
|
|
default='courier')
|
|
|
|
if configuredFont in fonts:
|
|
|
|
currentFontIndex=fonts.index(configuredFont)
|
|
|
|
self.listFontName.see(currentFontIndex)
|
|
|
|
self.listFontName.select_set(currentFontIndex)
|
|
|
|
##font size dropdown
|
2001-10-26 03:47:09 -03:00
|
|
|
fontSize=idleConf.GetOption('main','EditorWindow','font-size',default='12')
|
|
|
|
self.optMenuFontSize.SetMenu(('10','11','12','13','14',
|
|
|
|
'16','18','20','22'),fontSize )
|
2001-10-23 07:42:12 -03:00
|
|
|
##font sample
|
|
|
|
self.SetFontSample()
|
|
|
|
|
|
|
|
def LoadTabCfg(self):
|
|
|
|
##indent type radibuttons
|
2001-10-26 03:47:09 -03:00
|
|
|
spaceIndent=idleConf.GetOption('main','Indent','use-spaces',
|
2001-10-23 07:42:12 -03:00
|
|
|
default=1,type='bool')
|
|
|
|
self.indentType.set(spaceIndent)
|
|
|
|
##indent sizes
|
2001-10-26 03:47:09 -03:00
|
|
|
spaceNum=idleConf.GetOption('main','Indent','num-spaces',
|
2001-10-23 07:42:12 -03:00
|
|
|
default=4,type='int')
|
2001-10-26 03:47:09 -03:00
|
|
|
tabCols=idleConf.GetOption('main','Indent','tab-cols',
|
2001-10-23 07:42:12 -03:00
|
|
|
default=4,type='int')
|
|
|
|
self.spaceNum.set(spaceNum)
|
|
|
|
self.tabCols.set(tabCols)
|
2001-09-24 06:43:17 -03:00
|
|
|
|
2001-11-03 10:54:25 -04:00
|
|
|
def LoadThemeCfg(self):
|
2001-10-29 04:05:34 -04:00
|
|
|
##current theme type radiobutton
|
2001-11-04 07:53:10 -04:00
|
|
|
self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default',
|
|
|
|
type='int',default=1))
|
2001-10-29 04:05:34 -04:00
|
|
|
##currently set theme
|
2002-01-03 08:05:17 -04:00
|
|
|
currentOption=idleConf.CurrentTheme()
|
2001-10-29 07:19:46 -04:00
|
|
|
##load available theme option menus
|
2001-11-04 07:53:10 -04:00
|
|
|
if self.themeIsBuiltin.get(): #default theme selected
|
2001-10-29 04:05:34 -04:00
|
|
|
itemList=idleConf.GetSectionList('default','highlight')
|
|
|
|
self.optMenuThemeBuiltin.SetMenu(itemList,currentOption)
|
|
|
|
itemList=idleConf.GetSectionList('user','highlight')
|
|
|
|
if not itemList:
|
|
|
|
self.radioThemeCustom.config(state=DISABLED)
|
|
|
|
self.customTheme.set('- no custom themes -')
|
|
|
|
else:
|
|
|
|
self.optMenuThemeCustom.SetMenu(itemList,itemList[0])
|
2001-11-03 10:54:25 -04:00
|
|
|
else: #user theme selected
|
2001-10-29 04:05:34 -04:00
|
|
|
itemList=idleConf.GetSectionList('user','highlight')
|
|
|
|
self.optMenuThemeCustom.SetMenu(itemList,currentOption)
|
|
|
|
itemList=idleConf.GetSectionList('default','highlight')
|
|
|
|
self.optMenuThemeBuiltin.SetMenu(itemList,itemList[0])
|
2001-10-29 07:19:46 -04:00
|
|
|
self.SetThemeType()
|
|
|
|
##load theme element option menu
|
2001-11-03 10:54:25 -04:00
|
|
|
themeNames=self.themeElements.keys()
|
|
|
|
themeNames.sort(self.__ThemeNameIndexCompare)
|
|
|
|
self.optMenuHighlightTarget.SetMenu(themeNames,themeNames[0])
|
|
|
|
self.PaintThemeSample()
|
2002-01-04 03:53:06 -04:00
|
|
|
self.SetHighlightTarget()
|
2001-11-03 10:54:25 -04:00
|
|
|
|
|
|
|
def __ThemeNameIndexCompare(self,a,b):
|
|
|
|
if self.themeElements[a][1]<self.themeElements[b][1]: return -1
|
|
|
|
elif self.themeElements[a][1]==self.themeElements[b][1]: return 0
|
|
|
|
else: return 1
|
2001-10-29 04:05:34 -04:00
|
|
|
|
2001-11-03 10:54:25 -04:00
|
|
|
def LoadKeyCfg(self):
|
2001-10-29 04:05:34 -04:00
|
|
|
##current keys type radiobutton
|
2001-11-04 07:53:10 -04:00
|
|
|
self.keysAreDefault.set(idleConf.GetOption('main','Keys','default',
|
|
|
|
type='int',default=1))
|
2001-10-29 04:05:34 -04:00
|
|
|
##currently set keys
|
2002-01-03 08:05:17 -04:00
|
|
|
currentOption=idleConf.CurrentKeys()
|
2001-10-29 07:19:46 -04:00
|
|
|
##load available keyset option menus
|
2001-11-04 07:53:10 -04:00
|
|
|
if self.keysAreDefault.get(): #default theme selected
|
2001-10-29 04:05:34 -04:00
|
|
|
itemList=idleConf.GetSectionList('default','keys')
|
|
|
|
self.optMenuKeysBuiltin.SetMenu(itemList,currentOption)
|
|
|
|
itemList=idleConf.GetSectionList('user','keys')
|
|
|
|
if not itemList:
|
|
|
|
self.radioKeysCustom.config(state=DISABLED)
|
|
|
|
self.customKeys.set('- no custom keys -')
|
|
|
|
else:
|
|
|
|
self.optMenuKeysCustom.SetMenu(itemList,itemList[0])
|
2001-11-04 07:53:10 -04:00
|
|
|
else: #user theme selected
|
2001-10-29 04:05:34 -04:00
|
|
|
itemList=idleConf.GetSectionList('user','keys')
|
|
|
|
self.optMenuKeysCustom.SetMenu(itemList,currentOption)
|
|
|
|
itemList=idleConf.GetSectionList('default','keys')
|
|
|
|
self.optMenuKeysBuiltin.SetMenu(itemList,itemList[0])
|
|
|
|
self.SetKeysType()
|
2002-01-18 20:29:54 -04:00
|
|
|
##load keyset element list
|
|
|
|
keySet=idleConf.GetKeys(currentOption)
|
|
|
|
bindNames=keySet.keys()
|
|
|
|
bindNames.sort()
|
|
|
|
for bindName in bindNames:
|
|
|
|
key=string.join(keySet[bindName]) #make key(s) into a string
|
|
|
|
bindName=bindName[2:-2] #trim off the angle brackets
|
|
|
|
self.listBindings.insert(END, bindName+' - '+key)
|
|
|
|
|
|
|
|
def GetNewKeys(self):
|
|
|
|
listIndex=self.listBindings.index(ANCHOR)
|
|
|
|
binding=self.listBindings.get(listIndex)
|
|
|
|
bindName=binding.split()[0] #first part, up to first space
|
|
|
|
newKeys=GetKeysDialog(self,'Get New Keys',bindName)
|
|
|
|
print newKeys.result
|
|
|
|
if newKeys.result: #new keys were specified
|
|
|
|
self.listBindings.delete(listIndex)
|
|
|
|
self.listBindings.insert(listIndex,bindName+' - '+newKeys.result)
|
|
|
|
self.listBindings.select_set(listIndex)
|
|
|
|
|
|
|
|
def LoadGeneralCfg(self):
|
|
|
|
#initial window size
|
|
|
|
self.winWidth.set(idleConf.GetOption('main','EditorWindow','width'))
|
|
|
|
self.winHeight.set(idleConf.GetOption('main','EditorWindow','height'))
|
|
|
|
|
2001-10-29 04:05:34 -04:00
|
|
|
|
2001-10-23 07:42:12 -03:00
|
|
|
def LoadConfigs(self):
|
|
|
|
"""
|
|
|
|
load configuration from default and user config files and populate
|
|
|
|
the widgets on the config dialog pages.
|
|
|
|
"""
|
|
|
|
### fonts / tabs page
|
|
|
|
self.LoadFontCfg()
|
|
|
|
self.LoadTabCfg()
|
|
|
|
### highlighting page
|
2001-11-03 10:54:25 -04:00
|
|
|
self.LoadThemeCfg()
|
2001-10-23 07:42:12 -03:00
|
|
|
### keys page
|
2001-11-03 10:54:25 -04:00
|
|
|
self.LoadKeyCfg()
|
2001-10-23 07:42:12 -03:00
|
|
|
### help page
|
|
|
|
### general page
|
2002-01-18 20:29:54 -04:00
|
|
|
self.LoadGeneralCfg()
|
2001-10-23 07:42:12 -03:00
|
|
|
|
2001-09-24 06:43:17 -03:00
|
|
|
def SaveConfigs(self):
|
2001-10-23 07:42:12 -03:00
|
|
|
"""
|
|
|
|
save configuration changes to user config files.
|
|
|
|
"""
|
2001-09-24 06:43:17 -03:00
|
|
|
pass
|
|
|
|
|
2001-07-31 03:59:02 -03:00
|
|
|
if __name__ == '__main__':
|
2001-07-31 07:46:53 -03:00
|
|
|
#test the dialog
|
|
|
|
root=Tk()
|
|
|
|
Button(root,text='Dialog',
|
2001-11-21 01:56:26 -04:00
|
|
|
command=lambda:ConfigDialog(root,'Settings')).pack()
|
2001-07-31 07:46:53 -03:00
|
|
|
root.mainloop()
|