diff --git a/src/aiidalab_qe/app/main.py b/src/aiidalab_qe/app/main.py index 9816e0c16..179bbda31 100644 --- a/src/aiidalab_qe/app/main.py +++ b/src/aiidalab_qe/app/main.py @@ -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 = [ diff --git a/src/aiidalab_qe/app/structure/__init__.py b/src/aiidalab_qe/app/structure/__init__.py index 5a4a48fb9..97caed840 100644 --- a/src/aiidalab_qe/app/structure/__init__.py +++ b/src/aiidalab_qe/app/structure/__init__.py @@ -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 @@ -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"), @@ -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]",