From 6a7dbe9e53c40c15088bbd159f84e9d5b0543f75 Mon Sep 17 00:00:00 2001 From: Jon Holba Date: Mon, 30 Dec 2024 11:05:21 +0100 Subject: [PATCH] Update deprecated methods --- src/ert/gui/ertwidgets/analysismoduleedit.py | 2 +- src/ert/gui/ertwidgets/checklist.py | 2 +- src/ert/gui/ertwidgets/customdialog.py | 2 +- src/ert/gui/main.py | 2 +- src/ert/gui/simulation/ensemble_experiment_panel.py | 2 +- src/ert/gui/simulation/run_dialog.py | 4 ++-- src/ert/gui/tools/load_results/load_results_panel.py | 4 ++-- src/ert/gui/tools/load_results/load_results_tool.py | 2 +- src/ert/gui/tools/manage_experiments/storage_widget.py | 2 +- src/ert/gui/tools/plot/customize/customize_plot_dialog.py | 2 +- src/ert/gui/tools/plot/plottery/plots/std_dev.py | 2 +- src/ert/gui/tools/plugins/process_job_dialog.py | 6 +++--- src/ert/gui/tools/workflows/workflows_tool.py | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/ert/gui/ertwidgets/analysismoduleedit.py b/src/ert/gui/ertwidgets/analysismoduleedit.py index c679d3cef6c..bc2b08cb027 100644 --- a/src/ert/gui/ertwidgets/analysismoduleedit.py +++ b/src/ert/gui/ertwidgets/analysismoduleedit.py @@ -45,4 +45,4 @@ def showVariablesPopup(self) -> None: variable_dialog, self.parent(), # type: ignore ) - dialog.exec_() + dialog.exec() diff --git a/src/ert/gui/ertwidgets/checklist.py b/src/ert/gui/ertwidgets/checklist.py index 1dd355cef8f..f16e02c233b 100644 --- a/src/ert/gui/ertwidgets/checklist.py +++ b/src/ert/gui/ertwidgets/checklist.py @@ -168,7 +168,7 @@ def showContextMenu(self, point: QPoint) -> None: menu.addSeparator() clear_selection = menu.addAction("Clear selection") - selected_item = menu.exec_(p) + selected_item = menu.exec(p) if selected_item == check_selected: self.checkSelected() diff --git a/src/ert/gui/ertwidgets/customdialog.py b/src/ert/gui/ertwidgets/customdialog.py index 9f278b08876..43304d3fb37 100644 --- a/src/ert/gui/ertwidgets/customdialog.py +++ b/src/ert/gui/ertwidgets/customdialog.py @@ -71,7 +71,7 @@ def showAndTell(self) -> int: Shows the dialog modally and returns the true or false (accept/reject) """ self.optionValidationChanged() - return self.exec_() + return self.exec() @staticmethod def createSpace(size: int = 5) -> QWidget: diff --git a/src/ert/gui/main.py b/src/ert/gui/main.py index d8d1776a30f..a338cd2e1bb 100755 --- a/src/ert/gui/main.py +++ b/src/ert/gui/main.py @@ -51,7 +51,7 @@ def show_window() -> int: window.show() window.activateWindow() window.raise_() - return app.exec_() + return app.exec() # ens_path is None indicates that there was an error in the setup and # window is now just showing that error message, in which diff --git a/src/ert/gui/simulation/ensemble_experiment_panel.py b/src/ert/gui/simulation/ensemble_experiment_panel.py index 0d5739b1f40..ba9c72e7b0c 100644 --- a/src/ert/gui/simulation/ensemble_experiment_panel.py +++ b/src/ert/gui/simulation/ensemble_experiment_panel.py @@ -123,7 +123,7 @@ def on_show_dm_params_clicked(self, design_matrix: DesignMatrix) -> None: viewer.setMinimumHeight(500) viewer.setMinimumWidth(1000) viewer.adjustSize() - viewer.exec_() + viewer.exec() @Slot(ExperimentConfigPanel) def experimentTypeChanged(self, w: ExperimentConfigPanel) -> None: diff --git a/src/ert/gui/simulation/run_dialog.py b/src/ert/gui/simulation/run_dialog.py index 2fbb6aeaaba..cb96009eb8f 100644 --- a/src/ert/gui/simulation/run_dialog.py +++ b/src/ert/gui/simulation/run_dialog.py @@ -146,7 +146,7 @@ def _fm_step_clicked(self, index: QModelIndex) -> None: layout.addWidget(dialog_button) error_dialog.resize(700, 300) error_textedit.moveCursor(QTextCursor.MoveOperation.Start) - error_dialog.exec_() + error_dialog.exec() def mouseMoveEvent(self, event: QMouseEvent) -> None: if event: @@ -511,7 +511,7 @@ def restart_failed_realizations(self) -> None: QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel ) msg.setObjectName("restart_prompt") - result = msg.exec_() + result = msg.exec() if result == QMessageBox.StandardButton.Ok: self.restart_button.setVisible(False) diff --git a/src/ert/gui/tools/load_results/load_results_panel.py b/src/ert/gui/tools/load_results/load_results_panel.py index 3322db8519f..0df06b9275f 100644 --- a/src/ert/gui/tools/load_results/load_results_panel.py +++ b/src/ert/gui/tools/load_results/load_results_panel.py @@ -112,10 +112,10 @@ def load(self) -> int: msg = ErtMessageBox( f"Successfully loaded {loaded} realizations", "\n".join(messages) ) - msg.exec_() + msg.exec() else: msg = ErtMessageBox("No realizations loaded", "\n".join(messages)) - msg.exec_() + msg.exec() return loaded def refresh(self) -> None: diff --git a/src/ert/gui/tools/load_results/load_results_tool.py b/src/ert/gui/tools/load_results/load_results_tool.py index 10a8d3ae048..f54bc14294f 100644 --- a/src/ert/gui/tools/load_results/load_results_tool.py +++ b/src/ert/gui/tools/load_results/load_results_tool.py @@ -41,7 +41,7 @@ def trigger(self) -> None: self._loadButton.setEnabled(False) self._loadButton.setToolTip("Must load into a ensemble") assert self._dialog is not None - self._dialog.exec_() + self._dialog.exec() def load(self, _: Any) -> None: assert self._dialog is not None diff --git a/src/ert/gui/tools/manage_experiments/storage_widget.py b/src/ert/gui/tools/manage_experiments/storage_widget.py index 5dcafa640b0..99e0fc96d68 100644 --- a/src/ert/gui/tools/manage_experiments/storage_widget.py +++ b/src/ert/gui/tools/manage_experiments/storage_widget.py @@ -152,7 +152,7 @@ def _currentChanged(self, selected: QModelIndex, previous: QModelIndex) -> None: def _addItem(self) -> None: create_experiment_dialog = CreateExperimentDialog(self._notifier, parent=self) create_experiment_dialog.show() - if create_experiment_dialog.exec_(): + if create_experiment_dialog.exec(): ensemble = self._notifier.storage.create_experiment( parameters=self._ert_config.ensemble_config.parameter_configuration, responses=self._ert_config.ensemble_config.response_configuration, diff --git a/src/ert/gui/tools/plot/customize/customize_plot_dialog.py b/src/ert/gui/tools/plot/customize/customize_plot_dialog.py index 7e6c8239530..1ebaa5ec2af 100644 --- a/src/ert/gui/tools/plot/customize/customize_plot_dialog.py +++ b/src/ert/gui/tools/plot/customize/customize_plot_dialog.py @@ -283,7 +283,7 @@ def __init__( def initiateCopyStyleToDialog(self) -> None: dialog = CopyStyleToDialog(self, self.current_key, self._key_defs) - if dialog.exec_(): + if dialog.exec(): self.copySettingsToOthers.emit(dialog.getSelectedKeys()) def addCopyableKey(self, key: str | QListWidgetItem) -> None: diff --git a/src/ert/gui/tools/plot/plottery/plots/std_dev.py b/src/ert/gui/tools/plot/plottery/plots/std_dev.py index 03aa2a77c5e..6e13d206d6e 100644 --- a/src/ert/gui/tools/plot/plottery/plots/std_dev.py +++ b/src/ert/gui/tools/plot/plottery/plots/std_dev.py @@ -59,7 +59,7 @@ def plot( im = ax_heat.imshow(data, cmap="viridis", aspect="equal") heatmaps.append(im) - ax_box.boxplot(data.flatten(), vert=True, widths=0.5) + ax_box.boxplot(data.flatten(), orientation="vertical", widths=0.5) boxplot_axes.append(ax_box) min_value = np.min(data) diff --git a/src/ert/gui/tools/plugins/process_job_dialog.py b/src/ert/gui/tools/plugins/process_job_dialog.py index 933b40e591b..4c1ec6a908f 100644 --- a/src/ert/gui/tools/plugins/process_job_dialog.py +++ b/src/ert/gui/tools/plugins/process_job_dialog.py @@ -118,13 +118,13 @@ def __presentInformation(self, title: str, message: str, details: str) -> None: self._msg_box = self.__createMsgBox(title, message, details) self._msg_box.setIcon(QMessageBox.Icon.Information) - self._msg_box.exec_() + self._msg_box.exec() def __presentError(self, title: str, message: str, details: str) -> None: self._msg_box = self.__createMsgBox(title, message, details) self._msg_box.setIcon(QMessageBox.Icon.Critical) - self._msg_box.exec_() + self._msg_box.exec() def __confirmCancel(self) -> None: cancel_box = self.__createMsgBox( @@ -134,7 +134,7 @@ def __confirmCancel(self) -> None: cancel_box.setStandardButtons( QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No ) - cancel_box.exec_() + cancel_box.exec() cancel = cancel_box.result() diff --git a/src/ert/gui/tools/workflows/workflows_tool.py b/src/ert/gui/tools/workflows/workflows_tool.py index 4512221489f..73215465c7a 100644 --- a/src/ert/gui/tools/workflows/workflows_tool.py +++ b/src/ert/gui/tools/workflows/workflows_tool.py @@ -27,5 +27,5 @@ def __init__(self, config: ErtConfig, notifier: ErtNotifier) -> None: def trigger(self) -> None: run_workflow_widget = RunWorkflowWidget(self.config, self.notifier) dialog = ClosableDialog("Run workflow", run_workflow_widget, self.parent()) # type: ignore - dialog.exec_() + dialog.exec() self.notifier.emitErtChange() # workflow may have added new cases.