theme switch

This commit is contained in:
BarsTiger
2022-05-29 15:36:08 +03:00
parent 8bc4397805
commit 41523cd1c5
6 changed files with 330 additions and 291 deletions

View File

@@ -3,17 +3,21 @@ import json
class Settings:
@staticmethod
def fix() -> None:
settings = {
def default():
return {
"animation": "InOutQuart",
"theme": "Black acrylic",
"app_id": None,
"key": None,
"secret": None,
"cluster": None,
"client_id": None
}
@staticmethod
def fix() -> None:
with open("data/settings.json", "w") as file:
json.dump(settings, file)
json.dump(Settings.default(), file)
@staticmethod
def get_settings() -> dict:
@@ -61,3 +65,11 @@ class Settings:
json.dump(settings, file)
return settings
@staticmethod
def get(key: str) -> any:
try:
return Settings.get_settings()[key]
except KeyError:
Settings.update(key, Settings.default()[key])
return Settings.default()[key]