MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / settings_save

Method settings_save

PySimpleGUI/PySimpleGUI.py:11141–11161  ·  view source on GitHub ↗

Saves settings to settings file using the values dictionary that is passed in. If all of the values in the dictionary are None, then it will not be saved :param values: Dictionary of values to potentially save :type values: (Dict)

(self, values)

Source from the content-addressed store, hash-verified

11139
11140
11141 def settings_save(self, values):
11142 """
11143 Saves settings to settings file using the values dictionary that is passed in.
11144 If all of the values in the dictionary are None, then it will not be saved
11145 :param values: Dictionary of values to potentially save
11146 :type values: (Dict)
11147 """
11148 if values is None: # sometimes users may accidently pass in None, so just ignore it
11149 return
11150 # if all values in the value dictionary are None, then assume the windows was closed
11151 # and no values should be saved
11152 if all(v is None for v in values.values()):
11153 return
11154
11155 for key, value in values.items():
11156 try:
11157 element = self.find_element(key)
11158 if element.setting is not None:
11159 user_settings_set_entry(key, value)
11160 except Exception as e:
11161 _error_popup_with_traceback('Error saving settings', e)
11162
11163 def settings_restore(self):
11164 """

Callers 3

settings_windowFunction · 0.95
mainFunction · 0.80

Calls 4

find_elementMethod · 0.95
user_settings_set_entryFunction · 0.85
valuesMethod · 0.80

Tested by

no test coverage detected