Skip to content

Commit

Permalink
Always rerender structure results to avoid NGL viewer issue
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Dec 19, 2024
1 parent d67bbcc commit 1aa0d8e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ class StructureResults(ResultsPanel[StructureResultsModel]):
identifier = "structure"

def _render(self):
widget = StructureDataViewer(structure=self._model.outputs.structure)
self.children = [widget]
self.widget = StructureDataViewer(structure=self._model.outputs.structure)
self.children = [self.widget]
5 changes: 4 additions & 1 deletion src/aiidalab_qe/common/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,10 @@ def _on_load_results_click(self, _):
def _load_results(self):
self.children = [self.loading_message]
self._render()
self.rendered = True
# HACK if this is the structure results panel, we want to
# always rerender to refresh the NGL viewer, which does not
# handle resize correctly.
self.rendered = self._model.identifier != "structure"
self._post_render()
self.has_controls = False

Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugins_bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_result(generate_qeapp_workchain):
model = BandsResultsModel()
model.process_uuid = workchain.node.uuid
result = BandsResultsPanel(model=model)
result.render()
result._render()

widget = result.children[0]
model = widget._model
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugins_pdos.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_result(generate_qeapp_workchain):
model = PdosResultsModel()
model.process_uuid = workchain.node.uuid
result = PdosResultsPanel(model=model)
result.render()
result._render()

widget = result.children[0]
model = widget._model
Expand Down

0 comments on commit 1aa0d8e

Please sign in to comment.