8000 bpo-27755: IDLE: Convert configdialog DynOptionMenu to ttk OptionMenu by csabella · Pull Request #3215 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-27755: IDLE: Convert configdialog DynOptionMenu to ttk OptionMenu #3215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
85 changes: 42 additions & 43 deletions Lib/idlelib/configdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def create_page_font_tab(self):
scroll_font: Scrollbar
frame_font_param: Frame
font_size_title: Label
(*)sizelist: DynOptionMenu - font_size
(*)sizelist: OptionMenu - font_size
(*)bold_toggle: Checkbutton - font_bold
frame_font_sample: Frame
(*)font_sample: Label
Expand Down Expand Up @@ -502,7 +502,7 @@ def create_page_font_tab(self):
scroll_font.config(command=self.fontlist.yview)
self.fontlist.config(yscrollcommand=scroll_font.set)
font_size_title = Label(frame_font_param, text='Size :')
self.sizelist = DynOptionMenu(frame_font_param, self.font_size, None)
self.sizelist = OptionMenu(frame_font_param, self.font_size, None)
self.bold_toggle = Checkbutton(
frame_font_param, variable=self.font_bold,
onvalue=1, offvalue=0, text='Bold')
Expand Down Expand Up @@ -567,9 +567,9 @@ def load_font_cfg(self):
except ValueError:
pass
# Set font size dropdown.
self.sizelist.SetMenu(('7', '8', '9', '10', '11', '12', '13', '14',
'16', '18', '20', '22', '25', '29', '34', '40'),
font_size)
self.sizelist.set_menu(font_size, *('7', '8', '9', '10', '11', '12',
'13', '14', '16', '18', '20', '22',
'25', '29', '34', '40'))
# Set font weight.
self.font_bold.set(font_bold)
self.set_samples()
Expand Down Expand Up @@ -653,7 +653,7 @@ def create_page_highlight(self):
for the current theme. Radiobuttons builtin_theme_on and
custom_theme_on toggle var theme_source, which controls if the
current set of colors are from a builtin or custom theme.
DynOptionMenus builtinlist and customlist contain lists of the
OptionMenus builtinlist and customlist contain lists of the
builtin and custom themes, respectively, and the current item
from each list is stored in vars builtin_name and custom_name.

Expand Down Expand Up @@ -683,7 +683,7 @@ def create_page_highlight(self):
if the current selected color for a tag is for the foreground or
background.

DynOptionMenu targetlist contains a readable description of the
OptionMenu targetlist contains a readable description of the
tags applied to Python source within IDLE. Selecting one of the
tags from this list populates highlight_target, which has a callback
function set_highlight_target().
Expand Down Expand Up @@ -741,7 +741,7 @@ def create_page_highlight(self):
(*)highlight_sample: Text
(*)frame_color_set: Frame
(*)button_set_color: Button
(*)targetlist: DynOptionMenu - highlight_target
(*)targetlist: OptionMenu - highlight_target
frame_fg_bg_toggle: Frame
(*)fg_on: Radiobutton - fg_bg_toggle
(*)bg_on: Radiobutton - fg_bg_toggle
Expand All @@ -750,8 +750,8 @@ def create_page_highlight(self):
theme_type_title: Label
(*)builtin_theme_on: Radiobutton - theme_source
(*)custom_theme_on: Radiobutton - theme_source
(*)builtinlist: DynOptionMenu - builtin_name
(*)customlist: DynOptionMenu - custom_name
(*)builtinlist: OptionMenu - builtin_name
(*)customlist: OptionMenu - custom_name
(*)button_delete_custom: Button
(*)theme_message: Label
"""
Expand Down Expand Up @@ -830,9 +830,8 @@ def tem(event, elem=element):
self.button_set_color = Button(
self.frame_color_set, text='Choose Color for :',
command=self.get_color)
self.targetlist = DynOptionMenu(
self.frame_color_set, self.highlight_target, None,
highlightthickness=0) #, command=self.set_highlight_targetBinding
self.targetlist = OptionMenu(
self.frame_color_set, self.highlight_target, None)
self.fg_on = Radiobutton(
frame_fg_bg_toggle, variable=self.fg_bg_toggle, value=1,
text='Foreground', command=self.set_color_sample_binding)
Expand All @@ -851,9 +850,9 @@ def tem(event, elem=element):
self.custom_theme_on = Radiobutton(
frame_theme, variable=self.theme_source, value=0,
command=self.set_theme_type, text='a Custom Theme')
self.builtinlist = DynOptionMenu(
self.builtinlist = OptionMenu(
frame_theme, self.builtin_name, None, command=None)
self.customlist = DynOptionMenu(
self.customlist = OptionMenu(
frame_theme, self.custom_name, None, command=None)
self.butto 8000 n_delete_custom = Button(
frame_theme, text='Delete Custom Theme',
Expand Down Expand Up @@ -911,26 +910,26 @@ def load_theme_cfg(self):
if self.theme_source.get(): # Default theme selected.
item_list = idleConf.GetSectionList('default', 'highlight')
item_list.sort()
self.builtinlist.SetMenu(item_list, current_option)
self.builtinlist.set_menu(current_option, *item_list)
item_list = idleConf.GetSectionList('user', 'highlight')
item_list.sort()
if not item_list:
self.custom_theme_on.state(('disabled',))
self.custom_name.set('- no custom themes -')
else:
self.customlist.SetMenu(item_list, item_list[0])
self.customlist.set_menu(item_list[0], *item_list)
else: # User theme selected.
item_list = idleConf.GetSectionList('user', 'highlight')
item_list.sort()
self.customlist.SetMenu(item_list, current_option)
self.customlist.set_menu(current_option, *item_list)
item_list = idleConf.GetSectionList('default', 'highlight')
item_list.sort()
self.builtinlist.SetMenu(item_list, item_list[0])
self.builtinlist.set_menu(item_list[0], *item_list)
self.set_theme_type()
# Load theme element option menu.
theme_names = list(self.theme_elements.keys())
theme_names.sort(key=lambda x: self.theme_elements[x][1])
self.targetlist.SetMenu(theme_names, theme_names[0])
self.targetlist.set_menu(theme_names[0], *theme_names)
self.paint_theme_sample()
self.set_highlight_target()

Expand Down Expand Up @@ -1004,13 +1003,13 @@ def set_theme_type(self):
load_theme_cfg
"""
if self.theme_source.get():
self.builtinlist['state'] = 'normal'
self.customlist['state'] = 'disabled'
self.builtinlist.state(('!disabled',))
self.customlist.state(('disabled',))
self.button_delete_custom.state(('disabled',))
else:
self.builtinlist['state'] = 'disabled'
self.builtinlist.state(('disabled',))
self.custom_theme_on.state(('!disabled',))
self.customlist['state'] = 'normal'
self.customlist.state(('!disabled',))
self.button_delete_custom.state(('!disabled',))

def get_color(self):
Expand Down Expand Up @@ -1117,7 +1116,7 @@ def create_new(self, new_theme_name):
# Change GUI over to the new theme.
custom_theme_list = idleConf.GetSectionList('user', 'highlight')
custom_theme_list.sort()
self.customlist.SetMenu(custom_theme_list, new_theme_name)
self.customlist.set_menu(new_theme_name, *custom_theme_list)
self.theme_source.set(0)
self.set_theme_type()

Expand Down Expand Up @@ -1266,9 +1265,9 @@ def delete_custom(self):
item_list.sort()
if not item_list:
self.custom_theme_on.state(('disabled',))
self.customlist.SetMenu(item_list, '- no custom themes -')
self.customlist.set_menu('- no custom themes -', *item_list)
else:
self.customlist.SetMenu(item_list, item_list[0])
self.customlist.set_menu(item_list[0], *item_list)
# Revert to default theme.
self.theme_source.set(idleConf.defaultCfg['main'].Get('Theme', 'default'))
self.builtin_name.set(idleConf.defaultCfg['main'].Get('Theme', 'name'))
Expand Down Expand Up @@ -1301,7 +1300,7 @@ def create_page_keys(self):
lists and calls load_keys_list for the current keyset.
Radiobuttons builtin_keyset_on and custom_keyset_on toggle var
keyset_source, which controls if the current set of keybindings
are from a builtin or custom keyset. DynOptionMenus builtinlist
are from a builtin or custom keyset. OptionMenus builtinlist
and customlist contain lists of the builtin and custom keysets,
respectively, and the current item from each list is stored in
vars builtin_name and custom_name.
Expand Down Expand Up @@ -1353,9 +1352,9 @@ def create_page_keys(self):
frames[0]: Frame
(*)builtin_keyset_on: Radiobutton - var keyset_source
(*)custom_keyset_on: Radiobutton - var keyset_source
(*)builtinlist: DynOptionMenu - var builtin_name,
(*)builtinlist: OptionMenu - var builtin_name,
func keybinding_selected
(*)customlist: DynOptionMenu - var custom_name,
(*)customlist: OptionMenu - var custom_name,
func keybinding_selected
(*)keys_message: Label
frames[1]: Frame
Expand Down Expand Up @@ -1410,9 +1409,9 @@ def create_page_keys(self):
self.custom_keyset_on = Radiobutton(
frames[0], variable=self.keyset_source, value=0,
command=self.set_keys_type, text='Use a Custom Key Set')
self.builtinlist = DynOptionMenu(
self.builtinlist = OptionMenu(
frames[0], self.builtin_name, None, command=None)
self.customlist = DynOptionMenu(
self.customlist = OptionMenu(
frames[0], self.custom_name, None, command=None)
self.button_delete_custom_keys = Button(
frames[1], text='Delete Custom Key Set',
Expand Down Expand Up @@ -1458,21 +1457,21 @@ def load_key_cfg(self):
if self.keyset_source.get(): # Default theme selected.
item_list = idleConf.GetSectionList('default', 'keys')
item_list.sort()
self.builtinlist.SetMenu(item_list, current_option)
self.builtinlist.set_menu(current_option, *item_list)
item_list = idleConf.GetSectionList('user', 'keys')
item_list.sort()
if not item_list:
self.custom_keyset_on.state(('disabled',))
self.custom_name.set('- no custom keys -')
else:
self.customlist.SetMenu(item_list, item_list[0])
self.customlist.set_menu(item_list[0], *item_list)
else: # User key set selected.
item_list = idleConf.GetSectionList('user', 'keys')
item_list.sort()
self.customlist.SetMenu(item_list, current_option)
self.customlist.set_menu(current_option, *item_list)
item_list = idleConf.GetSectionList('default', 'keys')
item_list.sort()
self.builtinlist.SetMenu(item_list, idleConf.default_keys())
self.builtinlist.set_menu(idleConf.default_keys(), *item_list)
self.set_keys_type()
# Load keyset element list.
keyset_name = idleConf.CurrentKeys()
Expand Down Expand Up @@ -1529,13 +1528,13 @@ def var_changed_keybinding(self, *params):
def set_keys_type(self):
"Set available screen options based on builtin or custom key set."
if self.keyset_source.get():
self.builtinlist['state'] = 'normal'
self.customlist['state'] = 'disabled'
self.builtinlist.state(('!disabled',))
self.customlist.state(('disabled',))
self.button_delete_custom_keys.state(('disabled',))
else:
self.builtinlist['state'] = 'disabled'
self.builtinlist.state(('disabled',))
self.custom_keyset_on.state(('!disabled',))
self.customlist['state'] = 'normal'
self.customlist.state(('!disabled',))
self.button_delete_custom_keys.state(('!disabled',))

def get_new_keys(self):
Expand Down Expand Up @@ -1626,7 +1625,7 @@ def create_new_key_set(self, new_key_set_name):
# Change GUI over to the new key set.
custom_key_list = idleConf.GetSectionList('user', 'keys')
custom_key_list.sort()
self.customlist.SetMenu(custom_key_list, new_key_set_name)
self.customlist.set_menu(new_key_set_name, *custom_key_list)
self.keyset_source.set(0)
self.set_keys_type()

Expand Down Expand Up @@ -1697,9 +1696,9 @@ def delete_custom_keys(self):
item_list.sort()
if not item_list:
self.custom_keyset_on.state(('disabled',))
self.customlist.SetMenu(item_list, '- no custom keys -')
self.customlist.set_menu('- no custom keys -', *item_list)
else:
self.customlist.SetMenu(item_list, item_list[0])
self.customlist.set_menu(item_list[0], *item_list)
# Revert to default key set.
self.keyset_source.set(idleConf.defaultCfg['main']
.Get('Keys', 'default'))
Expand Down
Loading
0