Skip to content
Merged
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
3 changes: 2 additions & 1 deletion Lib/idlelib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,8 @@ class ConfigChanges(dict):
add_option: Add option and value to changes.
save_option: Save option and value to config parser.
save_all: Save all the changes to the config parser and file.
delete_section: Delete section if it exists.
delete_section: If section exists,
delete from changes, userCfg, and file.
clear: Clear all changes by clearing each page.
"""
def __init__(self):
Expand Down
4 changes: 2 additions & 2 deletions Lib/idlelib/configdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ def delete_custom_keys(self):
return
self.deactivate_current_config()
# Remove key set from changes, config, and file.
changes.remove(keyset_name)
changes.delete_section('keys', keyset_name)
# Reload user key set list.
item_list = idleConf.GetSectionList('user', 'keys')
item_list.sort()
Expand Down Expand Up @@ -873,7 +873,7 @@ def delete_custom_theme(self):
return
self.deactivate_current_config()
# Remove theme from changes, config, and file.
changes.delete_section('highlight')
changes.delete_section('highlight', theme_name)
# Reload user theme list.
item_list = idleConf.GetSectionList('user', 'highlight')
item_list.sort()
Expand Down
7 changes: 5 additions & 2 deletions Lib/idlelib/idle_test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def test_save_added(self):
userkeys.remove_section('Ksec')

def test_save_help(self):
# Any change to HelpFiles overwrites entire section.
changes = self.changes
changes.save_option('main', 'HelpFiles', 'IDLE', 'idledoc')
changes.add_option('main', 'HelpFiles', 'ELDI', 'codeldi')
Expand All @@ -207,10 +208,12 @@ def test_delete_section(self):
changes.delete_section('main', 'fake') # Test no exception.
self.assertEqual(changes, self.loaded) # Test nothing deleted.
for cfgtype, section in (('main', 'Msec'), ('keys', 'Ksec')):
testcfg[cfgtype].SetOption(section, 'name', 'value')
changes.delete_section(cfgtype, section)
with self.assertRaises(KeyError):
changes[cfgtype][section] # Test section gone.
# TODO Test change to userkeys and maybe save call.
changes[cfgtype][section] # Test section gone from changes
testcfg[cfgtype][section] # and from mock userCfg.
# TODO test for save call.

def test_clear(self):
changes = self.load()
Expand Down