allow for the fact that opening the deck while syncing may disable syncing

This commit is contained in:
Damien Elmes 2011-01-15 00:15:54 +09:00
parent 6f676c8f03
commit b336671236

View file

@ -190,11 +190,15 @@ sync was aborted. Please report this error.""")
self.deck = None self.deck = None
try: try:
self.deck = DeckStorage.Deck(path) 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 = SyncClient(self.deck)
client.setServer(proxy) client.setServer(proxy)
# need to do anything? # need to do anything?
start = time.time() start = time.time()
if client.prepareSync(proxy.timediff): if client.prepareSync(proxy.timediff) and not disable:
if self.deck.lastSync <= 0: if self.deck.lastSync <= 0:
if client.remoteTime > client.localTime: if client.remoteTime > client.localTime:
self.conflictResolution = "keepRemote" self.conflictResolution = "keepRemote"
@ -260,7 +264,9 @@ sync was aborted. Please report this error.""")
self.setStatus(_("Sync complete.")) self.setStatus(_("Sync complete."))
else: else:
changes = False changes = False
if not deck: if disable:
self.setStatus(_("Disabled by upgrade."))
elif not deck:
self.setStatus(_("No changes found.")) self.setStatus(_("No changes found."))
# close and send signal to main thread # close and send signal to main thread
self.deck.close() self.deck.close()