mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
deck empty screen
This commit is contained in:
parent
90002a3073
commit
b5f393c7fe
2 changed files with 35 additions and 6 deletions
|
@ -20,7 +20,7 @@ import anki.consts
|
|||
import aqt, aqt.facteditor, aqt.progress, aqt.webview, aqt.stats
|
||||
from aqt.utils import saveGeom, restoreGeom, showInfo, showWarning, \
|
||||
saveState, restoreState, getOnlyText, askUser, GetTextDialog, \
|
||||
askUserDialog, applyStyles, getText, showText
|
||||
askUserDialog, applyStyles, getText, showText, showCritical
|
||||
|
||||
config = aqt.config
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class Reviewer(object):
|
|||
def show(self):
|
||||
self.web.setKeyHandler(self._keyHandler)
|
||||
self.web.setLinkHandler(self._linkHandler)
|
||||
self._initWeb()
|
||||
self._getCard()
|
||||
|
||||
def lastCard(self):
|
||||
if self._answeredIds:
|
||||
|
@ -51,7 +51,7 @@ class Reviewer(object):
|
|||
self._maybeEnableSound()
|
||||
#self.updateMarkAction()
|
||||
self.state = "question"
|
||||
self._showQuestion()
|
||||
self._initWeb()
|
||||
else:
|
||||
self._hideStatus()
|
||||
self.mw.disableCardMenuItems()
|
||||
|
@ -120,7 +120,7 @@ $(".ansbut").focus();
|
|||
def _initWeb(self):
|
||||
self.web.stdHtml(self._revHtml % dict(
|
||||
showans=_("Show Answer")), self._styles(),
|
||||
loadCB=lambda x: self._getCard())
|
||||
loadCB=lambda x: self._showQuestion())
|
||||
|
||||
# Showing the question (and preparing answer)
|
||||
##########################################################################
|
||||
|
@ -250,6 +250,10 @@ $(".ansbut").focus();
|
|||
self._showAnswer()
|
||||
elif url.startswith("ease"):
|
||||
self._answerCard(int(url[4:]))
|
||||
elif url == "add":
|
||||
self.mw.onAddCard()
|
||||
elif url == "dlist":
|
||||
self.mw.close()
|
||||
|
||||
# CSS
|
||||
##########################################################################
|
||||
|
@ -457,8 +461,33 @@ div#filler {
|
|||
|
||||
def _showEmpty(self):
|
||||
self.state = "empty"
|
||||
self.switchToWelcomeScreen()
|
||||
self.disableCardMenuItems()
|
||||
buf = """
|
||||
<h1>%(welcome)s</h1>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td width=40>
|
||||
<a href="add"><img src="qrc:/icons/list-add.png"></a>
|
||||
</td>
|
||||
<td valign=middle><b><a href="add">%(add)s</a></b>
|
||||
<br>%(start)s</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td width=40>
|
||||
<a href="welcome:back"><img src="qrc:/icons/go-previous.png"></a>
|
||||
</td>
|
||||
<td valign=middle><b><a href="dlist">%(back)s</a></b></td>
|
||||
</tr>
|
||||
</table>""" % \
|
||||
{"welcome":_("Welcome to Anki!"),
|
||||
"add":_("Add Cards"),
|
||||
"start":_("Start adding your own material."),
|
||||
"back":_("Deck List"),
|
||||
}
|
||||
self.web.stdHtml(buf, css=self.mw.sharedCSS)
|
||||
|
||||
# Status bar
|
||||
##########################################################################
|
||||
|
|
Loading…
Reference in a new issue