Skip to content

Commit a54a8f1

Browse files
authored
bpo-28523: IDLE: Use 'color' instead of 'colour'. (#2787)
1 parent b3527bf commit a54a8f1

File tree

2 files changed

+55
-54
lines changed

2 files changed

+55
-54
lines changed

Lib/idlelib/configdialog.py

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def create_page_highlight(self):
261261
"""Return frame of widgets for Highlighting tab.
262262
263263
Tk Variables:
264-
colour: Color of selected target.
264+
color: Color of selected target.
265265
builtin_theme: Menu variable for built-in theme.
266266
custom_theme: Menu variable for custom theme.
267267
fg_bg_toggle: Toggle for foreground/background color.
@@ -276,11 +276,11 @@ def create_page_highlight(self):
276276
277277
Methods [attachment]:
278278
load_theme_cfg: Load current highlight colors.
279-
get_colour: Invoke colorchooser [button_set_colour].
280-
set_colour_sample_binding: Call set_colour_sample [fg_bg_toggle].
279+
get_color: Invoke colorchooser [button_set_color].
280+
set_color_sample_binding: Call set_color_sample [fg_bg_toggle].
281281
set_highlight_target: set fg_bg_toggle, set_color_sample().
282-
set_colour_sample: Set frame background to target.
283-
on_new_colour_set: Set new color and add option.
282+
set_color_sample: Set frame background to target.
283+
on_new_color_set: Set new color and add option.
284284
paint_theme_sample: Recolor sample.
285285
get_new_theme_name: Get from popup.
286286
create_new_theme: Combine theme with changes and save.
@@ -293,8 +293,8 @@ def create_page_highlight(self):
293293
frame
294294
frame_custom: LabelFrame
295295
(*)text_highlight_sample: Text
296-
(*)frame_colour_set: Frame
297-
button_set_colour: Button
296+
(*)frame_color_set: Frame
297+
button_set_color: Button
298298
(*)opt_menu_highlight_target: DynOptionMenu - highlight_target
299299
frame_fg_bg_toggle: Frame
300300
(*)radio_fg: Radiobutton - fg_bg_toggle
@@ -329,7 +329,7 @@ def create_page_highlight(self):
329329
self.builtin_theme = StringVar(parent)
330330
self.custom_theme = StringVar(parent)
331331
self.fg_bg_toggle = BooleanVar(parent)
332-
self.colour = StringVar(parent)
332+
self.color = StringVar(parent)
333333
self.is_builtin_theme = BooleanVar(parent)
334334
self.highlight_target = StringVar(parent)
335335

@@ -374,20 +374,20 @@ def tem(event, elem=element):
374374
text.tag_bind(
375375
self.theme_elements[element][0], '<ButtonPress-1>', tem)
376376
text.config(state=DISABLED)
377-
self.frame_colour_set = Frame(frame_custom, relief=SOLID, borderwidth=1)
377+
self.frame_color_set = Frame(frame_custom, relief=SOLID, borderwidth=1)
378378
frame_fg_bg_toggle = Frame(frame_custom)
379-
button_set_colour = Button(
380-
self.frame_colour_set, text='Choose Colour for :',
381-
command=self.get_colour, highlightthickness=0)
379+
button_set_color = Button(
380+
self.frame_color_set, text='Choose Color for :',
381+
command=self.get_color, highlightthickness=0)
382382
self.opt_menu_highlight_target = DynOptionMenu(
383-
self.frame_colour_set, self.highlight_target, None,
383+
self.frame_color_set, self.highlight_target, None,
384384
highlightthickness=0) #, command=self.set_highlight_targetBinding
385385
self.radio_fg = Radiobutton(
386386
frame_fg_bg_toggle, variable=self.fg_bg_toggle, value=1,
387-
text='Foreground', command=self.set_colour_sample_binding)
387+
text='Foreground', command=self.set_color_sample_binding)
388388
self.radio_bg=Radiobutton(
389389
frame_fg_bg_toggle, variable=self.fg_bg_toggle, value=0,
390-
text='Background', command=self.set_colour_sample_binding)
390+
text='Background', command=self.set_color_sample_binding)
391391
self.fg_bg_toggle.set(1)
392392
button_save_custom_theme = Button(
393393
frame_custom, text='Save as New Custom Theme',
@@ -414,11 +414,11 @@ def tem(event, elem=element):
414414
frame_custom.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH)
415415
frame_theme.pack(side=LEFT, padx=5, pady=5, fill=Y)
416416
#frame_custom
417-
self.frame_colour_set.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=X)
417+
self.frame_color_set.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=X)
418418
frame_fg_bg_toggle.pack(side=TOP, padx=5, pady=0)
419419
self.text_highlight_sample.pack(
420420
side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
421-
button_set_colour.pack(side=TOP, expand=TRUE, fill=X, padx=8, pady=4)
421+
button_set_color.pack(side=TOP, expand=TRUE, fill=X, padx=8, pady=4)
422422
self.opt_menu_highlight_target.pack(
423423
side=TOP, expand=TRUE, fill=X, padx=8, pady=3)
424424
self.radio_fg.pack(side=LEFT, anchor=E)
@@ -694,7 +694,7 @@ def attach_var_callbacks(self):
694694
self.font_name.trace_add('write', self.var_changed_font)
695695
self.font_bold.trace_add('write', self.var_changed_font)
696696
self.space_num.trace_add('write', self.var_changed_space_num)
697-
self.colour.trace_add('write', self.var_changed_colour)
697+
self.color.trace_add('write', self.var_changed_color)
698698
self.builtin_theme.trace_add('write', self.var_changed_builtin_theme)
699699
self.custom_theme.trace_add('write', self.var_changed_custom_theme)
700700
self.is_builtin_theme.trace_add('write', self.var_changed_is_builtin_theme)
@@ -712,7 +712,7 @@ def remove_var_callbacks(self):
712712
"Remove callbacks to prevent memory leaks."
713713
for var in (
714714
self.font_size, self.font_name, self.font_bold,
715-
self.space_num, self.colour, self.builtin_theme,
715+
self.space_num, self.color, self.builtin_theme,
716716
self.custom_theme, self.is_builtin_theme, self.highlight_target,
717717
self.keybinding, self.builtin_keys, self.custom_keys,
718718
self.are_keys_builtin, self.win_width, self.win_height,
@@ -738,9 +738,9 @@ def var_changed_space_num(self, *params):
738738
value = self.space_num.get()
739739
changes.add_option('main', 'Indent', 'num-spaces', value)
740740

741-
def var_changed_colour(self, *params):
741+
def var_changed_color(self, *params):
742742
"Process change to color choice."
743-
self.on_new_colour_set()
743+
self.on_new_color_set()
744744

745745
def var_changed_builtin_theme(self, *params):
746746
"""Process new builtin theme selection.
@@ -1099,31 +1099,31 @@ def delete_custom_theme(self):
10991099
self.activate_config_changes()
11001100
self.set_theme_type()
11011101

1102-
def get_colour(self):
1102+
def get_color(self):
11031103
"""Handle button to select a new color for the target tag.
11041104
11051105
If a new color is selected while using a builtin theme, a
11061106
name must be supplied to create a custom theme.
11071107
11081108
Attributes accessed:
11091109
highlight_target
1110-
frame_colour_set
1110+
frame_color_set
11111111
is_builtin_theme
11121112
11131113
Attributes updated:
1114-
colour
1114+
color
11151115
11161116
Methods:
11171117
get_new_theme_name
11181118
create_new_theme
11191119
"""
11201120
target = self.highlight_target.get()
1121-
prev_colour = self.frame_colour_set.cget('bg')
1122-
rgbTuplet, colour_string = tkColorChooser.askcolor(
1123-
parent=self, title='Pick new colour for : '+target,
1124-
initialcolor=prev_colour)
1125-
if colour_string and (colour_string != prev_colour):
1126-
# User didn't cancel and they chose a new colour.
1121+
prev_color = self.frame_color_set.cget('bg')
1122+
rgbTuplet, color_string = tkColorChooser.askcolor(
1123+
parent=self, title='Pick new color for : '+target,
1124+
initialcolor=prev_color)
1125+
if color_string and (color_string != prev_color):
1126+
# User didn't cancel and they chose a new color.
11271127
if self.is_builtin_theme.get(): # Current theme is a built-in.
11281128
message = ('Your changes will be saved as a new Custom Theme. '
11291129
'Enter a name for your new Custom Theme below.')
@@ -1132,20 +1132,20 @@ def get_colour(self):
11321132
return
11331133
else: # Create new custom theme based on previously active theme.
11341134
self.create_new_theme(new_theme)
1135-
self.colour.set(colour_string)
1135+
self.color.set(color_string)
11361136
else: # Current theme is user defined.
1137-
self.colour.set(colour_string)
1137+
self.color.set(color_string)
11381138

1139-
def on_new_colour_set(self):
1139+
def on_new_color_set(self):
11401140
"Display sample of new color selection on the dialog."
1141-
new_colour=self.colour.get()
1142-
self.frame_colour_set.config(bg=new_colour) # Set sample.
1141+
new_color=self.color.get()
1142+
self.frame_color_set.config(bg=new_color) # Set sample.
11431143
plane ='foreground' if self.fg_bg_toggle.get() else 'background'
11441144
sample_element = self.theme_elements[self.highlight_target.get()][0]
1145-
self.text_highlight_sample.tag_config(sample_element, **{plane:new_colour})
1145+
self.text_highlight_sample.tag_config(sample_element, **{plane:new_color})
11461146
theme = self.custom_theme.get()
11471147
theme_element = sample_element + '-' + plane
1148-
changes.add_option('highlight', theme, theme_element, new_colour)
1148+
changes.add_option('highlight', theme, theme_element, new_color)
11491149

11501150
def get_new_theme_name(self, message):
11511151
"Return name of new theme from query popup."
@@ -1258,7 +1258,7 @@ def set_highlight_target(self):
12581258
fg_bg_toggle
12591259
12601260
Methods:
1261-
set_colour_sample
1261+
set_color_sample
12621262
12631263
Called from:
12641264
var_changed_highlight_target
@@ -1272,17 +1272,17 @@ def set_highlight_target(self):
12721272
self.radio_fg.config(state=NORMAL)
12731273
self.radio_bg.config(state=NORMAL)
12741274
self.fg_bg_toggle.set(1)
1275-
self.set_colour_sample()
1275+
self.set_color_sample()
12761276

1277-
def set_colour_sample_binding(self, *args):
1277+
def set_color_sample_binding(self, *args):
12781278
"""Change color sample based on foreground/background toggle.
12791279
12801280
Methods:
1281-
set_colour_sample
1281+
set_color_sample
12821282
"""
1283-
self.set_colour_sample()
1283+
self.set_color_sample()
12841284

1285-
def set_colour_sample(self):
1285+
def set_color_sample(self):
12861286
"""Set the color of the frame background to reflect the selected target.
12871287
12881288
Instance variables accessed:
@@ -1292,13 +1292,13 @@ def set_colour_sample(self):
12921292
text_highlight_sample
12931293
12941294
Attributes updated:
1295-
frame_colour_set
1295+
frame_color_set
12961296
"""
1297-
# Set the colour sample area.
1297+
# Set the color sample area.
12981298
tag = self.theme_elements[self.highlight_target.get()][0]
12991299
plane = 'foreground' if self.fg_bg_toggle.get() else 'background'
1300-
colour = self.text_highlight_sample.tag_cget(tag, plane)
1301-
self.frame_colour_set.config(bg=colour)
1300+
color = self.text_highlight_sample.tag_cget(tag, plane)
1301+
self.frame_color_set.config(bg=color)
13021302

13031303
def paint_theme_sample(self):
13041304
"""Apply the theme colors to each element tag in the sample text.
@@ -1313,7 +1313,7 @@ def paint_theme_sample(self):
13131313
text_highlight_sample: Set the tag elements to the theme.
13141314
13151315
Methods:
1316-
set_colour_sample
1316+
set_color_sample
13171317
13181318
Called from:
13191319
var_changed_builtin_theme
@@ -1326,19 +1326,19 @@ def paint_theme_sample(self):
13261326
theme = self.custom_theme.get()
13271327
for element_title in self.theme_elements:
13281328
element = self.theme_elements[element_title][0]
1329-
colours = idleConf.GetHighlight(theme, element)
1329+
colors = idleConf.GetHighlight(theme, element)
13301330
if element == 'cursor': # Cursor sample needs special painting.
1331-
colours['background'] = idleConf.GetHighlight(
1331+
colors['background'] = idleConf.GetHighlight(
13321332
theme, 'normal', fgBg='bg')
13331333
# Handle any unsaved changes to this theme.
13341334
if theme in changes['highlight']:
13351335
theme_dict = changes['highlight'][theme]
13361336
if element + '-foreground' in theme_dict:
1337-
colours['foreground'] = theme_dict[element + '-foreground']
1337+
colors['foreground'] = theme_dict[element + '-foreground']
13381338
if element + '-background' in theme_dict:
1339-
colours['background'] = theme_dict[element + '-background']
1340-
self.text_highlight_sample.tag_config(element, **colours)
1341-
self.set_colour_sample()
1339+
colors['background'] = theme_dict[element + '-background']
1340+
self.text_highlight_sample.tag_config(element, **colors)
1341+
self.set_color_sample()
13421342

13431343
def help_source_selected(self, event):
13441344
"Handle event for selecting additional help."
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
IDLE: replace 'colour' with 'color' in configdialog.

0 commit comments

Comments
 (0)