start work on welcome wizard

This commit is contained in:
2025-06-10 16:23:29 +02:00
parent dbad7165bc
commit fdab4e5caa
6 changed files with 690 additions and 4 deletions

57
config/base_config.yaml Normal file
View File

@@ -0,0 +1,57 @@
default_apps: true
save_path: .
icon_path: icons/
openAI:
api_key:
model:
zotero:
api_key:
library_id:
library_type: user
database:
name: semesterapparate.db
path: .
temp: ~/AppData/Local/SAM/SemesterApparatsManager/Cache
mail:
smtp_server:
port:
sender:
printer_mail:
user_name:
use_user_name: true
password:
signature:
colors:
dark: '#6b6160'
light: '#000000'
warning: '#ff0000'
success: '#00ff00'
icons:
locked: locked.svg
logo: logo.ico
show_password: visibility_off.svg
hide_password: visibility_on.svg
settings: settings.svg
today: calendar_today.svg
save: save.svg
edit_note: edit_note.svg
warning: warning.svg
error: error.svg
mail: mail.svg
semester: semester.svg
template_fail: test_fail.svg
offAction: shutdown.svg
info: info.svg
help: help.svg
close: close.svg
notification: notification.svg
valid_true: check_success.svg
valid_false: check_fail.svg
edit: edit.svg
important_warn: red_warn.svg
person: person_add.svg
database: database.svg
icons: icons.svg
api: api.svg
print: print.svg
db_search: db_search.svg

View File

@@ -42,9 +42,9 @@ class Database:
def __post_init__(self):
if isinstance(self.path, str):
self.path = Path(self.path)
self.path = Path(self.path).expanduser()
if isinstance(self.temp, str):
self.temp = Path(self.temp)
self.temp = Path(self.temp).expanduser()
@dataclass
class Mail:
@@ -137,7 +137,7 @@ class Config:
"""
_config: Optional[DictConfig] = None
config_exists: bool = True
def __init__(self, config_path: str):
"""
Loads the configuration file and stores it for future access.
@@ -157,9 +157,14 @@ class Config:
base_config = base_file.read()
with open(config_path, "w") as config_file:
config_file.write(base_config)
self.config_exists = False
self._config = OmegaConf.load(config_path)
self.config_path = config_path
@property
def exists(self) -> bool:
return self.config_exists
def save(self):
"""
Saves the current configuration to the file.
@@ -169,6 +174,12 @@ class Config:
"""
OmegaConf.save(self._config, self.config_path)
def reload(self):
"""
Reloads the configuration from the file.
"""
self._config = OmegaConf.load(self.config_path)
@property
def zotero(self):
return Zotero(**self._config.zotero)