Fix full sync dialog failing to appear

The changed timing in 7784321b90 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
This commit is contained in:
Damien Elmes 2024-03-12 14:39:46 +07:00
parent 8c9d7d64d9
commit 1d4d7ee7ed
3 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -161,6 +161,7 @@ def full_sync(
callback=callback,
buttons=button_labels,
default_button=2,
parent=mw,
)

View file

@ -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,
)