gui.settings.save_settings(settings, path=None)
Write the settings as JSON, creating the directory.
Parameters
| settings |
Settings |
The values to store. |
required |
| path |
Path | None |
The settings file. Defaults to settings_path(). |
None |
Returns
| Path |
Path |
The file written. |
Examples
from pathlib import Path
from tempfile import TemporaryDirectory
from spotregen.gui.settings import Settings, save_settings
with TemporaryDirectory() as tmp:
target = save_settings(Settings(), Path(tmp) / "cfg" / "settings.json")
print(target.read_text())
{
"recent": [],
"font_scale": 1.0,
"editor": "",
"auto_check": true
}