From 1d4d7ee7ed9af93e842ebfc632ca992f227e137c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 12 Mar 2024 14:39:46 +0700 Subject: [PATCH] Fix full sync dialog failing to appear The changed timing in 7784321b90be4ed0b9a7cc157cd88295722cb826 caused the question dialog to use the progress window as the parent, which meant it got closed when the progress window closes moments afterwards. https://forums.ankiweb.net/t/anki-24-04-beta-rc/41792/69 --- qt/aqt/progress.py | 2 +- qt/aqt/sync.py | 1 + qt/aqt/utils.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qt/aqt/progress.py b/qt/aqt/progress.py index 261441a51..93fa712d7 100644 --- a/qt/aqt/progress.py +++ b/qt/aqt/progress.py @@ -206,7 +206,7 @@ class ProgressManager: maybeShow: bool = True, max: int | None = None, ) -> None: - # print self._min, self._counter, self._max, label, time.monotonic() - self._lastTime + # print("update", label, self._levels, self._min, self._counter, self._max, label, time.monotonic() - self._shown) if not self.mw.inMainThread(): print("progress.update() called on wrong thread") return diff --git a/qt/aqt/sync.py b/qt/aqt/sync.py index 36e1d5a19..861c632f5 100644 --- a/qt/aqt/sync.py +++ b/qt/aqt/sync.py @@ -161,6 +161,7 @@ def full_sync( callback=callback, buttons=button_labels, default_button=2, + parent=mw, ) diff --git a/qt/aqt/utils.py b/qt/aqt/utils.py index cf5702c28..d89c9fbf6 100644 --- a/qt/aqt/utils.py +++ b/qt/aqt/utils.py @@ -208,6 +208,7 @@ def ask_user_dialog( | None ) = None, default_button: int = 1, + parent: QWidget | None = None, **kwargs: Any, ) -> MessageBox: "Shows a question to the user, passes the index of the button clicked to the callback." @@ -219,6 +220,7 @@ def ask_user_dialog( icon=QMessageBox.Icon.Question, buttons=buttons, default_button=default_button, + parent=parent, **kwargs, )