theme menu initial implementation

bump to 0.5.7a1

Issue #19
This commit is contained in:
2023-11-15 23:34:53 +00:00
parent bde9020471
commit cb82033e1c
5 changed files with 75 additions and 15 deletions

View File

@@ -0,0 +1,34 @@
import json
from pathlib import Path
SETTINGS = Path.cwd() / "settings.json"
def config_from_json():
data = {}
if not SETTINGS.exists():
return data
with open(SETTINGS, "r") as f:
data = json.load(f)
return data
config = config_from_json()
def get(key, default=None):
if key in config:
return config[key]
return default
def set(key, value):
config[key] = value
with open(SETTINGS, "w") as f:
json.dump(config, f)
def delete(key):
del config[key]
with open(SETTINGS, "w") as f:
json.dump(config, f)