diff -r ee476248a74a Lib/idlelib/configdialog.py --- a/Lib/idlelib/configdialog.py Mon Oct 24 07:31:55 2016 -0700 +++ b/Lib/idlelib/configdialog.py Mon Oct 24 17:26:55 2016 -0400 @@ -184,7 +184,7 @@ self.builtinTheme = StringVar(parent) self.customTheme = StringVar(parent) self.fgHilite = BooleanVar(parent) - self.colour = StringVar(parent) + self.color = StringVar(parent) self.fontName = StringVar(parent) self.themeIsBuiltin = BooleanVar(parent) self.highlightTarget = StringVar(parent) @@ -230,20 +230,20 @@ text.tag_bind( self.themeElements[element][0], '', tem) text.config(state=DISABLED) - self.frameColourSet = Frame(frameCustom, relief=SOLID, borderwidth=1) + self.frameColorSet = Frame(frameCustom, relief=SOLID, borderwidth=1) frameFgBg = Frame(frameCustom) - buttonSetColour = Button( - self.frameColourSet, text='Choose Colour for :', - command=self.GetColour, highlightthickness=0) + buttonSetColor = Button( + self.frameColorSet, text='Choose Color for :', + command=self.GetColor, highlightthickness=0) self.optMenuHighlightTarget = DynOptionMenu( - self.frameColourSet, self.highlightTarget, None, + self.frameColorSet, self.highlightTarget, None, highlightthickness=0) #, command=self.SetHighlightTargetBinding self.radioFg = Radiobutton( frameFgBg, variable=self.fgHilite, value=1, - text='Foreground', command=self.SetColourSampleBinding) + text='Foreground', command=self.SetColorSampleBinding) self.radioBg=Radiobutton( frameFgBg, variable=self.fgHilite, value=0, - text='Background', command=self.SetColourSampleBinding) + text='Background', command=self.SetColorSampleBinding) self.fgHilite.set(1) buttonSaveCustomTheme = Button( frameCustom, text='Save as New Custom Theme', @@ -270,11 +270,11 @@ frameCustom.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH) frameTheme.pack(side=LEFT, padx=5, pady=5, fill=Y) #frameCustom - self.frameColourSet.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=X) + self.frameColorSet.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, fill=BOTH) - buttonSetColour.pack(side=TOP, expand=TRUE, fill=X, padx=8, pady=4) + buttonSetColor.pack(side=TOP, expand=TRUE, fill=X, padx=8, pady=4) self.optMenuHighlightTarget.pack( side=TOP, expand=TRUE, fill=X, padx=8, pady=3) self.radioFg.pack(side=LEFT, anchor=E) @@ -470,7 +470,7 @@ self.fontName.trace_add('write', self.VarChanged_font) self.fontBold.trace_add('write', self.VarChanged_font) self.spaceNum.trace_add('write', self.VarChanged_spaceNum) - self.colour.trace_add('write', self.VarChanged_colour) + self.color.trace_add('write', self.VarChanged_color) self.builtinTheme.trace_add('write', self.VarChanged_builtinTheme) self.customTheme.trace_add('write', self.VarChanged_customTheme) self.themeIsBuiltin.trace_add('write', self.VarChanged_themeIsBuiltin) @@ -489,7 +489,7 @@ "Remove callbacks to prevent memory leaks." for var in ( self.fontSize, self.fontName, self.fontBold, - self.spaceNum, self.colour, self.builtinTheme, + self.spaceNum, self.color, self.builtinTheme, self.customTheme, self.themeIsBuiltin, self.highlightTarget, self.keyBinding, self.builtinKeys, self.customKeys, self.keysAreBuiltin, self.winWidth, self.winHeight, @@ -512,8 +512,8 @@ value = self.spaceNum.get() self.AddChangedItem('main', 'Indent', 'num-spaces', value) - def VarChanged_colour(self, *params): - self.OnNewColourSet() + def VarChanged_color(self, *params): + self.OnNewColorSet() def VarChanged_builtinTheme(self, *params): oldthemes = ('IDLE Classic', 'IDLE New') @@ -823,14 +823,14 @@ self.ActivateConfigChanges() self.SetThemeType() - def GetColour(self): + def GetColor(self): target = self.highlightTarget.get() - prevColour = self.frameColourSet.cget('bg') - rgbTuplet, colourString = tkColorChooser.askcolor( - parent=self, title='Pick new colour for : '+target, - initialcolor=prevColour) - if colourString and (colourString != prevColour): - #user didn't cancel, and they chose a new colour + prevColor = self.frameColorSet.cget('bg') + rgbTuplet, colorString = tkColorChooser.askcolor( + parent=self, title='Pick new color for : '+target, + initialcolor=prevColor) + if colorString and (colorString != prevColor): + #user didn't cancel, and they chose a new color if self.themeIsBuiltin.get(): #current theme is a built-in message = ('Your changes will be saved as a new Custom Theme. ' 'Enter a name for your new Custom Theme below.') @@ -839,19 +839,19 @@ return else: #create new custom theme based on previously active theme self.CreateNewTheme(newTheme) - self.colour.set(colourString) + self.color.set(colorString) else: #current theme is user defined - self.colour.set(colourString) + self.color.set(colorString) - def OnNewColourSet(self): - newColour=self.colour.get() - self.frameColourSet.config(bg=newColour) #set sample + def OnNewColorSet(self): + newColor=self.color.get() + self.frameColorSet.config(bg=newColor) #set sample plane ='foreground' if self.fgHilite.get() else 'background' sampleElement = self.themeElements[self.highlightTarget.get()][0] - self.textHighlightSample.tag_config(sampleElement, **{plane:newColour}) + self.textHighlightSample.tag_config(sampleElement, **{plane:newColor}) theme = self.customTheme.get() themeElement = sampleElement + '-' + plane - self.AddChangedItem('highlight', theme, themeElement, newColour) + self.AddChangedItem('highlight', theme, themeElement, newColor) def GetNewThemeName(self, message): usedNames = (idleConf.GetSectionList('user', 'highlight') + @@ -910,17 +910,17 @@ self.radioFg.config(state=NORMAL) self.radioBg.config(state=NORMAL) self.fgHilite.set(1) - self.SetColourSample() + self.SetColorSample() - def SetColourSampleBinding(self, *args): - self.SetColourSample() + def SetColorSampleBinding(self, *args): + self.SetColorSample() - def SetColourSample(self): - #set the colour smaple area + def SetColorSample(self): + #set the color smaple area tag = self.themeElements[self.highlightTarget.get()][0] plane = 'foreground' if self.fgHilite.get() else 'background' - colour = self.textHighlightSample.tag_cget(tag, plane) - self.frameColourSet.config(bg=colour) + color = self.textHighlightSample.tag_cget(tag, plane) + self.frameColorSet.config(bg=color) def PaintThemeSample(self): if self.themeIsBuiltin.get(): #a default theme @@ -929,19 +929,19 @@ theme = self.customTheme.get() for elementTitle in self.themeElements: element = self.themeElements[elementTitle][0] - colours = idleConf.GetHighlight(theme, element) + colors = idleConf.GetHighlight(theme, element) if element == 'cursor': #cursor sample needs special painting - colours['background'] = idleConf.GetHighlight( + colors['background'] = idleConf.GetHighlight( theme, 'normal', fgBg='bg') #handle any unsaved changes to this theme if theme in self.changedItems['highlight']: themeDict = self.changedItems['highlight'][theme] if element + '-foreground' in themeDict: - colours['foreground'] = themeDict[element + '-foreground'] + colors['foreground'] = themeDict[element + '-foreground'] if element + '-background' in themeDict: - colours['background'] = themeDict[element + '-background'] - self.textHighlightSample.tag_config(element, **colours) - self.SetColourSample() + colors['background'] = themeDict[element + '-background'] + self.textHighlightSample.tag_config(element, **colors) + self.SetColorSample() def HelpSourceSelected(self, event): self.SetHelpListButtonStates()