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

Method __init__

PySimpleGUI/PySimpleGUI.py:22342–22379  ·  view source on GitHub ↗

User Settings :param filename: The name of the file to use. Can be a full path and filename or just filename :type filename: (str or None) :param path: The folder that the settings file will be stored in. Do not include

(self, filename=None, path=None, silent_on_error=False, autosave=True, use_config_file=None, convert_bools_and_none=True)

Source from the content-addressed store, hash-verified

22340 _default_for_function_interface = None # type: UserSettings
22341
22342 def __init__(self, filename=None, path=None, silent_on_error=False, autosave=True, use_config_file=None, convert_bools_and_none=True):
22343 """
22344 User Settings
22345
22346 :param filename: The name of the file to use. Can be a full path and filename or just filename
22347 :type filename: (str or None)
22348 :param path: The folder that the settings file will be stored in. Do not include the filename.
22349 :type path: (str or None)
22350 :param silent_on_error: If True errors will not be reported
22351 :type silent_on_error: (bool)
22352 :param autosave: If True the settings file is saved after every update
22353 :type autosave: (bool)
22354 :param use_config_file: If True then the file format will be a config.ini rather than json
22355 :type use_config_file: (bool)
22356 :param convert_bools_and_none: If True then "True", "False", "None" will be converted to the Python values True, False, None when using INI files. Default is TRUE
22357 :type convert_bools_and_none: (bool)
22358 """
22359
22360 self.path = path
22361 self.filename = filename
22362 self.full_filename = None
22363 self.dict = {}
22364 self.default_value = None
22365 self.silent_on_error = silent_on_error
22366 self.autosave = autosave
22367 if filename is not None and filename.endswith('.ini') and use_config_file is None:
22368 warnings.warn('[UserSettings] You have specified a filename with .ini extension but did not set use_config_file. Setting use_config_file for you.', UserWarning)
22369 use_config_file = True
22370 self.use_config_file = use_config_file
22371 # self.retain_config_comments = retain_config_comments
22372 self.convert_bools = convert_bools_and_none
22373 if use_config_file:
22374 self.config = configparser.ConfigParser()
22375 self.config.optionxform = str
22376 # self.config_dict = {}
22377 self.section_class_dict = {} # type: dict[_SectionDict]
22378 if filename is not None or path is not None:
22379 self.load(filename=filename, path=path)
22380
22381 ########################################################################################################
22382 ## FIRST is the _SectionDict helper class

Callers

nothing calls this directly

Calls 1

loadMethod · 0.95

Tested by

no test coverage detected