diff --git a/src/ert/gui/simulation/run_dialog.py b/src/ert/gui/simulation/run_dialog.py index e54d8bb752c..8958bdc741d 100644 --- a/src/ert/gui/simulation/run_dialog.py +++ b/src/ert/gui/simulation/run_dialog.py @@ -511,16 +511,17 @@ class CopyDebugInfoButton(QPushButton): _initial_text = "Copy Debug Info" _clicked_text = "Copied..." - def __init__(self, on_click: Callable[[], None]): + def __init__(self, on_click: Callable[[], None], time_to_alternate: int = 1000): QPushButton.__init__(self, CopyDebugInfoButton._initial_text) self.setToolTip("Copies useful information to clipboard") self.setObjectName("copy_debug_info_button") self.setFixedWidth(140) + self.time_to_alternate = time_to_alternate def alternate_button_text_on_click_and_call_callback() -> None: self._alternate_button_text() on_click() - QTimer.singleShot(1000, self._alternate_button_text) + QTimer.singleShot(self.time_to_alternate, self._alternate_button_text) self.clicked.connect(alternate_button_text_on_click_and_call_callback) diff --git a/tests/ert/unit_tests/gui/ertwidgets/test_copy_debug_info_button.py b/tests/ert/unit_tests/gui/ertwidgets/test_copy_debug_info_button.py index dca0b5ce655..d85d68e9592 100644 --- a/tests/ert/unit_tests/gui/ertwidgets/test_copy_debug_info_button.py +++ b/tests/ert/unit_tests/gui/ertwidgets/test_copy_debug_info_button.py @@ -11,7 +11,7 @@ def on_click(): nonlocal button_clicked button_clicked = True - button = CopyDebugInfoButton(on_click=on_click) + button = CopyDebugInfoButton(on_click=on_click, time_to_alternate=10) qtbot.addWidget(button) assert button.text() == CopyDebugInfoButton._initial_text