mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00
fix double syncs
This commit is contained in:
parent
a10bc64822
commit
b14e6b306b
2 changed files with 9 additions and 4 deletions
11
aqt/main.py
11
aqt/main.py
|
@ -191,14 +191,19 @@ Are you sure?"""):
|
|||
self.moveToState("deckBrowser")
|
||||
else:
|
||||
self.moveToState("overview")
|
||||
runHook("profileLoaded")
|
||||
|
||||
def unloadProfile(self, browser=True):
|
||||
if not self.pm.profile:
|
||||
# already unloaded
|
||||
return
|
||||
runHook("unloadProfile")
|
||||
self.unloadCollection()
|
||||
self.onSync(auto=True, reload=False)
|
||||
self.pm.profile['mainWindowGeom'] = self.saveGeometry()
|
||||
self.pm.profile['mainWindowState'] = self.saveState()
|
||||
self.pm.save()
|
||||
self.close()
|
||||
self.pm.profile = None
|
||||
if browser:
|
||||
self.showProfileManager()
|
||||
|
||||
|
@ -217,7 +222,6 @@ Are you sure?"""):
|
|||
self.col.close()
|
||||
self.col = None
|
||||
self.backup()
|
||||
self.onSync(auto=True, reload=False)
|
||||
|
||||
# Backup and auto-optimize
|
||||
##########################################################################
|
||||
|
@ -549,6 +553,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
|
|||
aw = self.app.activeWindow()
|
||||
if not aw or aw == self:
|
||||
self.unloadProfile(browser=False)
|
||||
self.app.closeAllWindows()
|
||||
else:
|
||||
aw.close()
|
||||
|
||||
|
@ -745,7 +750,7 @@ Please choose a new deck name:"""))
|
|||
s = SIGNAL("triggered()")
|
||||
#self.connect(m.actionDownloadSharedPlugin, s, self.onGetSharedPlugin)
|
||||
self.connect(m.actionSwitchProfile, s, self.unloadProfile)
|
||||
self.connect(m.actionExit, s, self.onClose)
|
||||
self.connect(m.actionExit, s, self, SLOT("close()"))
|
||||
self.connect(m.actionPreferences, s, self.onPrefs)
|
||||
self.connect(m.actionCstats, s, self.onCardStats)
|
||||
self.connect(m.actionAbout, s, self.onAbout)
|
||||
|
|
|
@ -97,7 +97,7 @@ class Overview(object):
|
|||
%s</td></tr></table>''' % (
|
||||
_("New"), counts[0],
|
||||
_("Learning"), counts[1],
|
||||
_("Reviewing"), counts[2],
|
||||
_("To Review"), counts[2],
|
||||
but("study", _("Study Now"), id="study"))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue