Skip to content

Commit c1740e1

Browse files
author
nix
committed
save post processing per metric
1 parent d127e37 commit c1740e1

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

funscript_editor/ui/postprocessing.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,15 @@ def add_custom_tab(self):
199199
self.tabs.addTab(self.tabs_content[tab_name]["main"], tab_name)
200200

201201
def load_prev_ui_settings(self):
202-
if not os.path.exists(self.ui_settings_file):
203-
self.prev_ui_settings = {}
204-
else:
205-
with open(self.ui_settings_file, "r") as f:
206-
self.prev_ui_settings = json.load(f)
202+
self.all_prev_ui_settings = {}
203+
self.prev_ui_settings = {}
207204

205+
if os.path.exists(self.ui_settings_file):
206+
with open(self.ui_settings_file, "r") as f:
207+
self.all_prev_ui_settings = json.load(f)
208+
if self.metric in self.all_prev_ui_settings:
209+
self.prev_ui_settings = self.all_prev_ui_settings[self.metric]
210+
208211
if "selected" not in self.prev_ui_settings:
209212
self.prev_ui_settings["selected"] = ""
210213

@@ -228,10 +231,13 @@ def save_ui_settings(self):
228231
settings["tabs"][tab_name][widget] = self.tabs_content[tab_name]["widgets"][widget].currentText()
229232
else:
230233
print("ERROR: widget", widget, "not implemented")
231-
234+
235+
all_ui_settings = self.all_prev_ui_settings
236+
all_ui_settings[self.metric] = settings
237+
232238
try:
233239
with open(self.ui_settings_file, "w") as f:
234-
json.dump(settings, f)
240+
json.dump(all_ui_settings, f)
235241
except:
236242
print("Warning: failed to save post processing settings")
237243

0 commit comments

Comments
 (0)