From b3366712365472242edbda0ca4c5c6737697312e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 15 Jan 2011 00:15:54 +0900 Subject: [PATCH] allow for the fact that opening the deck while syncing may disable syncing --- ankiqt/ui/sync.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ankiqt/ui/sync.py b/ankiqt/ui/sync.py index 709cfa209..748d5e006 100755 --- a/ankiqt/ui/sync.py +++ b/ankiqt/ui/sync.py @@ -190,11 +190,15 @@ sync was aborted. Please report this error.""") self.deck = None try: self.deck = DeckStorage.Deck(path) + disable = False + if deck and not self.deck.syncName: + # multi-mode sync and syncing has been disabled by upgrade + disable = True client = SyncClient(self.deck) client.setServer(proxy) # need to do anything? start = time.time() - if client.prepareSync(proxy.timediff): + if client.prepareSync(proxy.timediff) and not disable: if self.deck.lastSync <= 0: if client.remoteTime > client.localTime: self.conflictResolution = "keepRemote" @@ -260,7 +264,9 @@ sync was aborted. Please report this error.""") self.setStatus(_("Sync complete.")) else: changes = False - if not deck: + if disable: + self.setStatus(_("Disabled by upgrade.")) + elif not deck: self.setStatus(_("No changes found.")) # close and send signal to main thread self.deck.close()