Skip to content

Commit

Permalink
Speed up copy debug info test
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Dec 10, 2024
1 parent 2684a92 commit 5246d15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/ert/gui/simulation/run_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5246d15

Please sign in to comment.