diff --git a/src/ert/gui/simulation/run_dialog.py b/src/ert/gui/simulation/run_dialog.py index 4706693de94..fd193dcc07b 100644 --- a/src/ert/gui/simulation/run_dialog.py +++ b/src/ert/gui/simulation/run_dialog.py @@ -361,6 +361,7 @@ def closeEvent(self, a0: Optional[QCloseEvent]) -> None: def run_experiment(self, restart: bool = False) -> None: self._restart = restart + self._progress_widget.set_ensemble_running() if restart is False: self._snapshot_model.reset() self._tab_widget.clear() @@ -420,6 +421,7 @@ def _on_simulation_done(self, failed: bool, msg: str) -> None: self._notifier.set_is_simulation_running(False) if failed: self.update_total_progress(1.0, "Failed") + self._progress_widget.set_ensemble_failed() self.fail_msg_box = ErtMessageBox("ERT experiment failed!", msg, self) self.fail_msg_box.setModal(True) self.fail_msg_box.show() diff --git a/src/ert/gui/simulation/view/progress_widget.py b/src/ert/gui/simulation/view/progress_widget.py index 22e459c7221..3a617f37dde 100644 --- a/src/ert/gui/simulation/view/progress_widget.py +++ b/src/ert/gui/simulation/view/progress_widget.py @@ -12,7 +12,7 @@ QWidget, ) -from ert.ensemble_evaluator.state import REAL_STATE_TO_COLOR +from ert.ensemble_evaluator.state import REAL_STATE_TO_COLOR, REALIZATION_STATE_FAILED class ProgressWidget(QFrame): @@ -78,6 +78,7 @@ def __init__(self) -> None: self._horizontal_legend_layout.addWidget(label) def repaint_components(self) -> None: + self._update_waiting_progress_bar() if self._realization_count > 0: full_width = self.width() @@ -95,17 +96,31 @@ def repaint_components(self) -> None: def stop_waiting_progress_bar(self) -> None: self._waiting_progress_bar.setVisible(False) - def start_waiting_progress_bar(self) -> None: - self._waiting_progress_bar.setVisible(True) - def update_progress(self, status: dict[str, int], realization_count: int) -> None: self._status = status self._realization_count = realization_count - if status.get("Finished", 0) < self._realization_count: - self.start_waiting_progress_bar() - else: - self.stop_waiting_progress_bar() self.repaint_components() + def _update_waiting_progress_bar(self) -> None: + self._waiting_progress_bar.setVisible( + self._status.get("Finished", 0) + self._status.get("Failed", 0) + < self._realization_count + ) + + def set_ensemble_failed(self) -> None: + self._reset_progress_labels() + + failed_label = self._progress_label_map[REALIZATION_STATE_FAILED] + failed_label.setFixedWidth(self.width()) + failed_label.setVisible(True) + self.stop_waiting_progress_bar() + + def set_ensemble_running(self) -> None: + self._reset_progress_labels() + + def _reset_progress_labels(self) -> None: + for label in self._progress_label_map.values(): + label.setVisible(False) + def resizeEvent(self, a0: Any, event: Any = None) -> None: self.repaint_components() diff --git a/tests/ert/ui_tests/gui/test_missing_runpath.py b/tests/ert/ui_tests/gui/test_missing_runpath.py index 4b7409cdb6a..d7e0cdb9541 100644 --- a/tests/ert/ui_tests/gui/test_missing_runpath.py +++ b/tests/ert/ui_tests/gui/test_missing_runpath.py @@ -83,6 +83,7 @@ def inner(): QLabel, name="progress_label_text_Finished" ).text() ) + assert not run_dialog._progress_widget._waiting_progress_bar.isVisible() assert ( "1/10" in run_dialog._progress_widget.findChild(