add warning when over 25 decks
This commit is contained in:
parent
8594c65510
commit
ad1e2a0291
@ -3,7 +3,8 @@
|
|||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.utils import askUser, getOnlyText, openLink, showWarning, shortcut
|
from aqt.utils import askUser, getOnlyText, openLink, showWarning, shortcut, \
|
||||||
|
openHelp
|
||||||
from anki.utils import isMac, ids2str, fmtTimeSpan
|
from anki.utils import isMac, ids2str, fmtTimeSpan
|
||||||
import anki.js
|
import anki.js
|
||||||
from anki.errors import DeckRenameError
|
from anki.errors import DeckRenameError
|
||||||
@ -43,6 +44,11 @@ class DeckBrowser(object):
|
|||||||
self._onShared()
|
self._onShared()
|
||||||
elif cmd == "import":
|
elif cmd == "import":
|
||||||
self.mw.onImport()
|
self.mw.onImport()
|
||||||
|
elif cmd == "lots":
|
||||||
|
openHelp("using-decks-appropriately")
|
||||||
|
elif cmd == "hidelots":
|
||||||
|
self.mw.pm.profile['hideDeckLotsMsg'] = True
|
||||||
|
self.refresh()
|
||||||
elif cmd == "create":
|
elif cmd == "create":
|
||||||
deck = getOnlyText(_("Name for deck:"))
|
deck = getOnlyText(_("Name for deck:"))
|
||||||
if deck:
|
if deck:
|
||||||
@ -92,6 +98,7 @@ body { margin: 1em; -webkit-user-select: none; }
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
%(stats)s
|
%(stats)s
|
||||||
|
%(countwarn)s
|
||||||
</center>
|
</center>
|
||||||
<script>
|
<script>
|
||||||
$( init );
|
$( init );
|
||||||
@ -134,7 +141,8 @@ body { margin: 1em; -webkit-user-select: none; }
|
|||||||
tree = self._renderDeckTree(self._dueTree)
|
tree = self._renderDeckTree(self._dueTree)
|
||||||
stats = self._renderStats()
|
stats = self._renderStats()
|
||||||
op = self._oldPos()
|
op = self._oldPos()
|
||||||
self.web.stdHtml(self._body%dict(tree=tree, stats=stats), css=css,
|
self.web.stdHtml(self._body%dict(
|
||||||
|
tree=tree, stats=stats, countwarn=self._countWarn()), css=css,
|
||||||
js=anki.js.jquery+anki.js.ui, loadCB=lambda ok:\
|
js=anki.js.jquery+anki.js.ui, loadCB=lambda ok:\
|
||||||
self.web.page().mainFrame().setScrollPosition(op))
|
self.web.page().mainFrame().setScrollPosition(op))
|
||||||
self.web.key = "deckBrowser"
|
self.web.key = "deckBrowser"
|
||||||
@ -157,6 +165,16 @@ where id > ?""", (self.mw.col.sched.dayCutoff-86400)*1000)
|
|||||||
b=fmtTimeSpan(thetime, unit=1))
|
b=fmtTimeSpan(thetime, unit=1))
|
||||||
return buf
|
return buf
|
||||||
|
|
||||||
|
def _countWarn(self):
|
||||||
|
if (self.mw.col.decks.count() < 25 or
|
||||||
|
self.mw.pm.profile.get("hideDeckLotsMsg")):
|
||||||
|
return ""
|
||||||
|
return "<br><div style='width:50%;border: 1px solid #000;padding:5px;'>"+(
|
||||||
|
_("You have a lot of decks. Please see %s. %s") % (
|
||||||
|
"<a href=lots>%s</a>" % _("this page"),
|
||||||
|
"<br><small><a href=hidelots>(%s)</a></small>" % (_("hide")))+
|
||||||
|
"</div")
|
||||||
|
|
||||||
def _renderDeckTree(self, nodes, depth=0):
|
def _renderDeckTree(self, nodes, depth=0):
|
||||||
if not nodes:
|
if not nodes:
|
||||||
return ""
|
return ""
|
||||||
|
Loading…
Reference in New Issue
Block a user