From 7a6b3f6eb134f4ade5859f8530f6ae54821835f4 Mon Sep 17 00:00:00 2001 From: Zsolt Kovari Date: Mon, 30 Sep 2024 15:06:42 +0200 Subject: [PATCH] Only display overlay widget if parent window is available, closes #1353 --- src/main/python/plotlyst/view/widget/display.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/python/plotlyst/view/widget/display.py b/src/main/python/plotlyst/view/widget/display.py index 0641ec6c9..9f674d5fb 100644 --- a/src/main/python/plotlyst/view/widget/display.py +++ b/src/main/python/plotlyst/view/widget/display.py @@ -371,8 +371,11 @@ 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)) @@ -380,7 +383,8 @@ def popup(cls, *args, **kwargs) -> Any: try: return dialog.display() finally: - overlay.setHidden(True) + if overlay is not None: + overlay.setHidden(True) if override_cursor: QApplication.setOverrideCursor(override_cursor)