diff --git a/src/ert/gui/simulation/ensemble_experiment_panel.py b/src/ert/gui/simulation/ensemble_experiment_panel.py index cd6e8fd4358..dd2cf2e513e 100644 --- a/src/ert/gui/simulation/ensemble_experiment_panel.py +++ b/src/ert/gui/simulation/ensemble_experiment_panel.py @@ -84,21 +84,19 @@ def __init__( layout.addRow("Active realizations", self._active_realizations_field) design_matrix = analysis_config.design_matrix - show_dm_param_button = QPushButton("Show parameters") - show_dm_param_button.setObjectName("show-dm-parameters") - show_dm_param_button.setMinimumWidth(50) + if design_matrix is not None: + show_dm_param_button = QPushButton("Show parameters") + show_dm_param_button.setObjectName("show-dm-parameters") + show_dm_param_button.setMinimumWidth(50) - button_layout = QHBoxLayout() - button_layout.addWidget(show_dm_param_button) - button_layout.addStretch() # Add stretch to push the button to the left + button_layout = QHBoxLayout() + button_layout.addWidget(show_dm_param_button) + button_layout.addStretch() # Add stretch to push the button to the left - layout.addRow("Design Matrix", button_layout) - if design_matrix is not None: + layout.addRow("Design Matrix", button_layout) show_dm_param_button.clicked.connect( lambda: self.on_show_dm_params_clicked(design_matrix) ) - else: - show_dm_param_button.setDisabled(True) self.setLayout(layout) diff --git a/tests/ert/unit_tests/gui/simulation/test_run_dialog.py b/tests/ert/unit_tests/gui/simulation/test_run_dialog.py index 6548032e3a5..dbf273083d3 100644 --- a/tests/ert/unit_tests/gui/simulation/test_run_dialog.py +++ b/tests/ert/unit_tests/gui/simulation/test_run_dialog.py @@ -1,9 +1,7 @@ import os -from pathlib import Path from queue import SimpleQueue from unittest.mock import MagicMock, Mock, patch -import pandas as pd import pytest from pytestqt.qtbot import QtBot from qtpy import QtWidgets @@ -18,7 +16,7 @@ ) import ert -from ert.config import DesignMatrix, ErtConfig +from ert.config import ErtConfig from ert.ensemble_evaluator import state from ert.ensemble_evaluator.event import ( EndEvent, @@ -751,12 +749,7 @@ def test_that_design_matrix_show_parameters_button( show_dm_parameters = simulation_settings.findChild( QPushButton, "show-dm-parameters" ) - - assert isinstance(show_dm_parameters, QPushButton) - assert show_dm_parameters.isEnabled() == design_matrix_entry - if show_dm_parameters.isEnabled(): - design_matrix_df = pd.DataFrame({"a": [1, 2, 3], "b": [3, 4, 5]}) - with patch.object( - DesignMatrix, "design_matrix_df", design_matrix_df - ), patch.object(DesignMatrix, "xls_filename", Path(xls_filename)): - qtbot.mouseClick(show_dm_parameters, Qt.LeftButton) + if design_matrix_entry: + assert isinstance(show_dm_parameters, QPushButton) + else: + assert show_dm_parameters is None