only rewrite ui-config when there is change

and a typo
This commit is contained in:
w-e-w 2023-12-18 15:27:41 +09:00
parent de03882d6c
commit 10945aa41a
2 changed files with 4 additions and 2 deletions

View File

@ -1086,6 +1086,7 @@ def create_ui():
) )
loadsave = ui_loadsave.UiLoadsave(cmd_opts.ui_config_file) loadsave = ui_loadsave.UiLoadsave(cmd_opts.ui_config_file)
ui_settings_from_file = loadsave.ui_settings.copy()
settings = ui_settings.UiSettings() settings = ui_settings.UiSettings()
settings.create_ui(loadsave, dummy_component) settings.create_ui(loadsave, dummy_component)
@ -1146,6 +1147,7 @@ def create_ui():
modelmerger_ui.setup_ui(dummy_component=dummy_component, sd_model_checkpoint_component=settings.component_dict['sd_model_checkpoint']) modelmerger_ui.setup_ui(dummy_component=dummy_component, sd_model_checkpoint_component=settings.component_dict['sd_model_checkpoint'])
if ui_settings_from_file != loadsave.ui_settings:
loadsave.dump_defaults() loadsave.dump_defaults()
demo.ui_loadsave = loadsave demo.ui_loadsave = loadsave

View File

@ -144,7 +144,7 @@ class UiLoadsave:
json.dump(current_ui_settings, file, indent=4, ensure_ascii=False) json.dump(current_ui_settings, file, indent=4, ensure_ascii=False)
def dump_defaults(self): def dump_defaults(self):
"""saves default values to a file unless tjhe file is present and there was an error loading default values at start""" """saves default values to a file unless the file is present and there was an error loading default values at start"""
if self.error_loading and os.path.exists(self.filename): if self.error_loading and os.path.exists(self.filename):
return return