diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index 49f0e8d6e..382e23334 100644 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -1891,19 +1891,18 @@ Couldn't contact Anki Online. Please check your internet connection.""") ui.utils.showWarning(_( "Failed to upload media. Please run 'check media db'."), self) - def fullSyncStarted(self, ret): - self.startProgress(max=ret[2]) - if ret[0] == "fromLocal": - s = _("Uploading to server...") - else: - s = _("Downloading from server...") - self.updateProgress(label=s) + def fullSyncStarted(self, max): + self.startProgress(max=max) def fullSyncFinished(self): self.finishProgress() - def fullSyncProgress(self, val): - self.updateProgress(value=val) + def fullSyncProgress(self, type, val): + if type == "fromLocal": + s = _("Uploaded %dKB to server...") + else: + s = _("Downloaded %dKB from server...") + self.updateProgress(label=s % (val / 1024), value=val) # Menu, title bar & status ########################################################################## diff --git a/ankiqt/ui/sync.py b/ankiqt/ui/sync.py index 186552821..41c15e040 100644 --- a/ankiqt/ui/sync.py +++ b/ankiqt/ui/sync.py @@ -42,14 +42,14 @@ class Sync(QThread): removeHook('fullSyncFinished', self.fullSyncFinished) removeHook('fullSyncProgress', self.fullSyncProgress) - def fullSyncStarted(self, ret): - self.emit(SIGNAL("fullSyncStarted"), ret) + def fullSyncStarted(self, max): + self.emit(SIGNAL("fullSyncStarted"), max) def fullSyncFinished(self): self.emit(SIGNAL("fullSyncFinished")) - def fullSyncProgress(self, val): - self.emit(SIGNAL("fullSyncProgress"), val) + def fullSyncProgress(self, type, val): + self.emit(SIGNAL("fullSyncProgress"), type, val) def error(self, error): if getattr(error, 'data', None) is None: @@ -119,7 +119,13 @@ class Sync(QThread): sums = client.summaries() if client.needFullSync(sums): self.setStatus(_("Preparing full sync..."), 0) - client.fullSync() + ret = client.prepareFullSync() + if ret[0] == "fromLocal": + self.setStatus(_("Uploading..."), 0) + client.fullSyncFromLocal(ret[1], ret[2]) + else: + self.setStatus(_("Downloading..."), 0) + client.fullSyncFromServer(ret[1], ret[2]) self.setStatus(_("Sync complete."), 0) else: # diff