diff --git a/ankiqt/config.py b/ankiqt/config.py index b6cdfa950..78cd70097 100644 --- a/ankiqt/config.py +++ b/ankiqt/config.py @@ -97,10 +97,9 @@ class Config(dict): 'studyOptionsScreen': 0, 'suppressEstimates': False, 'suppressUpdate': False, + 'syncDisableWhenMoved': True, 'syncInMsgBox': False, - 'syncOnClose': False, 'syncOnLoad': False, - 'syncOnProgramClose': True, 'syncOnProgramOpen': True, 'syncPassword': "", 'syncUsername': "", diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index f8a871eab..ab7c9be3b 100755 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -56,6 +56,7 @@ class AnkiQt(QMainWindow): self.setupSystemHacks() self.setupSound() self.setupTray() + self.setupSync() self.connectMenuActions() ui.splash.update() self.setupViews() @@ -872,7 +873,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors") if self.deck.modifiedSinceSave(): if (self.deck.path is None or (not self.config['saveOnClose'] and - not self.config['syncOnClose'])): + not self.config['syncOnLoad'])): # backed in memory or autosave/sync off, must confirm while 1: res = ui.unsaved.ask(parent) @@ -885,7 +886,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors") else: break # auto sync (saving automatically) - if self.config['syncOnClose'] and self.deck.syncName: + if self.config['syncOnLoad'] and self.deck.syncName: # force save, the user may not have set passwd/etc self.deck.save() if self.syncDeck(False, reload=False): @@ -896,7 +897,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors") self.hideWelcome = False return True # auto save - if self.config['saveOnClose'] or self.config['syncOnClose']: + if self.config['saveOnClose'] or self.config['syncOnLoad']: if self.deck: self.save() # close if the deck wasn't already closed by a failed sync @@ -1423,7 +1424,7 @@ later by using File>Close. if not self.saveAndClose(hideWelcome=True): event.ignore() else: - if self.config['syncOnProgramClose']: + if self.config['syncOnProgramOpen']: self.hideWelcome = True self.syncDeck(interactive=False) self.prepareForExit() @@ -2146,6 +2147,10 @@ it to your friends. # Syncing ########################################################################## + def setupSync(self): + if not self.config['syncDisableWhenMoved']: + anki.deck.Deck.checkSyncHash = lambda self: True + def syncDeck(self, interactive=True, onlyMerge=False, reload=True): "Synchronise a deck with the server." if not self.inMainWindow() and interactive and interactive!=-1: return diff --git a/ankiqt/ui/preferences.py b/ankiqt/ui/preferences.py index 3d14feae8..4edc7c4f9 100644 --- a/ankiqt/ui/preferences.py +++ b/ankiqt/ui/preferences.py @@ -101,9 +101,8 @@ class Preferences(QDialog): def setupNetwork(self): self.dialog.syncOnOpen.setChecked(self.config['syncOnLoad']) - self.dialog.syncOnClose.setChecked(self.config['syncOnClose']) self.dialog.syncOnProgramOpen.setChecked(self.config['syncOnProgramOpen']) - self.dialog.syncOnProgramClose.setChecked(self.config['syncOnProgramClose']) + self.dialog.disableWhenMoved.setChecked(self.config['syncDisableWhenMoved']) self.dialog.syncUser.setText(self.config['syncUsername']) self.dialog.syncPass.setText(self.config['syncPassword']) self.dialog.proxyHost.setText(self.config['proxyHost']) @@ -115,9 +114,8 @@ class Preferences(QDialog): def updateNetwork(self): self.config['syncOnLoad'] = self.dialog.syncOnOpen.isChecked() - self.config['syncOnClose'] = self.dialog.syncOnClose.isChecked() self.config['syncOnProgramOpen'] = self.dialog.syncOnProgramOpen.isChecked() - self.config['syncOnProgramClose'] = self.dialog.syncOnProgramClose.isChecked() + self.config['syncDisableWhenMoved'] = self.dialog.disableWhenMoved.isChecked() self.config['syncUsername'] = unicode(self.dialog.syncUser.text()) self.config['syncPassword'] = unicode(self.dialog.syncPass.text()) self.config['proxyHost'] = unicode(self.dialog.proxyHost.text()) diff --git a/designer/preferences.ui b/designer/preferences.ui index 5e0792eb0..07ee48432 100644 --- a/designer/preferences.ui +++ b/designer/preferences.ui @@ -7,7 +7,7 @@ 0 0 365 - 467 + 419 @@ -33,7 +33,7 @@ - <h1>Language</h1> + <b>Language</b> false @@ -62,7 +62,7 @@ Qt::TabFocus - <h1>Reviewing</h1> + <b>Reviewing</b> false @@ -166,7 +166,7 @@ - <h1>Synchronisation</h1><a href="http://anki.ichi2.net/">Create a free account</a>. + <b>Synchronisation</b><a href="http://anki.ichi2.net/"><br>Create a free account</a>. true @@ -201,16 +201,6 @@ - - - - Sync on deck close - - - true - - - @@ -218,27 +208,27 @@ - + - Sync on deck open + Sync on deck open/close true - + - Sync on program open + Sync on program open/close - - + + - Sync on program close + Disable sync when deck moved @@ -251,7 +241,7 @@ - <h1>Proxy</h1> + <b>Proxy</b> @@ -349,7 +339,7 @@ - <h1>Autosaving</h1> + <b>Autosaving</b> @@ -427,7 +417,7 @@ - <h1>Backups</h1>Decks are backed up when they are opened, and only if they have been modified since the last backup. + <b>Backups</b><br>Decks are backed up when they are opened or synchronised, and only if they have been modified since the last backup. true @@ -520,86 +510,63 @@ - - - - <h1>Advanced settings</h1> - - - - + Show timer - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - + Alternative theme - + Show study options on deck load - + Show tray icon - + Add hidden char to text (fixes Thai on OSX) - + Always open last deck on startup - + Show decks with cards due first in browser - + Delete original media on add - + Colour next times @@ -702,9 +669,8 @@ syncUser syncPass syncOnOpen - syncOnClose syncOnProgramOpen - syncOnProgramClose + disableWhenMoved proxyHost proxyPort proxyUser