summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/configDialog.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/configDialog.py')
-rw-r--r--Lib/idlelib/configDialog.py87
1 files changed, 9 insertions, 78 deletions
diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py
index 48f22b8..1984845 100644
--- a/Lib/idlelib/configDialog.py
+++ b/Lib/idlelib/configDialog.py
@@ -6,7 +6,7 @@ saved as user defined sets. Select startup options including shell/editor
and default window size. Define additional help sources.
Note that tab width in IDLE is currently fixed at eight due to Tk issues.
-Refer to comment in EditorWindow autoindent code for details.
+Refer to comments in EditorWindow autoindent code for details.
"""
from Tkinter import *
@@ -21,9 +21,7 @@ from configSectionNameDialog import GetCfgSectionNameDialog
from configHelpSourceEdit import GetHelpSourceDialog
class ConfigDialog(Toplevel):
- """
- configuration dialog for idle
- """
+
def __init__(self,parent,title):
Toplevel.__init__(self, parent)
self.configure(borderwidth=5)
@@ -93,8 +91,6 @@ class ConfigDialog(Toplevel):
self.fontBold=BooleanVar(self)
self.fontName=StringVar(self)
self.spaceNum=IntVar(self)
- #self.tabCols=IntVar(self)
- self.indentBySpaces=BooleanVar(self)
self.editFont=tkFont.Font(self,('courier',10,'normal'))
##widget creation
#body frame
@@ -124,25 +120,12 @@ class ConfigDialog(Toplevel):
text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]',
justify=LEFT,font=self.editFont)
#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.indentBySpaces,
- value=1,text='Tab key inserts spaces')
- radioUseTabs=Radiobutton(frameIndentType,variable=self.indentBySpaces,
- value=0,text='Tab key inserts tabs')
- labelIndentSizeTitle=Label(frameIndentSize,
- text='Choose indentation size :')
- labelSpaceNumTitle=Label(frameIndentSize,justify=LEFT,
- text='indent width')
- self.scaleSpaceNum=Scale(frameIndentSize,variable=self.spaceNum,
- orient='horizontal',tickinterval=2,from_=2,to=16)
- #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)
+ labelSpaceNumTitle=Label(frameIndentSize, justify=LEFT,
+ text='Python Standard: 4 Spaces!')
+ self.scaleSpaceNum=Scale(frameIndentSize, variable=self.spaceNum,
+ label='Indentation Width', orient='horizontal',
+ tickinterval=2, from_=2, to=16)
#widget packing
#body
frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH)
@@ -160,17 +143,9 @@ class ConfigDialog(Toplevel):
frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
self.labelFontSample.pack(expand=TRUE,fill=BOTH)
#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)
return frame
def CreatePageHighlight(self):
@@ -390,7 +365,6 @@ class ConfigDialog(Toplevel):
radioEncNone=Radiobutton(frameEncoding,variable=self.encoding,
value="none",text="None")
#frameHelp
- ##labelHelpTitle=Label(frameHelp,text='Help Options')
frameHelpList=Frame(frameHelp)
frameHelpListButtons=Frame(frameHelpList)
labelHelpListTitle=Label(frameHelpList,text='Additional Help Sources:')
@@ -406,13 +380,6 @@ class ConfigDialog(Toplevel):
width=8,command=self.HelpListItemAdd)
self.buttonHelpListRemove=Button(frameHelpListButtons,text='Remove',
state=DISABLED,width=8,command=self.HelpListItemRemove)
- # the following is better handled by the BROWSER environment
- # variable under unix/linux
- #checkHelpBrowser=Checkbutton(frameHelp,variable=self.userHelpBrowser,
- # onvalue=1,offvalue=0,text='user specified (html) help browser:',
- # command=self.OnCheckUserHelpBrowser)
- #self.entryHelpBrowser=Entry(frameHelp,textvariable=self.helpBrowser,
- # width=40)
#widget packing
#body
frameRun.pack(side=TOP,padx=5,pady=5,fill=X)
@@ -446,7 +413,6 @@ class ConfigDialog(Toplevel):
radioEncUTF8.pack(side=RIGHT,anchor=E,pady=5)
radioEncLocale.pack(side=RIGHT,anchor=E,pady=5)
#frameHelp
- ##labelHelpTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
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)
@@ -455,8 +421,6 @@ class ConfigDialog(Toplevel):
self.buttonHelpListEdit.pack(side=TOP,anchor=W,pady=5)
self.buttonHelpListAdd.pack(side=TOP,anchor=W)
self.buttonHelpListRemove.pack(side=TOP,anchor=W,pady=5)
- #checkHelpBrowser.pack(side=TOP,anchor=W,padx=5)
- #self.entryHelpBrowser.pack(side=TOP,anchor=W,padx=5,pady=5)
return frame
def AttachVarCallbacks(self):
@@ -464,8 +428,6 @@ class ConfigDialog(Toplevel):
self.fontName.trace_variable('w',self.VarChanged_fontName)
self.fontBold.trace_variable('w',self.VarChanged_fontBold)
self.spaceNum.trace_variable('w',self.VarChanged_spaceNum)
- #self.tabCols.trace_variable('w',self.VarChanged_tabCols)
- self.indentBySpaces.trace_variable('w',self.VarChanged_indentBySpaces)
self.colour.trace_variable('w',self.VarChanged_colour)
self.builtinTheme.trace_variable('w',self.VarChanged_builtinTheme)
self.customTheme.trace_variable('w',self.VarChanged_customTheme)
@@ -494,18 +456,10 @@ class ConfigDialog(Toplevel):
value=self.fontBold.get()
self.AddChangedItem('main','EditorWindow','font-bold',value)
- def VarChanged_indentBySpaces(self,*params):
- value=self.indentBySpaces.get()
- self.AddChangedItem('main','Indent','use-spaces',value)
-
def VarChanged_spaceNum(self,*params):
value=self.spaceNum.get()
self.AddChangedItem('main','Indent','num-spaces',value)
- #def VarChanged_tabCols(self,*params):
- # value=self.tabCols.get()
- # self.AddChangedItem('main','Indent','tab-cols',value)
-
def VarChanged_colour(self,*params):
self.OnNewColourSet()
@@ -912,12 +866,6 @@ class ConfigDialog(Toplevel):
self.textHighlightSample.tag_config(element, **colours)
self.SetColourSample()
-## def OnCheckUserHelpBrowser(self):
-## if self.userHelpBrowser.get():
-## self.entryHelpBrowser.config(state=NORMAL)
-## else:
-## self.entryHelpBrowser.config(state=DISABLED)
-
def HelpSourceSelected(self,event):
self.SetHelpListButtonStates()
@@ -996,17 +944,10 @@ class ConfigDialog(Toplevel):
self.SetFontSample()
def LoadTabCfg(self):
- ##indent type radiobuttons
- spaceIndent=idleConf.GetOption('main','Indent','use-spaces',
- default=1,type='bool')
- self.indentBySpaces.set(spaceIndent)
##indent sizes
spaceNum=idleConf.GetOption('main','Indent','num-spaces',
default=4,type='int')
- #tabCols=idleConf.GetOption('main','Indent','tab-cols',
- # default=4,type='int')
self.spaceNum.set(spaceNum)
- #self.tabCols.set(tabCols)
def LoadThemeCfg(self):
##current theme type radiobutton
@@ -1096,11 +1037,6 @@ class ConfigDialog(Toplevel):
for helpItem in self.userHelpList:
self.listHelp.insert(END,helpItem[0])
self.SetHelpListButtonStates()
- #self.userHelpBrowser.set(idleConf.GetOption('main','General',
- # 'user-help-browser',default=0,type='bool'))
- #self.helpBrowser.set(idleConf.GetOption('main','General',
- # 'user-help-browser-command',default=''))
- #self.OnCheckUserHelpBrowser()
def LoadConfigs(self):
"""
@@ -1171,17 +1107,12 @@ class ConfigDialog(Toplevel):
self.ResetChangedItems() #clear the changed items dict
def ActivateConfigChanges(self):
- #things that need to be done to make
- #applied config changes dynamic:
- #update editor/shell font and repaint
- #dynamically update indentation setttings
- #update theme and repaint
- #update keybindings and re-bind
- #update user help sources menu
+ "Dynamically apply configuration changes"
winInstances=self.parent.instance_dict.keys()
for instance in winInstances:
instance.ResetColorizer()
instance.ResetFont()
+ instance.set_notabs_indentwidth()
instance.ResetKeybindings()
instance.reset_help_menu_entries()