Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix waiting cursor in load results manually panel #8393

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/ert/gui/tools/load_results/load_results_panel.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

from qtpy.QtCore import Qt
from qtpy.QtWidgets import QFormLayout, QMessageBox, QTextEdit, QWidget

from ert.gui.ertnotifier import ErtNotifier
from ert.gui.ertwidgets import (
ActiveRealizationsModel,
EnsembleSelector,
ErtMessageBox,
QApplication,
StringBox,
ValueModel,
)
Expand Down Expand Up @@ -86,13 +88,16 @@ def load(self) -> int:
),
)
return False

QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor)
messages: list[str] = []
with captured_logs(messages):
loaded = self._facade.load_from_forward_model(
selected_ensemble, # type: ignore
realizations, # type: ignore
iteration_int,
)
QApplication.restoreOverrideCursor()

if loaded == realizations.count(True):
QMessageBox.information(
Expand Down
11 changes: 4 additions & 7 deletions src/ert/gui/tools/load_results/load_results_tool.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from typing import Any, Optional

from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QPushButton

from ert.gui.ertnotifier import ErtNotifier
from ert.gui.ertwidgets import ClosableDialog, showWaitCursorWhileWaiting
from ert.gui.ertwidgets import ClosableDialog
from ert.gui.tools import Tool
from ert.gui.tools.load_results import LoadResultsPanel
from ert.libres_facade import LibresFacade
Expand All @@ -30,14 +29,12 @@ def trigger(self) -> None:
self.parent(), # type: ignore
)
self._dialog.setObjectName("load_results_manually_tool")
self._dialog.addButton("Load", self.load)
loadButton = self._dialog.addButton("Load", self.load)
if not self._import_widget._ensemble_selector.isEnabled():
button = self._dialog.findChild(QPushButton, "Load")
button.setEnabled(False)
button.setToolTip("Must load into a ensemble")
loadButton.setEnabled(False)
loadButton.setToolTip("Must load into a ensemble")
self._dialog.exec_()

@showWaitCursorWhileWaiting
def load(self, _: Any) -> None:
assert self._dialog is not None
assert self._import_widget is not None
Expand Down