update deps, change config to restore changes, color overdue red in main, in loan color based on state

This commit is contained in:
2025-01-13 11:14:27 +01:00
parent 148adb937d
commit daf8d87b9d
10 changed files with 1085 additions and 40 deletions

View File

@@ -148,10 +148,37 @@ class Config:
raise KeyError(f"Option {keys[0]} not found in configuration")
else:
self._config[key] = value
def get_changes(self, other):
# compare self to other, return changes
changes = {}
for key in self._config:
if self._config[key] != other[key]:
changes[key] = self._config[key]
return changes
if __name__ == "__main__":
cfg = Config("config/settings.yaml")
#print(cfg.database.path)
cfg.database.path = "nopathhere"
#print(cfg.database.path)
cfg.save()
#cfg.updateValue("database.path", "Test")
other = {
"institution_name": "Test",
"default_loan_duration": 7,
"inactive_user_deletion": 365,
"database": {
"path": "./database",
"name": "library.db",
"backupLocation": "./backup",
"do_backup": True,
},
"report": {"generate_report": True, "path": "./report", "report_day": 0},
"shortcuts": [
{"name": "Rueckgabemodus", "default": "F5", "current": "F5"},
{"name": "Nutzer", "default": "F6", "current": "F6"},
{"name": "Hilfe", "default": "F1", "current": "F1"},
{"name": "Bericht_erstellen", "default": "F7", "current": "F7"},
{"name": "Ausleihhistorie", "default": "F8", "current": "F8"},
],
"advanced_refresh": False,
"catalogue": True,
"debug": True,
"documentation": True,
}
print(cfg.get_changes(other))