fix deck switching

This commit is contained in:
Damien Elmes 2011-04-18 06:27:28 +09:00
parent 2ffc4342df
commit c7cfbd1d35

View file

@ -340,7 +340,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
if os.path.exists(f): if os.path.exists(f):
return self.loadDeck(f) return self.loadDeck(f)
# try recent deck paths # try recent deck paths
for path in self.config['recentDeckPaths']: for path in self.config.recentDecks():
r = self.loadDeck(path, showErrors=False) r = self.loadDeck(path, showErrors=False)
if r: if r:
return r return r
@ -363,8 +363,8 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
combo = QComboBox() combo = QComboBox()
self.switchDecks = ( self.switchDecks = (
[(os.path.basename(x).replace(".anki", ""), x) [(os.path.basename(x).replace(".anki", ""), x)
for x in self.config['recentDeckPaths'] for x in self.config.recentDecks()
if not self.deck or self.mw.path != x and if not self.deck or self.deck.path != x and
os.path.exists(x)]) os.path.exists(x)])
self.switchDecks.sort() self.switchDecks.sort()
combo.addItems(QStringList([x[0] for x in self.switchDecks])) combo.addItems(QStringList([x[0] for x in self.switchDecks]))
@ -459,6 +459,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
########################################################################## ##########################################################################
def onOpenOnline(self): def onOpenOnline(self):
return showInfo("not yet implemented")
self.raiseMain() self.raiseMain()
self.ensureSyncParams() self.ensureSyncParams()
self.close() self.close()
@ -478,11 +479,13 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
self.moveToState("initial") self.moveToState("initial")
def onGetSharedDeck(self): def onGetSharedDeck(self):
return showInfo("not yet implemented")
self.raiseMain() self.raiseMain()
aqt.getshared.GetShared(self, 0) aqt.getshared.GetShared(self, 0)
self.browserLastRefreshed = 0 self.browserLastRefreshed = 0
def onGetSharedPlugin(self): def onGetSharedPlugin(self):
return showInfo("not yet implemented")
self.raiseMain() self.raiseMain()
aqt.getshared.GetShared(self, 1) aqt.getshared.GetShared(self, 1)
@ -728,6 +731,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
########################################################################## ##########################################################################
def onImport(self): def onImport(self):
return showInfo("not yet implemented")
if self.deck is None: if self.deck is None:
self.onNew(prompt=_("""\ self.onNew(prompt=_("""\
Importing copies cards to the current deck, Importing copies cards to the current deck,
@ -741,6 +745,7 @@ Please choose a new deck name:"""))
aqt.importing.ImportDialog(self) aqt.importing.ImportDialog(self)
def onExport(self): def onExport(self):
return showInfo("not yet implemented")
aqt.exporting.ExportDialog(self) aqt.exporting.ExportDialog(self)
# Language handling # Language handling