MCPcopy Index your code
hub / github.com/python/cpython / load_theme_cfg

Method load_theme_cfg

Lib/idlelib/configdialog.py:716–765  ·  view source on GitHub ↗

Load current configuration settings for the theme options. Based on the theme_source toggle, the theme is set as either builtin or custom and the initial widget values reflect the current settings from idleConf. Attributes updated: theme_source: Set from

(self)

Source from the content-addressed store, hash-verified

714 self.theme_message.pack(side=TOP, fill=X, pady=5)
715
716 def load_theme_cfg(self):
717 """Load current configuration settings for the theme options.
718
719 Based on the theme_source toggle, the theme is set as
720 either builtin or custom and the initial widget values
721 reflect the current settings from idleConf.
722
723 Attributes updated:
724 theme_source: Set from idleConf.
725 builtinlist: List of default themes from idleConf.
726 customlist: List of custom themes from idleConf.
727 custom_theme_on: Disabled if there are no custom themes.
728 custom_theme: Message with additional information.
729 targetlist: Create menu from self.theme_elements.
730
731 Methods:
732 set_theme_type
733 paint_theme_sample
734 set_highlight_target
735 """
736 # Set current theme type radiobutton.
737 self.theme_source.set(idleConf.GetOption(
738 'main', 'Theme', 'default', type='bool', default=1))
739 # Set current theme.
740 current_option = idleConf.CurrentTheme()
741 # Load available theme option menus.
742 if self.theme_source.get(): # Default theme selected.
743 item_list = idleConf.GetSectionList('default', 'highlight')
744 item_list.sort()
745 self.builtinlist.SetMenu(item_list, current_option)
746 item_list = idleConf.GetSectionList('user', 'highlight')
747 item_list.sort()
748 if not item_list:
749 self.custom_theme_on.state(('disabled',))
750 self.custom_name.set('- no custom themes -')
751 else:
752 self.customlist.SetMenu(item_list, item_list[0])
753 else: # User theme selected.
754 item_list = idleConf.GetSectionList('user', 'highlight')
755 item_list.sort()
756 self.customlist.SetMenu(item_list, current_option)
757 item_list = idleConf.GetSectionList('default', 'highlight')
758 item_list.sort()
759 self.builtinlist.SetMenu(item_list, item_list[0])
760 self.set_theme_type()
761 # Load theme element option menu.
762 theme_names = list(self.theme_elements)
763 self.targetlist.SetMenu(theme_names, theme_names[0])
764 self.paint_theme_sample()
765 self.set_highlight_target()
766
767 def var_changed_builtin_name(self, *params):
768 """Process new builtin theme selection.

Callers 2

__init__Method · 0.95
test_load_theme_cfgMethod · 0.80

Calls 12

set_theme_typeMethod · 0.95
paint_theme_sampleMethod · 0.95
set_highlight_targetMethod · 0.95
listClass · 0.85
GetOptionMethod · 0.80
CurrentThemeMethod · 0.80
GetSectionListMethod · 0.80
SetMenuMethod · 0.80
setMethod · 0.45
getMethod · 0.45
sortMethod · 0.45
stateMethod · 0.45

Tested by 1

test_load_theme_cfgMethod · 0.64