1
1
Eric Tröbs 4 жил өмнө
parent
commit
2eb162bdf8

+ 8 - 1
pycs/ApplicationStatus.py

@@ -1,4 +1,4 @@
-from json import load
+from json import load, dump
 from os.path import exists
 
 from pycs.observable import ObservableDict
@@ -24,3 +24,10 @@ class ApplicationStatus(ObservableDict):
             'projects': [],
             'jobs': []
         })
+
+        # subscribe to settings change to write it to file
+        self['settings'].subscribe(self.__write_settings_to_file)
+
+    def __write_settings_to_file(self, settings):
+        with open(self.__path_to_settings_json, 'w') as settings_json:
+            dump(settings, settings_json, indent=4)