gui.settings.load_settings

gui.settings.load_settings(path=None)

Read the settings; a missing or damaged file gives the defaults.

Parameters

Name Type Description Default
path Path | None The settings file. Defaults to settings_path(). None

Returns

Name Type Description
Settings Settings The stored values, with unknown keys ignored and bad values replaced by their defaults.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from spotregen.gui.settings import Settings, load_settings, save_settings

with TemporaryDirectory() as tmp:
    path = Path(tmp) / "settings.json"
    print(load_settings(path))
    save_settings(Settings(font_scale=1.5), path)
    print(load_settings(path).font_scale)
Settings(recent=(), font_scale=1.0, editor='', auto_check=True)
1.5