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

Method delete_custom_keys

Lib/idlelib/configdialog.py:1510–1542  ·  view source on GitHub ↗

Handle event to delete a custom key set. Applying the delete deactivates the current configuration and reverts to the default. The custom key set is permanently deleted from the config file.

(self)

Source from the content-addressed store, hash-verified

1508 return messagebox.askyesno(*args, **kwargs)
1509
1510 def delete_custom_keys(self):
1511 """Handle event to delete a custom key set.
1512
1513 Applying the delete deactivates the current configuration and
1514 reverts to the default. The custom key set is permanently
1515 deleted from the config file.
1516 """
1517 keyset_name = self.custom_name.get()
1518 delmsg = 'Are you sure you wish to delete the key set %r ?'
1519 if not self.askyesno(
1520 'Delete Key Set', delmsg % keyset_name, parent=self):
1521 return
1522 self.cd.deactivate_current_config()
1523 # Remove key set from changes, config, and file.
1524 changes.delete_section('keys', keyset_name)
1525 # Reload user key set list.
1526 item_list = idleConf.GetSectionList('user', 'keys')
1527 item_list.sort()
1528 if not item_list:
1529 self.custom_keyset_on.state(('disabled',))
1530 self.customlist.SetMenu(item_list, '- no custom keys -')
1531 else:
1532 self.customlist.SetMenu(item_list, item_list[0])
1533 # Revert to default key set.
1534 self.keyset_source.set(idleConf.defaultCfg['main']
1535 .Get('Keys', 'default'))
1536 self.builtin_name.set(idleConf.defaultCfg['main'].Get('Keys', 'name')
1537 or idleConf.default_keys())
1538 # User can't back out of these changes, they must be applied now.
1539 changes.save_all()
1540 self.extpage.save_all_changed_extensions()
1541 self.cd.activate_config_changes()
1542 self.set_keys_type()
1543
1544
1545class WinPage(Frame):

Callers

nothing calls this directly

Calls 15

askyesnoMethod · 0.95
set_keys_typeMethod · 0.95
delete_sectionMethod · 0.80
GetSectionListMethod · 0.80
SetMenuMethod · 0.80
GetMethod · 0.80
default_keysMethod · 0.80
save_allMethod · 0.80
getMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected