Skip to content

Commit

Permalink
Add text getter and a test
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 authored and payno committed Aug 28, 2023
1 parent 8154f94 commit f9d4be1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/silx/gui/widgets/WaitingOverlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ def __init__(self, parent: qt.QWidget) -> None:
self._waitingButton.setStyleSheet("QPushButton { background-color: rgba(150, 150, 150, 40); border: 0px; border-radius: 10px; }")
self._registerParent(parent)

def text(self) -> str:
"""Returns displayed text"""
return self._waitingButton.text()

def setText(self, text: str):
"""Set displayed text"""
self._waitingButton.setText(text)
self._resize()

def _listenedWidget(self, parent: qt.QWidget) -> qt.QWidget:
"""Returns widget to register event filter to according to parent"""
Expand Down
5 changes: 5 additions & 0 deletions src/silx/gui/widgets/test/test_waitingoverlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ def test_show(qapp, qapp_utils, widget_parent):
qapp_utils.qWaitForWindowExposed(widget)
assert waitingOverlay._waitingButton.isWaiting()

waitingOverlay.setText("test")
qapp.processEvents()
assert waitingOverlay.text() == "test"
qapp_utils.qWait(1000)

waitingOverlay.hide()
qapp.processEvents()
assert not waitingOverlay._waitingButton.isWaiting()
Expand Down

0 comments on commit f9d4be1

Please sign in to comment.