Skip to content

Commit

Permalink
WaiterOverlay: fix parenting since is a QWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
payno committed Jul 20, 2023
1 parent 583e8f6 commit 941aeea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/silx/gui/utils/test/test_waiter_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def test_show(qapp_utils):
waitingOverlay.setWaiting(False)

assert waitingOverlay.parent() is plot
assert waitingOverlay._waitingButton.parent() is plot.getWidgetHandle()

plot.close()
waitingOverlay.close()
4 changes: 2 additions & 2 deletions src/silx/gui/utils/waiteroverlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ def __init__(self, parent: qt.QWidget) -> None:
:param qt.QWidget underlying_widget: widget on top of which we want to displat the "processing/waiting wheel"
:param str waiting_text: text to apply near the processing wheel
"""
super().__init__()

super().__init__(parent)
if isinstance(parent, PlotWidget):
parent = parent.getWidgetHandle()

if not isinstance(parent, qt.QWidget):
raise TypeError(f"underlying_widget is expected to be an instance of QWidget. {type(parent)} provided.")

self._waitingButton = WaitingPushButton(
parent=parent,
)
Expand Down

0 comments on commit 941aeea

Please sign in to comment.