|
35 | 35 | from classes.json_data import JsonDataStore
|
36 | 36 |
|
37 | 37 |
|
38 |
| -def get_settings(): |
39 |
| - """ Get the current application's settings instance """ |
40 |
| - return SettingStore.get_app().get_settings() |
41 |
| - |
42 |
| - |
43 | 38 | class SettingStore(JsonDataStore):
|
44 | 39 | """ This class only allows setting pre-existing keys taken from default settings file, and merges user settings
|
45 | 40 | on load, assumes default OS dir."""
|
46 | 41 |
|
47 |
| - @classmethod |
48 |
| - def save_app(cls, app_reference): |
49 |
| - cls._app = app_reference |
50 |
| - |
51 |
| - @classmethod |
52 |
| - def get_app(cls): |
53 |
| - if hasattr(cls, "_app"): |
54 |
| - return cls._app |
55 |
| - return None |
56 |
| - |
57 | 42 | def __init__(self, parent=None):
|
58 | 43 | super().__init__()
|
59 | 44 | # Also keep track of our parent, if defined
|
60 |
| - if parent: |
61 |
| - SettingStore.save_app(parent) |
| 45 | + self.app = parent |
62 | 46 | # Set the data type name for logging clarity (base class functions use this variable)
|
63 | 47 | self.data_type = "user settings"
|
64 | 48 | self.settings_filename = "openshot.settings"
|
@@ -111,10 +95,9 @@ def load(self):
|
111 | 95 | except Exception as ex:
|
112 | 96 | log.error("Error loading settings file: %s", ex)
|
113 | 97 | user_settings = {}
|
114 |
| - app = SettingStore.get_app() |
115 |
| - if app: |
| 98 | + if self.app: |
116 | 99 | # We have a parent, ask to show a message box
|
117 |
| - app.settings_load_error(file_path) |
| 100 | + self.app.settings_load_error(file_path) |
118 | 101 |
|
119 | 102 | # Merge default and user settings, excluding settings not in default, Save settings
|
120 | 103 | self._data = self.merge_settings(default_settings, user_settings)
|
|
0 commit comments