mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Avoid askUser() in sync dialogs (#3222)
This commit is contained in:
parent
5082d9ae5c
commit
fbb73046e0
1 changed files with 18 additions and 9 deletions
|
@ -28,7 +28,6 @@ from aqt.qt import (
|
||||||
)
|
)
|
||||||
from aqt.utils import (
|
from aqt.utils import (
|
||||||
ask_user_dialog,
|
ask_user_dialog,
|
||||||
askUser,
|
|
||||||
disable_help_button,
|
disable_help_button,
|
||||||
showText,
|
showText,
|
||||||
showWarning,
|
showWarning,
|
||||||
|
@ -171,10 +170,15 @@ def confirm_full_download(
|
||||||
) -> None:
|
) -> None:
|
||||||
# confirmation step required, as some users customize their notetypes
|
# confirmation step required, as some users customize their notetypes
|
||||||
# in an empty collection, then want to upload them
|
# in an empty collection, then want to upload them
|
||||||
if not askUser(tr.sync_confirm_empty_download(), parent=mw):
|
def callback(choice: int) -> None:
|
||||||
return on_done()
|
if choice:
|
||||||
else:
|
on_done()
|
||||||
mw.closeAllWindows(lambda: full_download(mw, server_usn, on_done))
|
else:
|
||||||
|
mw.closeAllWindows(lambda: full_download(mw, server_usn, on_done))
|
||||||
|
|
||||||
|
ask_user_dialog(
|
||||||
|
tr.sync_confirm_empty_download(), callback=callback, default_button=0, parent=mw
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def confirm_full_upload(
|
def confirm_full_upload(
|
||||||
|
@ -183,10 +187,15 @@ def confirm_full_upload(
|
||||||
# confirmation step required, as some users have reported an upload
|
# confirmation step required, as some users have reported an upload
|
||||||
# happening despite having their AnkiWeb collection not being empty
|
# happening despite having their AnkiWeb collection not being empty
|
||||||
# (not reproducible - maybe a compiler bug?)
|
# (not reproducible - maybe a compiler bug?)
|
||||||
if not askUser(tr.sync_confirm_empty_upload(), parent=mw):
|
def callback(choice: int) -> None:
|
||||||
return on_done()
|
if choice:
|
||||||
else:
|
on_done()
|
||||||
mw.closeAllWindows(lambda: full_upload(mw, server_usn, on_done))
|
else:
|
||||||
|
mw.closeAllWindows(lambda: full_upload(mw, server_usn, on_done))
|
||||||
|
|
||||||
|
ask_user_dialog(
|
||||||
|
tr.sync_confirm_empty_upload(), callback=callback, default_button=0, parent=mw
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def on_full_sync_timer(mw: aqt.main.AnkiQt, label: str) -> None:
|
def on_full_sync_timer(mw: aqt.main.AnkiQt, label: str) -> None:
|
||||||
|
|
Loading…
Reference in a new issue