Skip to content

Commit

Permalink
Handle circular structure link in step 1
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Oct 30, 2024
1 parent 15e1b6e commit 2a301e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
7 changes: 0 additions & 7 deletions src/aiidalab_qe/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,6 @@ def _on_configuration_confirmation_change(self, _):
def _render_step(self, step_index):
step = self.steps[step_index][1]
step.render()
if step is self.structure_step:
# HACK to fix the rendering of the ngl viewer
# Reason: If a process is loaded prior to the rendering of the
# structure step, the ngl viewer will assume a size of zero.
# This code will reset the size and render the selected structure.
self.structure_step.manager.viewer._viewer.handle_resize()
self.structure_step.manager.viewer._viewer.control.zoom(0)

def _update_blockers(self):
self.submit_model.external_submission_blockers = [
Expand Down
12 changes: 4 additions & 8 deletions src/aiidalab_qe/app/structure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def render(self):

# HACK structure manager resets the structure node on initialization,
# causing the structure in the model (if exists) to reset. To avoid
# this issue, we store the structure in a variable and reassign it
# to the model after the initialization of the structure manager.
# this issue, we store the structure in a variable and assign it to
# the manager's viewer after the initialization of the structure manager.
# TODO fix this issue in the structure manager and remove this hack!

structure = self._model.structure
Expand All @@ -111,11 +111,6 @@ def render(self):
"Download",
],
)
ipw.dlink(
(self._model, "structure"),
(self.manager, "structure"),
lambda structure: structure.get_ase() if structure else None,
)
ipw.dlink(
(self.manager, "structure_node"),
(self._model, "structure"),
Expand All @@ -125,7 +120,8 @@ def render(self):
(self.manager.output, "value"),
)

self._model.structure = structure
if structure: # loaded from process
self.manager.viewer.structure = structure.get_ase() # TODO why ase?

self.structure_name_text = ipw.Text(
placeholder="[No structure selected]",
Expand Down

0 comments on commit 2a301e6

Please sign in to comment.