From 709dcd07dd7155ce05d7a7a7fdaea4ab15719fdc Mon Sep 17 00:00:00 2001 From: Edan Bainglass Date: Sun, 12 Jan 2025 12:33:57 +0000 Subject: [PATCH] Shuffle results panel top-level tabs and update default selection --- src/aiidalab_qe/app/result/__init__.py | 8 ++++++-- tests/test_result.py | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/aiidalab_qe/app/result/__init__.py b/src/aiidalab_qe/app/result/__init__.py index eabe8469d..0940d78e7 100644 --- a/src/aiidalab_qe/app/result/__init__.py +++ b/src/aiidalab_qe/app/result/__init__.py @@ -81,8 +81,8 @@ def _render(self): self.panels = { "Summary": self.summary_panel, - "Results": self.results_panel, "Status": self.status_panel, + "Results": self.results_panel, } self.toggle_controls = ipw.ToggleButtons( @@ -118,7 +118,11 @@ def _post_render(self): self._update_kill_button_layout() self._update_clean_scratch_button_layout() - self.toggle_controls.value = "Summary" + self.toggle_controls.value = ( + "Results" + if (process := self._model.fetch_process_node()) and process.is_finished_ok + else "Status" + ) self.process_monitor = ProcessMonitor( timeout=0.5, diff --git a/tests/test_result.py b/tests/test_result.py index abbcbc8ca..fabd07d13 100644 --- a/tests/test_result.py +++ b/tests/test_result.py @@ -20,6 +20,8 @@ def test_result_step(app_to_submit, generate_qeapp_workchain): step = app.results_step app.results_model.process_uuid = generate_qeapp_workchain().node.uuid assert step.state == step.State.ACTIVE + step.render() + assert step.toggle_controls.value == "Status" def test_kill_and_clean_buttons(app_to_submit, generate_qeapp_workchain):