Skip to content

Commit

Permalink
Add WaitCursor to some slow tasks in the GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
frode-aarstad committed Sep 21, 2023
1 parent 526c565 commit fef3087
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/ert/gui/simulation/simulation_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
QToolButton,
QVBoxLayout,
QWidget,
QApplication,
)

from ert.cli.model_factory import create_model
Expand Down Expand Up @@ -141,19 +142,18 @@ def runSimulation(self):
== QMessageBox.Yes
):
abort = False
QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor)
try:
args = self.getSimulationArguments()
experiment = self.notifier.storage.create_experiment(
parameters=self.ert.ensembleConfig().parameter_configuration
)

model = create_model(
self.ert,
self.notifier.storage,
args,
experiment.id,
)

experiment.write_simulation_arguments(model.simulation_arguments)

except ValueError as e:
Expand All @@ -162,6 +162,8 @@ def runSimulation(self):
)
abort = True

QApplication.restoreOverrideCursor()

if (
not abort
and model.check_if_runpath_exists()
Expand Down
15 changes: 8 additions & 7 deletions src/ert/gui/tools/plot/plot_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
QTabWidget,
QVBoxLayout,
QWidget,
QApplication,
)

from ert.gui.ertwidgets import showWaitCursorWhileWaiting
Expand Down Expand Up @@ -49,16 +50,16 @@ def __init__(self, config_file, parent):

self.setWindowTitle(f"Plotting - {config_file}")
self.activateWindow()

QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor)
try:
self._api = PlotApi()
self._key_definitions = self._api.all_data_type_keys()
except (RequestError, TimeoutError) as e:
logger.exception(e)
msg = f"{e}"

QMessageBox.critical(self, "Request Failed", msg)

QMessageBox.critical(self, "Request Failed", f"{e}")
self._key_definitions = []
QApplication.restoreOverrideCursor()

self._plot_customizer = PlotCustomizer(self, self._key_definitions)

Expand Down Expand Up @@ -86,14 +87,14 @@ def __init__(self, config_file, parent):
self._central_tab.currentChanged.connect(self.currentPlotChanged)
self._prev_tab_widget = None

QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor)
try:
cases = self._api.get_all_cases_not_running()
except (RequestError, TimeoutError) as e:
logger.exception(e)
msg = f"{e}"

QMessageBox.critical(self, "Request Failed", msg)
QMessageBox.critical(self, "Request Failed", f"{e}")
cases = []
QApplication.restoreOverrideCursor()

case_names = [case["name"] for case in cases if not case["hidden"]]

Expand Down

0 comments on commit fef3087

Please sign in to comment.