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

Method delete_custom

Lib/idlelib/configdialog.py:1063–1108  ·  view source on GitHub ↗

Handle event to delete custom theme. The current theme is deactivated and the default theme is activated. The custom theme is permanently removed from the config file. Attributes accessed: custom_name Attributes updated: custom_them

(self)

Source from the content-addressed store, hash-verified

1061 return messagebox.askyesno(*args, **kwargs)
1062
1063 def delete_custom(self):
1064 """Handle event to delete custom theme.
1065
1066 The current theme is deactivated and the default theme is
1067 activated. The custom theme is permanently removed from
1068 the config file.
1069
1070 Attributes accessed:
1071 custom_name
1072
1073 Attributes updated:
1074 custom_theme_on
1075 customlist
1076 theme_source
1077 builtin_name
1078
1079 Methods:
1080 deactivate_current_config
1081 save_all_changed_extensions
1082 activate_config_changes
1083 set_theme_type
1084 """
1085 theme_name = self.custom_name.get()
1086 delmsg = 'Are you sure you wish to delete the theme %r ?'
1087 if not self.askyesno(
1088 'Delete Theme', delmsg % theme_name, parent=self):
1089 return
1090 self.cd.deactivate_current_config()
1091 # Remove theme from changes, config, and file.
1092 changes.delete_section('highlight', theme_name)
1093 # Reload user theme list.
1094 item_list = idleConf.GetSectionList('user', 'highlight')
1095 item_list.sort()
1096 if not item_list:
1097 self.custom_theme_on.state(('disabled',))
1098 self.customlist.SetMenu(item_list, '- no custom themes -')
1099 else:
1100 self.customlist.SetMenu(item_list, item_list[0])
1101 # Revert to default theme.
1102 self.theme_source.set(idleConf.defaultCfg['main'].Get('Theme', 'default'))
1103 self.builtin_name.set(idleConf.defaultCfg['main'].Get('Theme', 'name'))
1104 # User can't back out of these changes, they must be applied now.
1105 changes.save_all()
1106 self.extpage.save_all_changed_extensions()
1107 self.cd.activate_config_changes()
1108 self.set_theme_type()
1109
1110
1111class KeysPage(Frame):

Callers

nothing calls this directly

Calls 14

askyesnoMethod · 0.95
set_theme_typeMethod · 0.95
delete_sectionMethod · 0.80
GetSectionListMethod · 0.80
SetMenuMethod · 0.80
GetMethod · 0.80
save_allMethod · 0.80
getMethod · 0.45
sortMethod · 0.45
stateMethod · 0.45

Tested by

no test coverage detected