Skip to content

Commit

Permalink
Handle process-loaded structure assignment more cleanly
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Nov 1, 2024
1 parent 074fa55 commit 4b32281
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/aiidalab_qe/app/structure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ def render(self):
plugin_editors = get_entry_items("aiidalab_qe.properties", "editor")
editors.extend([editor() for editor in plugin_editors.values()])

# 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 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

self.manager = StructureManagerWidget(
importers=importers,
editors=editors,
Expand All @@ -111,6 +103,9 @@ 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
ipw.dlink(
(self.manager, "structure_node"),
(self._model, "structure"),
Expand All @@ -120,9 +115,6 @@ def render(self):
(self.manager.output, "value"),
)

if structure: # loaded from process
self.manager.viewer.structure = structure

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

0 comments on commit 4b32281

Please sign in to comment.