From 61c577df857cb9a844f419e5a53af220f1474c02 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 4 Jul 2012 19:55:49 +0900 Subject: [PATCH] on a sync conflict with a local empty deck, force download --- aqt/sync.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/aqt/sync.py b/aqt/sync.py index 620966d3b..34164688c 100644 --- a/aqt/sync.py +++ b/aqt/sync.py @@ -289,13 +289,17 @@ class SyncThread(QThread): self._syncMedia() def _fullSync(self): - # tell the calling thread we need a decision on sync direction, and - # wait for a reply - self.fullSyncChoice = False - self.fireEvent("fullSync") - while not self.fullSyncChoice: - time.sleep(0.1) - f = self.fullSyncChoice + # if the local deck is empty, assume user is trying to download + if self.col.isEmpty(): + f = "download" + else: + # tell the calling thread we need a decision on sync direction, and + # wait for a reply + self.fullSyncChoice = False + self.fireEvent("fullSync") + while not self.fullSyncChoice: + time.sleep(0.1) + f = self.fullSyncChoice if f == "cancel": return self.client = FullSyncer(self.col, self.hkey, self.server.con)