From 55c9f5dbebf2fa441e01d2b53a8d972c007feb7f Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 14 Mar 2020 12:09:11 +1000 Subject: [PATCH] wait for media sync to complete before unloading collection --- qt/aqt/main.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 2fa5c4f53..efb046f66 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -397,7 +397,7 @@ close the profile or restart Anki.""" # at this point there should be no windows left self._checkForUnclosedWidgets() - self.maybeAutoSync(True) + self.maybeAutoSync() def _checkForUnclosedWidgets(self) -> None: for w in self.app.topLevelWidgets(): @@ -476,6 +476,7 @@ close the profile or restart Anki.""" def unloadCollection(self, onsuccess: Callable) -> None: def callback(): self.setEnabled(False) + self.media_syncer.show_diag_until_finished() self._unloadCollection() onsuccess() @@ -845,7 +846,7 @@ title="%s" %s>%s""" % ( self.media_syncer.start() # expects a current profile, but no collection loaded - def maybeAutoSync(self, closing=False) -> None: + def maybeAutoSync(self) -> None: if ( not self.pm.profile["syncKey"] or not self.pm.profile["autoSync"] @@ -857,10 +858,6 @@ title="%s" %s>%s""" % ( # ok to sync self._sync() - # if media still syncing at this point, pop up progress diag - if closing: - self.media_syncer.show_diag_until_finished() - def maybe_auto_sync_media(self) -> None: if not self.pm.profile["autoSync"] or self.safeMode or self.restoringBackup: return