diff --git a/capture_gui/app.py b/capture_gui/app.py index c355695..ee1a9fb 100644 --- a/capture_gui/app.py +++ b/capture_gui/app.py @@ -648,26 +648,28 @@ def _store_widget_configuration(self): """Store all used widget settings in the local json file""" inputs = self.get_inputs(as_preset=False) + path = self.settingfile - with open(self.settingfile, "w") as f: - log.debug("Writing JSON file: {0}".format(f)) + with open(path, "w") as f: + log.debug("Writing JSON file: {0}".format(path)) json.dump(inputs, f, sort_keys=True, indent=4, separators=(',', ': ')) def _read_widget_configuration(self): """Read the stored widget inputs""" + inputs = {} + path = self.settingfile - if not os.path.isfile(self.settingfile) or \ - os.stat(self.settingfile).st_size == 0: + if not os.path.isfile(path) or os.stat(path).st_size == 0: return inputs - try: - with open(self.settingfile, "r") as f: - log.debug("Reading JSON file: {0}".format(f)) + with open(path, "r") as f: + log.debug("Reading JSON file: {0}".format(path)) + try: inputs = json.load(f) - except ValueError as error: - log.error(str(error)) + except ValueError as error: + log.error(str(error)) return inputs