Skip to content

Commit

Permalink
Only display overlay widget if parent window is available, closes #1353
Browse files Browse the repository at this point in the history
  • Loading branch information
zkovari committed Sep 30, 2024
1 parent af5e2d8 commit 7a6b3f6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/python/plotlyst/view/widget/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,16 +371,20 @@ def popup(cls, *args, **kwargs) -> Any:
QApplication.restoreOverrideCursor()
dialog = cls(*args, **kwargs)
window = QApplication.activeWindow()
overlay = OverlayWidget(window)
overlay.show()
if window:
overlay = OverlayWidget(window)
overlay.show()
else:
overlay = None

dialog.move(
window.frameGeometry().center() - QPoint(dialog.sizeHint().width() // 2, dialog.sizeHint().height() // 2))

try:
return dialog.display()
finally:
overlay.setHidden(True)
if overlay is not None:
overlay.setHidden(True)
if override_cursor:
QApplication.setOverrideCursor(override_cursor)

Expand Down

0 comments on commit 7a6b3f6

Please sign in to comment.