mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 15:47:12 -05: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
|
import aqt, aqt.facteditor, aqt.progress, aqt.webview, aqt.stats
|
||||||
from aqt.utils import saveGeom, restoreGeom, showInfo, showWarning, \
|
from aqt.utils import saveGeom, restoreGeom, showInfo, showWarning, \
|
||||||
saveState, restoreState, getOnlyText, askUser, GetTextDialog, \
|
saveState, restoreState, getOnlyText, askUser, GetTextDialog, \
|
||||||
askUserDialog, applyStyles, getText, showText
|
askUserDialog, applyStyles, getText, showText, showCritical
|
||||||
|
|
||||||
config = aqt.config
|
config = aqt.config
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class Reviewer(object):
|
||||||
def show(self):
|
def show(self):
|
||||||
self.web.setKeyHandler(self._keyHandler)
|
self.web.setKeyHandler(self._keyHandler)
|
||||||
self.web.setLinkHandler(self._linkHandler)
|
self.web.setLinkHandler(self._linkHandler)
|
||||||
self._initWeb()
|
self._getCard()
|
||||||
|
|
||||||
def lastCard(self):
|
def lastCard(self):
|
||||||
if self._answeredIds:
|
if self._answeredIds:
|
||||||
|
|
@ -51,7 +51,7 @@ class Reviewer(object):
|
||||||
self._maybeEnableSound()
|
self._maybeEnableSound()
|
||||||
#self.updateMarkAction()
|
#self.updateMarkAction()
|
||||||
self.state = "question"
|
self.state = "question"
|
||||||
self._showQuestion()
|
self._initWeb()
|
||||||
else:
|
else:
|
||||||
self._hideStatus()
|
self._hideStatus()
|
||||||
self.mw.disableCardMenuItems()
|
self.mw.disableCardMenuItems()
|
||||||
|
|
@ -120,7 +120,7 @@ $(".ansbut").focus();
|
||||||
def _initWeb(self):
|
def _initWeb(self):
|
||||||
self.web.stdHtml(self._revHtml % dict(
|
self.web.stdHtml(self._revHtml % dict(
|
||||||
showans=_("Show Answer")), self._styles(),
|
showans=_("Show Answer")), self._styles(),
|
||||||
loadCB=lambda x: self._getCard())
|
loadCB=lambda x: self._showQuestion())
|
||||||
|
|
||||||
# Showing the question (and preparing answer)
|
# Showing the question (and preparing answer)
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
@ -250,6 +250,10 @@ $(".ansbut").focus();
|
||||||
self._showAnswer()
|
self._showAnswer()
|
||||||
elif url.startswith("ease"):
|
elif url.startswith("ease"):
|
||||||
self._answerCard(int(url[4:]))
|
self._answerCard(int(url[4:]))
|
||||||
|
elif url == "add":
|
||||||
|
self.mw.onAddCard()
|
||||||
|
elif url == "dlist":
|
||||||
|
self.mw.close()
|
||||||
|
|
||||||
# CSS
|
# CSS
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
@ -457,8 +461,33 @@ div#filler {
|
||||||
|
|
||||||
def _showEmpty(self):
|
def _showEmpty(self):
|
||||||
self.state = "empty"
|
self.state = "empty"
|
||||||
self.switchToWelcomeScreen()
|
buf = """
|
||||||
self.disableCardMenuItems()
|
<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
|
# Status bar
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue