Skip to content

Commit

Permalink
Run model updates on startup to catch up app to default states
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Oct 30, 2024
1 parent 61f6d35 commit 9233fe4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
13 changes: 5 additions & 8 deletions src/aiidalab_qe/app/configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,21 @@ def __init__(self, model: ConfigurationModel, **kwargs):
""",
)

self.settings: dict[str, SettingsPanel] = {}

workchain_model = WorkChainModel()
self.workchain_settings = WorkChainSettings(model=workchain_model)
self._model.add_model("workchain", workchain_model)

advanced_model = AdvancedModel()
self._model.add_model("advanced", advanced_model)

self._fetch_plugin_settings()

self.workchain_settings = WorkChainSettings(model=workchain_model)
self.advanced_settings = AdvancedSettings(model=advanced_model)
self._model.add_model("advanced", advanced_model)

self.settings |= {
self.settings = {
"workchain": self.workchain_settings,
"advanced": self.advanced_settings,
}

self._fetch_plugin_settings()

self.rendered = False

def render(self):
Expand Down
9 changes: 4 additions & 5 deletions src/aiidalab_qe/app/configuration/advanced/advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,20 @@ def __init__(self, model: AdvancedModel, **kwargs):
)

smearing_model = SmearingModel()
self.smearing = SmearingSettings(model=smearing_model)
model.add_model("smearing", smearing_model)

magnetization_model = MagnetizationModel()
self.magnetization = MagnetizationSettings(model=magnetization_model)
model.add_model("magnetization", magnetization_model)

hubbard_model = HubbardModel()
self.hubbard = HubbardSettings(model=hubbard_model)
model.add_model("hubbard", hubbard_model)

pseudos_model = PseudosModel()
model.add_model("pseudos", pseudos_model)

self.smearing = SmearingSettings(model=smearing_model)
self.magnetization = MagnetizationSettings(model=magnetization_model)
self.hubbard = HubbardSettings(model=hubbard_model)
self.pseudos = PseudoSettings(model=pseudos_model)
model.add_model("pseudos", pseudos_model)

def render(self):
if self.rendered:
Expand Down

0 comments on commit 9233fe4

Please sign in to comment.