add files

This commit is contained in:
WorldTeacher
2024-01-26 08:28:01 +01:00
parent dd9ee24a8f
commit 0a9818940c
110 changed files with 21563 additions and 0 deletions

26
src/backend/settings.py Normal file
View File

@@ -0,0 +1,26 @@
from dataclasses import dataclass, field
import yaml
@dataclass
class Settings:
"""Settings for the app."""
save_path: str
database_name: str
database_path: str
bib_id: str
default_apps: bool = True
custom_applications: list[dict] = field(default_factory=list)
def save_settings(self):
"""Save the settings to the config file."""
with open("config.yaml", "w") as f:
yaml.dump(self.__dict__, f)
def load_settings(self):
"""Load the settings from the config file."""
with open("config.yaml", "r") as f:
data = yaml.safe_load(f)
return data