summaryrefslogtreecommitdiff
path: root/Lib/idlelib/configDialog.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/configDialog.py')
-rw-r--r--Lib/idlelib/configDialog.py102
1 files changed, 53 insertions, 49 deletions
diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py
index ad3071a6e4..d00b579c20 100644
--- a/Lib/idlelib/configDialog.py
+++ b/Lib/idlelib/configDialog.py
@@ -15,7 +15,7 @@ import copy
from idlelib.configHandler import idleConf
from idlelib.dynOptionMenuWidget import DynOptionMenu
-from idlelib.tabpage import TabPageSet
+from idlelib.tabbedpages import TabbedPageSet
from idlelib.keybindingDialog import GetKeysDialog
from idlelib.configSectionNameDialog import GetCfgSectionNameDialog
from idlelib.configHelpSourceEdit import GetHelpSourceDialog
@@ -24,6 +24,8 @@ class ConfigDialog(Toplevel):
def __init__(self,parent,title):
Toplevel.__init__(self, parent)
+ self.wm_withdraw()
+
self.configure(borderwidth=5)
self.geometry("+%d+%d" % (parent.winfo_rootx()+20,
parent.winfo_rooty()+30))
@@ -58,31 +60,37 @@ class ConfigDialog(Toplevel):
#self.bind('<F1>',self.Help) #context help
self.LoadConfigs()
self.AttachVarCallbacks() #avoid callbacks during LoadConfigs
+
+ self.wm_deiconify()
self.wait_window()
def CreateWidgets(self):
- self.tabPages = TabPageSet(self,
- pageNames=['Fonts/Tabs','Highlighting','Keys','General'])
- self.tabPages.ChangePage()#activates default (first) page
- frameActionButtons = Frame(self)
+ self.tabPages = TabbedPageSet(self,
+ page_names=['Fonts/Tabs','Highlighting','Keys','General'])
+ frameActionButtons = Frame(self,pady=2)
#action buttons
self.buttonHelp = Button(frameActionButtons,text='Help',
- command=self.Help,takefocus=FALSE)
+ command=self.Help,takefocus=FALSE,
+ padx=6,pady=3)
self.buttonOk = Button(frameActionButtons,text='Ok',
- command=self.Ok,takefocus=FALSE)
+ command=self.Ok,takefocus=FALSE,
+ padx=6,pady=3)
self.buttonApply = Button(frameActionButtons,text='Apply',
- command=self.Apply,takefocus=FALSE)
+ command=self.Apply,takefocus=FALSE,
+ padx=6,pady=3)
self.buttonCancel = Button(frameActionButtons,text='Cancel',
- command=self.Cancel,takefocus=FALSE)
+ command=self.Cancel,takefocus=FALSE,
+ padx=6,pady=3)
self.CreatePageFontTab()
self.CreatePageHighlight()
self.CreatePageKeys()
self.CreatePageGeneral()
- 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)
- self.buttonCancel.pack(side=LEFT,padx=5,pady=5)
+ self.buttonHelp.pack(side=RIGHT,padx=5)
+ self.buttonOk.pack(side=LEFT,padx=5)
+ self.buttonApply.pack(side=LEFT,padx=5)
+ self.buttonCancel.pack(side=LEFT,padx=5)
frameActionButtons.pack(side=BOTTOM)
+ Frame(self, border=0).pack(side=BOTTOM,pady=2)
self.tabPages.pack(side=TOP,expand=TRUE,fill=BOTH)
def CreatePageFontTab(self):
@@ -94,16 +102,17 @@ class ConfigDialog(Toplevel):
self.editFont=tkFont.Font(self,('courier',10,'normal'))
##widget creation
#body frame
- frame=self.tabPages.pages['Fonts/Tabs']['page']
+ frame=self.tabPages.pages['Fonts/Tabs'].frame
#body section frames
- frameFont=Frame(frame,borderwidth=2,relief=GROOVE)
- frameIndent=Frame(frame,borderwidth=2,relief=GROOVE)
+ frameFont=LabelFrame(frame,borderwidth=2,relief=GROOVE,
+ text=' Base Editor Font ')
+ frameIndent=LabelFrame(frame,borderwidth=2,relief=GROOVE,
+ text=' Indentation Width ')
#frameFont
- labelFontTitle=Label(frameFont,text='Set Base Editor Font')
frameFontName=Frame(frameFont)
frameFontParam=Frame(frameFont)
labelFontNameTitle=Label(frameFontName,justify=LEFT,
- text='Font :')
+ text='Font Face :')
self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE,
exportselection=FALSE)
self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease)
@@ -124,14 +133,13 @@ class ConfigDialog(Toplevel):
labelSpaceNumTitle=Label(frameIndentSize, justify=LEFT,
text='Python Standard: 4 Spaces!')
self.scaleSpaceNum=Scale(frameIndentSize, variable=self.spaceNum,
- label='Indentation Width', orient='horizontal',
+ orient='horizontal',
tickinterval=2, from_=2, to=16)
#widget packing
#body
- frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH)
- frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y)
+ frameFont.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
+ frameIndent.pack(side=LEFT,padx=5,pady=5,fill=Y)
#frameFont
- labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
frameFontName.pack(side=TOP,padx=5,pady=5,fill=X)
frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X)
labelFontNameTitle.pack(side=TOP,anchor=W)
@@ -143,7 +151,7 @@ class ConfigDialog(Toplevel):
frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
self.labelFontSample.pack(expand=TRUE,fill=BOTH)
#frameIndent
- frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH)
+ frameIndentSize.pack(side=TOP,fill=X)
labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5)
self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X)
return frame
@@ -158,10 +166,12 @@ class ConfigDialog(Toplevel):
self.highlightTarget=StringVar(self)
##widget creation
#body frame
- frame=self.tabPages.pages['Highlighting']['page']
+ frame=self.tabPages.pages['Highlighting'].frame
#body section frames
- frameCustom=Frame(frame,borderwidth=2,relief=GROOVE)
- frameTheme=Frame(frame,borderwidth=2,relief=GROOVE)
+ frameCustom=LabelFrame(frame,borderwidth=2,relief=GROOVE,
+ text=' Custom Highlighting ')
+ frameTheme=LabelFrame(frame,borderwidth=2,relief=GROOVE,
+ text=' Highlighting Theme ')
#frameCustom
self.textHighlightSample=Text(frameCustom,relief=SOLID,borderwidth=1,
font=('courier',12,''),cursor='hand2',width=21,height=10,
@@ -189,7 +199,6 @@ class ConfigDialog(Toplevel):
text.config(state=DISABLED)
self.frameColourSet=Frame(frameCustom,relief=SOLID,borderwidth=1)
frameFgBg=Frame(frameCustom)
- labelCustomTitle=Label(frameCustom,text='Set Custom Highlighting')
buttonSetColour=Button(self.frameColourSet,text='Choose Colour for :',
command=self.GetColour,highlightthickness=0)
self.optMenuHighlightTarget=DynOptionMenu(self.frameColourSet,
@@ -202,7 +211,6 @@ class ConfigDialog(Toplevel):
buttonSaveCustomTheme=Button(frameCustom,
text='Save as New Custom Theme',command=self.SaveAsNewTheme)
#frameTheme
- labelThemeTitle=Label(frameTheme,text='Select a Highlighting Theme')
labelTypeTitle=Label(frameTheme,text='Select : ')
self.radioThemeBuiltin=Radiobutton(frameTheme,variable=self.themeIsBuiltin,
value=1,command=self.SetThemeType,text='a Built-in Theme')
@@ -216,10 +224,9 @@ class ConfigDialog(Toplevel):
command=self.DeleteCustomTheme)
##widget packing
#body
- frameCustom.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH)
- frameTheme.pack(side=LEFT,padx=5,pady=10,fill=Y)
+ frameCustom.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
+ frameTheme.pack(side=LEFT,padx=5,pady=5,fill=Y)
#frameCustom
- labelCustomTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
self.frameColourSet.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=X)
frameFgBg.pack(side=TOP,padx=5,pady=0)
self.textHighlightSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,
@@ -230,7 +237,6 @@ class ConfigDialog(Toplevel):
self.radioBg.pack(side=RIGHT,anchor=W)
buttonSaveCustomTheme.pack(side=BOTTOM,fill=X,padx=5,pady=5)
#frameTheme
- labelThemeTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
labelTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
self.radioThemeBuiltin.pack(side=TOP,anchor=W,padx=5)
self.radioThemeCustom.pack(side=TOP,anchor=W,padx=5,pady=2)
@@ -248,13 +254,14 @@ class ConfigDialog(Toplevel):
self.keyBinding=StringVar(self)
##widget creation
#body frame
- frame=self.tabPages.pages['Keys']['page']
+ frame=self.tabPages.pages['Keys'].frame
#body section frames
- frameCustom=Frame(frame,borderwidth=2,relief=GROOVE)
- frameKeySets=Frame(frame,borderwidth=2,relief=GROOVE)
+ frameCustom=LabelFrame(frame,borderwidth=2,relief=GROOVE,
+ text=' Custom Key Bindings ')
+ frameKeySets=LabelFrame(frame,borderwidth=2,relief=GROOVE,
+ text=' Key Set ')
#frameCustom
frameTarget=Frame(frameCustom)
- labelCustomTitle=Label(frameCustom,text='Set Custom Key Bindings')
labelTargetTitle=Label(frameTarget,text='Action - Key(s)')
scrollTargetY=Scrollbar(frameTarget)
scrollTargetX=Scrollbar(frameTarget,orient=HORIZONTAL)
@@ -270,7 +277,6 @@ class ConfigDialog(Toplevel):
buttonSaveCustomKeys=Button(frameCustom,
text='Save as New Custom Key Set',command=self.SaveAsNewKeySet)
#frameKeySets
- labelKeysTitle=Label(frameKeySets,text='Select a Key Set')
labelTypeTitle=Label(frameKeySets,text='Select : ')
self.radioKeysBuiltin=Radiobutton(frameKeySets,variable=self.keysAreBuiltin,
value=1,command=self.SetKeysType,text='a Built-in Key Set')
@@ -287,7 +293,6 @@ class ConfigDialog(Toplevel):
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)
self.buttonNewKeys.pack(side=BOTTOM,fill=X,padx=5,pady=5)
frameTarget.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
@@ -299,7 +304,6 @@ class ConfigDialog(Toplevel):
scrollTargetY.grid(row=1,column=1,sticky=NS)
scrollTargetX.grid(row=2,column=0,sticky=EW)
#frameKeySets
- labelKeysTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
labelTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
self.radioKeysBuiltin.pack(side=TOP,anchor=W,padx=5)
self.radioKeysCustom.pack(side=TOP,anchor=W,padx=5,pady=2)
@@ -320,23 +324,24 @@ class ConfigDialog(Toplevel):
self.helpBrowser=StringVar(self)
#widget creation
#body
- frame=self.tabPages.pages['General']['page']
+ frame=self.tabPages.pages['General'].frame
#body section frames
- frameRun=Frame(frame,borderwidth=2,relief=GROOVE)
- frameSave=Frame(frame,borderwidth=2,relief=GROOVE)
+ frameRun=LabelFrame(frame,borderwidth=2,relief=GROOVE,
+ text=' Startup Preferences ')
+ frameSave=LabelFrame(frame,borderwidth=2,relief=GROOVE,
+ text=' Autosave Preferences ')
frameWinSize=Frame(frame,borderwidth=2,relief=GROOVE)
frameParaSize=Frame(frame,borderwidth=2,relief=GROOVE)
frameEncoding=Frame(frame,borderwidth=2,relief=GROOVE)
- frameHelp=Frame(frame,borderwidth=2,relief=GROOVE)
+ frameHelp=LabelFrame(frame,borderwidth=2,relief=GROOVE,
+ text=' Additional Help Sources ')
#frameRun
- labelRunTitle=Label(frameRun,text='Startup Preferences')
labelRunChoiceTitle=Label(frameRun,text='At Startup')
radioStartupEdit=Radiobutton(frameRun,variable=self.startupEdit,
value=1,command=self.SetKeysType,text="Open Edit Window")
radioStartupShell=Radiobutton(frameRun,variable=self.startupEdit,
value=0,command=self.SetKeysType,text='Open Shell Window')
#frameSave
- labelSaveTitle=Label(frameSave,text='Autosave Preference')
labelRunSaveTitle=Label(frameSave,text='At Start of Run (F5) ')
radioSaveAsk=Radiobutton(frameSave,variable=self.autoSave,
value=0,command=self.SetKeysType,text="Prompt to Save")
@@ -367,7 +372,6 @@ class ConfigDialog(Toplevel):
#frameHelp
frameHelpList=Frame(frameHelp)
frameHelpListButtons=Frame(frameHelpList)
- labelHelpListTitle=Label(frameHelpList,text='Additional Help Sources:')
scrollHelpList=Scrollbar(frameHelpList)
self.listHelp=Listbox(frameHelpList,height=5,takefocus=FALSE,
exportselection=FALSE)
@@ -389,12 +393,10 @@ class ConfigDialog(Toplevel):
frameEncoding.pack(side=TOP,padx=5,pady=5,fill=X)
frameHelp.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)
radioStartupShell.pack(side=RIGHT,anchor=W,padx=5,pady=5)
radioStartupEdit.pack(side=RIGHT,anchor=W,padx=5,pady=5)
#frameSave
- labelSaveTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
labelRunSaveTitle.pack(side=LEFT,anchor=W,padx=5,pady=5)
radioSaveAuto.pack(side=RIGHT,anchor=W,padx=5,pady=5)
radioSaveAsk.pack(side=RIGHT,anchor=W,padx=5,pady=5)
@@ -415,7 +417,6 @@ class ConfigDialog(Toplevel):
#frameHelp
frameHelpListButtons.pack(side=RIGHT,padx=5,pady=5,fill=Y)
frameHelpList.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
- labelHelpListTitle.pack(side=TOP,anchor=W)
scrollHelpList.pack(side=RIGHT,anchor=W,fill=Y)
self.listHelp.pack(side=LEFT,anchor=E,expand=TRUE,fill=BOTH)
self.buttonHelpListEdit.pack(side=TOP,anchor=W,pady=5)
@@ -1116,12 +1117,15 @@ class ConfigDialog(Toplevel):
def ActivateConfigChanges(self):
"Dynamically apply configuration changes"
winInstances = self.parent.instance_dict.keys()
+ theme = idleConf.CurrentTheme()
+ cursor_color = idleConf.GetHighlight(theme, 'cursor', fgBg='fg')
for instance in winInstances:
instance.ResetColorizer()
instance.ResetFont()
instance.set_notabs_indentwidth()
instance.ApplyKeybindings()
instance.reset_help_menu_entries()
+ instance.text.configure(insertbackground=cursor_color)
def Cancel(self):
self.destroy()