Skip to content

Commit

Permalink
Handle step reset on render if a process is loaded (steps already con…
Browse files Browse the repository at this point in the history
…firmed)
  • Loading branch information
edan-bainglass committed Nov 2, 2024
1 parent c5e1165 commit 2457e8d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/aiidalab_qe/app/configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ def render(self):

self.rendered = True

if self._model.confirmed: # loaded from a process
return

# NOTE technically not necessary, as an update is triggered
# by a structure change. However, this ensures that if a user
# decides to visit this step prior to setting the structure,
# the step will be updated on render to show reasonable defaults.
# TODO remove if we decide to "disable" steps past unconfirmed steps!
self._model.update()

def is_saved(self):
Expand Down
10 changes: 7 additions & 3 deletions src/aiidalab_qe/app/structure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ def render(self):
"Download",
],
)
# A structure may have been loaded from a structure,
# so we assign it here as the manager's input structure.
self.manager.input_structure = self._model.structure

if self._model.confirmed: # loaded from a process
# NOTE important to do this prior to setting up the links
# to avoid an override of the structure in the model,
# which in turn would trigger a reset of the model
self.manager.input_structure = self._model.structure

ipw.dlink(
(self.manager, "structure_node"),
(self._model, "structure"),
Expand Down

0 comments on commit 2457e8d

Please sign in to comment.