MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / delete_entry

Method delete_entry

PySimpleGUI/PySimpleGUI.py:22768–22798  ·  view source on GitHub ↗

Deletes an individual entry. If no filename has been specified up to this point, then a default filename will be used. After value has been deleted, the settings file is written to disk. :param key: Setting to be deleted. Can be any valid dictionary key type (i.e.

(self, key, section=None, silent_on_error=None)

Source from the content-addressed store, hash-verified

22766 return False
22767
22768 def delete_entry(self, key, section=None, silent_on_error=None):
22769 """
22770 Deletes an individual entry. If no filename has been specified up to this point,
22771 then a default filename will be used.
22772 After value has been deleted, the settings file is written to disk.
22773
22774 :param key: Setting to be deleted. Can be any valid dictionary key type (i.e. must be hashable)
22775 :type key: (Any)
22776 :param silent_on_error: Determines if error should be shown. This parameter overrides the silent on error setting for the object.
22777 :type silent_on_error: (bool)
22778 """
22779 if self.full_filename is None:
22780 self.set_location()
22781 self.read()
22782 if not self.use_config_file: # Is using JSON file
22783 if key in self.dict:
22784 del self.dict[key]
22785 if self.autosave:
22786 self.save()
22787 else:
22788 if silent_on_error is False or (silent_on_error is not True and not self.silent_on_error):
22789 _error_popup_with_traceback('User Settings delete_entry Warning - key', key, ' not found in settings')
22790
22791 else:
22792 if section is not None:
22793 section_dict = self.get(section)
22794 # print(f'** Trying to delete an entry with a config file in use ** id of section_dict = {id(section_dict)}')
22795 # section_dict = self.section_class_dict[section]
22796 del self.get(section)[key]
22797 # del section_dict[key]
22798 # del section_dict[key]
22799
22800 def delete_section(self, section):
22801 """

Callers 2

__delitem__Method · 0.95

Calls 5

set_locationMethod · 0.95
readMethod · 0.95
saveMethod · 0.95
getMethod · 0.95

Tested by

no test coverage detected