@@ -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