default to current deck when selecting (#693)

This commit is contained in:
Damien Elmes 2013-02-20 15:25:59 +09:00
parent 83cbace080
commit a2ad76dbb4
2 changed files with 9 additions and 3 deletions

View File

@ -963,8 +963,14 @@ where id in %s""" % ids2str(sf))
def setDeck(self):
from aqt.studydeck import StudyDeck
cids = self.selectedCards()
if not cids:
return
did = self.mw.col.db.scalar(
"select did from cards where id = ?", cids[0])
current=self.mw.col.decks.get(did)['name']
ret = StudyDeck(
self.mw, current=None, accept=_("Move Cards"),
self.mw, current=current, accept=_("Move Cards"),
title=_("Change Deck"), help="browse", parent=self)
if not ret.name:
return
@ -978,7 +984,6 @@ where id in %s""" % ids2str(sf))
mod = intTime()
usn = self.col.usn()
# normal cards
cids = self.selectedCards()
scids = ids2str(cids)
# remove any cards from filtered deck first
self.col.sched.remFromDyn(cids)

View File

@ -891,7 +891,8 @@ will be lost. Continue?"""))
def onStudyDeck(self):
from aqt.studydeck import StudyDeck
ret = StudyDeck(self, dyn=True)
ret = StudyDeck(
self, dyn=True, current=self.col.decks.current()['name'])
if ret.name:
self.col.decks.select(self.col.decks.id(ret.name))
self.moveToState("overview")