prevent import in cramming, warn when editing in cramming

This commit is contained in:
Damien Elmes 2009-04-23 03:54:28 +09:00
parent af2bd52003
commit 1fe922fed4

View file

@ -1374,12 +1374,18 @@ day = :d""", d=yesterday)
def onAddCard(self): def onAddCard(self):
if self.isCramming(): if self.isCramming():
ui.utils.showInfo(_("Can't add cards while cramming.")) ui.utils.showInfo(_("""\
You are currently cramming. Please close this deck first."""))
return return
ui.dialogs.get("AddCards", self) ui.dialogs.get("AddCards", self)
def onEditDeck(self): def onEditDeck(self):
ui.dialogs.get("CardList", self) ui.dialogs.get("CardList", self)
if self.isCramming():
self.showToolTip(_("""\
<h1>Cramming</h1>
You are currently cramming. Any edits you make to this deck
will be lost when you close the deck."""))
def onEditCurrent(self): def onEditCurrent(self):
self.moveToState("editCurrentFact") self.moveToState("editCurrentFact")
@ -1415,7 +1421,10 @@ day = :d""", d=yesterday)
########################################################################## ##########################################################################
def onImport(self): def onImport(self):
import ui.importing if self.isCramming():
ui.utils.showInfo(_("""\
You are currently cramming. Please close this deck first."""))
return
if self.deck is None: if self.deck is None:
self.onNew() self.onNew()
ui.importing.ImportDialog(self) ui.importing.ImportDialog(self)