mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Get default settings without Settings instance
Get the default settings of Dangezone for the current version, without having to instantiate the Settings class. Note that instantiating the Settings class also writes the settings to the underlying `settings.json` file, and there are cases where we don't want this behavior.
This commit is contained in:
parent
266addb5b7
commit
0ad489f80b
1 changed files with 6 additions and 3 deletions
|
@ -22,7 +22,12 @@ class Settings:
|
|||
self.settings_filename = os.path.join(
|
||||
self.dangerzone.appdata_path, "settings.json"
|
||||
)
|
||||
self.default_settings: Dict[str, Any] = {
|
||||
self.default_settings: Dict[str, Any] = self.generate_default_settings()
|
||||
self.load()
|
||||
|
||||
@classmethod
|
||||
def generate_default_settings(cls) -> Dict[str, Any]:
|
||||
return {
|
||||
"save": True,
|
||||
"archive": True,
|
||||
"ocr": True,
|
||||
|
@ -38,8 +43,6 @@ class Settings:
|
|||
"updater_errors": 0,
|
||||
}
|
||||
|
||||
self.load()
|
||||
|
||||
def get(self, key: str) -> Any:
|
||||
return self.settings[key]
|
||||
|
||||
|
|
Loading…
Reference in a new issue