2019-02-05 04:59:03 +01:00
|
|
|
# Copyright: Ankitects Pty Ltd and contributors
|
2012-12-21 08:51:59 +01:00
|
|
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
2020-01-22 01:46:35 +01:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2020-02-17 16:49:21 +01:00
|
|
|
from dataclasses import dataclass
|
2021-02-01 13:08:56 +01:00
|
|
|
from typing import Any, Callable, Dict, List, Optional, Tuple
|
2020-02-17 16:49:21 +01:00
|
|
|
|
2012-12-21 08:51:59 +01:00
|
|
|
import aqt
|
more reset refactoring
'card modified' covers the common case where we need to rebuild the
study queue, but is also set when changing the card flags. We want to
avoid a queue rebuild in that case, as it causes UI flicker, and may
result in a different card being shown. Note marking doesn't trigger
a queue build, but still causes flicker, and may return the user back
to the front side when they were looking at the answer.
I still think entity-based change tracking is the simplest in the
common case, but to solve the above, I've introduced an enum describing
the last operation that was taken. This currently is not trying to list
out all possible operations, and just describes the ones we want to
special-case.
Other changes:
- Fire the old 'state_did_reset' hook after an operation is performed,
so legacy code can refresh itself after an operation is performed.
- Fire the new `operation_did_execute` hook when mw.reset() is called,
so that as the UI is updated to the use the new hook, it will still
be able to refresh after legacy code calls mw.reset()
- Update the deck browser, overview and review screens to listen to
the new hook, instead of relying on the main window to call moveToState()
- Add a 'set flag' backend action, so we can distinguish it from a
normal card update.
- Drop the separate added/modified entries in the change list in
favour of a single entry per entity.
- Add typing to mw.state
- Tweak perform_op()
- Convert a few more actions to use perform_op()
2021-03-14 10:54:15 +01:00
|
|
|
from anki.collection import OperationInfo
|
2020-02-08 06:31:41 +01:00
|
|
|
from aqt import gui_hooks
|
2020-01-20 11:10:38 +01:00
|
|
|
from aqt.sound import av_player
|
2020-01-22 01:46:35 +01:00
|
|
|
from aqt.toolbar import BottomBar
|
2020-11-17 08:42:43 +01:00
|
|
|
from aqt.utils import TR, askUserDialog, openLink, shortcut, tooltip, tr
|
2019-12-20 10:19:03 +01:00
|
|
|
|
2012-12-21 08:51:59 +01:00
|
|
|
|
2020-02-08 23:59:29 +01:00
|
|
|
class OverviewBottomBar:
|
2021-02-01 14:28:21 +01:00
|
|
|
def __init__(self, overview: Overview) -> None:
|
2020-02-08 23:59:29 +01:00
|
|
|
self.overview = overview
|
|
|
|
|
|
|
|
|
2020-02-17 16:49:21 +01:00
|
|
|
@dataclass
|
|
|
|
class OverviewContent:
|
2020-02-17 16:53:47 +01:00
|
|
|
"""Stores sections of HTML content that the overview will be
|
|
|
|
populated with.
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
deck {str} -- Plain text deck name
|
|
|
|
shareLink {str} -- HTML of the share link section
|
|
|
|
desc {str} -- HTML of the deck description section
|
|
|
|
table {str} -- HTML of the deck stats table section
|
|
|
|
"""
|
|
|
|
|
2020-02-17 16:49:21 +01:00
|
|
|
deck: str
|
|
|
|
shareLink: str
|
|
|
|
desc: str
|
|
|
|
table: str
|
|
|
|
|
|
|
|
|
2017-02-06 23:21:33 +01:00
|
|
|
class Overview:
|
2012-12-21 08:51:59 +01:00
|
|
|
"Deck overview."
|
|
|
|
|
2020-01-22 01:46:35 +01:00
|
|
|
def __init__(self, mw: aqt.AnkiQt) -> None:
|
2012-12-21 08:51:59 +01:00
|
|
|
self.mw = mw
|
|
|
|
self.web = mw.web
|
2020-01-22 01:46:35 +01:00
|
|
|
self.bottom = BottomBar(mw, mw.bottomWeb)
|
2021-03-14 15:03:41 +01:00
|
|
|
self._refresh_needed = False
|
2012-12-21 08:51:59 +01:00
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def show(self) -> None:
|
2020-01-20 11:10:38 +01:00
|
|
|
av_player.stop_and_clear_queue()
|
2020-02-08 23:59:29 +01:00
|
|
|
self.web.set_bridge_command(self._linkHandler, self)
|
2017-06-22 08:36:54 +02:00
|
|
|
self.mw.setStateShortcuts(self._shortcutKeys())
|
2012-12-21 08:51:59 +01:00
|
|
|
self.refresh()
|
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def refresh(self) -> None:
|
2012-12-21 08:51:59 +01:00
|
|
|
self.mw.col.reset()
|
|
|
|
self._renderPage()
|
|
|
|
self._renderBottom()
|
2016-05-31 10:51:40 +02:00
|
|
|
self.mw.web.setFocus()
|
2020-02-08 06:31:41 +01:00
|
|
|
gui_hooks.overview_did_refresh(self)
|
2021-03-14 15:03:41 +01:00
|
|
|
self._refresh_needed = False
|
2012-12-21 08:51:59 +01:00
|
|
|
|
2021-03-14 13:08:37 +01:00
|
|
|
def refresh_if_needed(self) -> None:
|
2021-03-14 15:03:41 +01:00
|
|
|
if self._refresh_needed:
|
2021-03-14 13:08:37 +01:00
|
|
|
self.refresh()
|
more reset refactoring
'card modified' covers the common case where we need to rebuild the
study queue, but is also set when changing the card flags. We want to
avoid a queue rebuild in that case, as it causes UI flicker, and may
result in a different card being shown. Note marking doesn't trigger
a queue build, but still causes flicker, and may return the user back
to the front side when they were looking at the answer.
I still think entity-based change tracking is the simplest in the
common case, but to solve the above, I've introduced an enum describing
the last operation that was taken. This currently is not trying to list
out all possible operations, and just describes the ones we want to
special-case.
Other changes:
- Fire the old 'state_did_reset' hook after an operation is performed,
so legacy code can refresh itself after an operation is performed.
- Fire the new `operation_did_execute` hook when mw.reset() is called,
so that as the UI is updated to the use the new hook, it will still
be able to refresh after legacy code calls mw.reset()
- Update the deck browser, overview and review screens to listen to
the new hook, instead of relying on the main window to call moveToState()
- Add a 'set flag' backend action, so we can distinguish it from a
normal card update.
- Drop the separate added/modified entries in the change list in
favour of a single entry per entity.
- Add typing to mw.state
- Tweak perform_op()
- Convert a few more actions to use perform_op()
2021-03-14 10:54:15 +01:00
|
|
|
|
2021-03-14 15:03:41 +01:00
|
|
|
def op_executed(self, op: OperationInfo, focused: bool) -> bool:
|
more reset refactoring
'card modified' covers the common case where we need to rebuild the
study queue, but is also set when changing the card flags. We want to
avoid a queue rebuild in that case, as it causes UI flicker, and may
result in a different card being shown. Note marking doesn't trigger
a queue build, but still causes flicker, and may return the user back
to the front side when they were looking at the answer.
I still think entity-based change tracking is the simplest in the
common case, but to solve the above, I've introduced an enum describing
the last operation that was taken. This currently is not trying to list
out all possible operations, and just describes the ones we want to
special-case.
Other changes:
- Fire the old 'state_did_reset' hook after an operation is performed,
so legacy code can refresh itself after an operation is performed.
- Fire the new `operation_did_execute` hook when mw.reset() is called,
so that as the UI is updated to the use the new hook, it will still
be able to refresh after legacy code calls mw.reset()
- Update the deck browser, overview and review screens to listen to
the new hook, instead of relying on the main window to call moveToState()
- Add a 'set flag' backend action, so we can distinguish it from a
normal card update.
- Drop the separate added/modified entries in the change list in
favour of a single entry per entity.
- Add typing to mw.state
- Tweak perform_op()
- Convert a few more actions to use perform_op()
2021-03-14 10:54:15 +01:00
|
|
|
if self.mw.col.op_affects_study_queue(op):
|
2021-03-14 15:03:41 +01:00
|
|
|
self._refresh_needed = True
|
2021-03-14 13:08:37 +01:00
|
|
|
|
|
|
|
if focused:
|
|
|
|
self.refresh_if_needed()
|
more reset refactoring
'card modified' covers the common case where we need to rebuild the
study queue, but is also set when changing the card flags. We want to
avoid a queue rebuild in that case, as it causes UI flicker, and may
result in a different card being shown. Note marking doesn't trigger
a queue build, but still causes flicker, and may return the user back
to the front side when they were looking at the answer.
I still think entity-based change tracking is the simplest in the
common case, but to solve the above, I've introduced an enum describing
the last operation that was taken. This currently is not trying to list
out all possible operations, and just describes the ones we want to
special-case.
Other changes:
- Fire the old 'state_did_reset' hook after an operation is performed,
so legacy code can refresh itself after an operation is performed.
- Fire the new `operation_did_execute` hook when mw.reset() is called,
so that as the UI is updated to the use the new hook, it will still
be able to refresh after legacy code calls mw.reset()
- Update the deck browser, overview and review screens to listen to
the new hook, instead of relying on the main window to call moveToState()
- Add a 'set flag' backend action, so we can distinguish it from a
normal card update.
- Drop the separate added/modified entries in the change list in
favour of a single entry per entity.
- Add typing to mw.state
- Tweak perform_op()
- Convert a few more actions to use perform_op()
2021-03-14 10:54:15 +01:00
|
|
|
|
2021-03-14 15:03:41 +01:00
|
|
|
return self._refresh_needed
|
|
|
|
|
2012-12-21 08:51:59 +01:00
|
|
|
# Handlers
|
|
|
|
############################################################
|
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def _linkHandler(self, url: str) -> bool:
|
2012-12-21 08:51:59 +01:00
|
|
|
if url == "study":
|
|
|
|
self.mw.col.startTimebox()
|
|
|
|
self.mw.moveToState("review")
|
2013-04-11 07:57:03 +02:00
|
|
|
if self.mw.state == "overview":
|
2020-11-17 08:42:43 +01:00
|
|
|
tooltip(tr(TR.STUDYING_NO_CARDS_ARE_DUE_YET))
|
2012-12-21 08:51:59 +01:00
|
|
|
elif url == "anki":
|
2016-05-12 06:45:35 +02:00
|
|
|
print("anki menu")
|
2012-12-21 08:51:59 +01:00
|
|
|
elif url == "opts":
|
|
|
|
self.mw.onDeckConf()
|
|
|
|
elif url == "cram":
|
2021-01-31 19:32:51 +01:00
|
|
|
aqt.dialogs.open("DynDeckConfDialog", self.mw)
|
2012-12-21 08:51:59 +01:00
|
|
|
elif url == "refresh":
|
2020-09-03 10:02:47 +02:00
|
|
|
self.mw.col.sched.rebuild_filtered_deck(self.mw.col.decks.selected())
|
2012-12-21 08:51:59 +01:00
|
|
|
self.mw.reset()
|
|
|
|
elif url == "empty":
|
2020-09-03 09:43:07 +02:00
|
|
|
self.mw.col.sched.empty_filtered_deck(self.mw.col.decks.selected())
|
2012-12-21 08:51:59 +01:00
|
|
|
self.mw.reset()
|
|
|
|
elif url == "decks":
|
|
|
|
self.mw.moveToState("deckBrowser")
|
|
|
|
elif url == "review":
|
2021-02-11 01:09:06 +01:00
|
|
|
openLink(f"{aqt.appShared}info/{self.sid}?v={self.sidVer}")
|
2020-08-27 13:46:34 +02:00
|
|
|
elif url == "studymore" or url == "customStudy":
|
2012-12-21 08:51:59 +01:00
|
|
|
self.onStudyMore()
|
rework sibling handling and change bury semantics
First, burying changes:
- unburying now happens on day rollover, or when manually unburying from
overview screen
- burying is not performed when returning to deck list, or when closing
collection, so burying now must mark cards as modified to ensure sync
consistent
- because they're no longer temporary to a session, make sure we exclude them
in filtered decks in -is:suspended
Sibling spacing changes:
- core behaviour now based on automatically burying related cards when we
answer a card
- applies to reviews, optionally to new cards, and never to cards in the
learning queue (partly because we can't suspend/bury cards in that queue at
the moment)
- this means spacing works consistently in filtered decks now, works on
reviews even when user is late to review, and provides better separation of
new cards
- if burying new cards disabled, we just discard them from the current queue.
an option to set due=ord*space+due would be nicer, but would require
changing a lot of code and is more appropriate for a future major version
change. discarding from queue suffers from the same issue as the new card
cycling in that queue rebuilds may cause cards to be shown close together,
so the default burying behaviour is preferable
- refer to them as 'related cards' rather than 'siblings'
These changes don't require any changes to the database format, so they
should hopefully coexist with older clients without issue.
2013-08-10 08:54:33 +02:00
|
|
|
elif url == "unbury":
|
2017-12-27 06:17:53 +01:00
|
|
|
self.onUnbury()
|
2013-01-14 23:42:38 +01:00
|
|
|
elif url.lower().startswith("http"):
|
2012-12-21 08:51:59 +01:00
|
|
|
openLink(url)
|
2016-05-31 10:51:40 +02:00
|
|
|
return False
|
2012-12-21 08:51:59 +01:00
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def _shortcutKeys(self) -> List[Tuple[str, Callable]]:
|
2017-06-22 08:36:54 +02:00
|
|
|
return [
|
|
|
|
("o", self.mw.onDeckConf),
|
|
|
|
("r", self.onRebuildKey),
|
|
|
|
("e", self.onEmptyKey),
|
|
|
|
("c", self.onCustomStudyKey),
|
2019-12-23 01:34:10 +01:00
|
|
|
("u", self.onUnbury),
|
2017-06-22 08:36:54 +02:00
|
|
|
]
|
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def _filteredDeck(self) -> int:
|
2019-12-23 01:34:10 +01:00
|
|
|
return self.mw.col.decks.current()["dyn"]
|
2017-06-22 08:36:54 +02:00
|
|
|
|
2021-02-01 14:28:21 +01:00
|
|
|
def onRebuildKey(self) -> None:
|
2017-06-22 08:36:54 +02:00
|
|
|
if self._filteredDeck():
|
2020-09-03 10:02:47 +02:00
|
|
|
self.mw.col.sched.rebuild_filtered_deck(self.mw.col.decks.selected())
|
2012-12-21 08:51:59 +01:00
|
|
|
self.mw.reset()
|
2017-06-22 08:36:54 +02:00
|
|
|
|
2021-02-01 14:28:21 +01:00
|
|
|
def onEmptyKey(self) -> None:
|
2017-06-22 08:36:54 +02:00
|
|
|
if self._filteredDeck():
|
2020-09-03 09:43:07 +02:00
|
|
|
self.mw.col.sched.empty_filtered_deck(self.mw.col.decks.selected())
|
2012-12-21 08:51:59 +01:00
|
|
|
self.mw.reset()
|
2017-06-22 08:36:54 +02:00
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def onCustomStudyKey(self) -> None:
|
2017-06-22 08:36:54 +02:00
|
|
|
if not self._filteredDeck():
|
2012-12-21 08:51:59 +01:00
|
|
|
self.onStudyMore()
|
2017-06-22 08:36:54 +02:00
|
|
|
|
2021-02-01 14:28:21 +01:00
|
|
|
def onUnbury(self) -> None:
|
2018-01-26 10:04:02 +01:00
|
|
|
if self.mw.col.schedVer() == 1:
|
|
|
|
self.mw.col.sched.unburyCardsForDeck()
|
|
|
|
self.mw.reset()
|
|
|
|
return
|
|
|
|
|
2020-08-27 13:53:28 +02:00
|
|
|
info = self.mw.col.sched.congratulations_info()
|
|
|
|
if info.have_sched_buried and info.have_user_buried:
|
2019-12-23 01:34:10 +01:00
|
|
|
opts = [
|
2020-11-17 08:42:43 +01:00
|
|
|
tr(TR.STUDYING_MANUALLY_BURIED_CARDS),
|
|
|
|
tr(TR.STUDYING_BURIED_SIBLINGS),
|
|
|
|
tr(TR.STUDYING_ALL_BURIED_CARDS),
|
|
|
|
tr(TR.ACTIONS_CANCEL),
|
2019-12-23 01:34:10 +01:00
|
|
|
]
|
2017-12-27 06:17:53 +01:00
|
|
|
|
2020-11-17 08:42:43 +01:00
|
|
|
diag = askUserDialog(tr(TR.STUDYING_WHAT_WOULD_YOU_LIKE_TO_UNBURY), opts)
|
2017-12-27 06:17:53 +01:00
|
|
|
diag.setDefault(0)
|
|
|
|
ret = diag.run()
|
|
|
|
if ret == opts[0]:
|
|
|
|
self.mw.col.sched.unburyCardsForDeck(type="manual")
|
|
|
|
elif ret == opts[1]:
|
|
|
|
self.mw.col.sched.unburyCardsForDeck(type="siblings")
|
|
|
|
elif ret == opts[2]:
|
|
|
|
self.mw.col.sched.unburyCardsForDeck(type="all")
|
|
|
|
else:
|
|
|
|
self.mw.col.sched.unburyCardsForDeck(type="all")
|
|
|
|
|
2017-06-22 08:36:54 +02:00
|
|
|
self.mw.reset()
|
2012-12-21 08:51:59 +01:00
|
|
|
|
|
|
|
# HTML
|
|
|
|
############################################################
|
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def _renderPage(self) -> None:
|
2012-12-21 08:51:59 +01:00
|
|
|
but = self.mw.button
|
|
|
|
deck = self.mw.col.decks.current()
|
|
|
|
self.sid = deck.get("sharedFrom")
|
|
|
|
if self.sid:
|
|
|
|
self.sidVer = deck.get("ver", None)
|
|
|
|
shareLink = '<a class=smallLink href="review">Reviews and Updates</a>'
|
|
|
|
else:
|
|
|
|
shareLink = ""
|
2021-01-25 12:11:03 +01:00
|
|
|
if self.mw.col.sched._is_finished():
|
2020-08-27 13:46:34 +02:00
|
|
|
self._show_finished_screen()
|
|
|
|
return
|
2021-01-25 12:11:03 +01:00
|
|
|
table_text = self._table()
|
2020-02-17 16:49:21 +01:00
|
|
|
content = OverviewContent(
|
|
|
|
deck=deck["name"],
|
|
|
|
shareLink=shareLink,
|
|
|
|
desc=self._desc(deck),
|
|
|
|
table=self._table(),
|
|
|
|
)
|
|
|
|
gui_hooks.overview_will_render_content(self, content)
|
2019-12-23 01:34:10 +01:00
|
|
|
self.web.stdHtml(
|
2020-02-17 16:49:21 +01:00
|
|
|
self._body % content.__dict__,
|
2020-11-01 05:26:58 +01:00
|
|
|
css=["css/overview.css"],
|
2020-12-28 14:18:07 +01:00
|
|
|
js=["js/vendor/jquery.min.js", "js/overview.js"],
|
2020-02-12 22:00:13 +01:00
|
|
|
context=self,
|
2019-12-23 01:34:10 +01:00
|
|
|
)
|
2012-12-21 08:51:59 +01:00
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def _show_finished_screen(self) -> None:
|
2020-08-27 13:53:28 +02:00
|
|
|
self.web.load_ts_page("congrats")
|
2020-08-27 13:46:34 +02:00
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def _desc(self, deck: Dict[str, Any]) -> str:
|
2019-12-23 01:34:10 +01:00
|
|
|
if deck["dyn"]:
|
2020-11-18 02:32:22 +01:00
|
|
|
desc = tr(TR.STUDYING_THIS_IS_A_SPECIAL_DECK_FOR)
|
2021-02-11 01:09:06 +01:00
|
|
|
desc += f" {tr(TR.STUDYING_CARDS_WILL_BE_AUTOMATICALLY_RETURNED_TO)}"
|
|
|
|
desc += f" {tr(TR.STUDYING_DELETING_THIS_DECK_FROM_THE_DECK)}"
|
2012-12-21 08:51:59 +01:00
|
|
|
else:
|
|
|
|
desc = deck.get("desc", "")
|
2021-02-09 09:46:48 +01:00
|
|
|
if deck.get("md", False):
|
|
|
|
desc = self.mw.col.render_markdown(desc)
|
2012-12-21 08:51:59 +01:00
|
|
|
if not desc:
|
|
|
|
return "<p>"
|
2019-12-23 01:34:10 +01:00
|
|
|
if deck["dyn"]:
|
2012-12-21 08:51:59 +01:00
|
|
|
dyn = "dyn"
|
|
|
|
else:
|
|
|
|
dyn = ""
|
2021-02-11 01:09:06 +01:00
|
|
|
return f'<div class="descfont descmid description {dyn}">{desc}</div>'
|
2012-12-21 08:51:59 +01:00
|
|
|
|
2020-08-27 13:46:34 +02:00
|
|
|
def _table(self) -> Optional[str]:
|
2012-12-21 08:51:59 +01:00
|
|
|
counts = list(self.mw.col.sched.counts())
|
|
|
|
but = self.mw.button
|
2021-01-25 12:11:03 +01:00
|
|
|
return """
|
2018-09-28 09:54:43 +02:00
|
|
|
<table width=400 cellpadding=5>
|
2012-12-21 08:51:59 +01:00
|
|
|
<tr><td align=center valign=top>
|
|
|
|
<table cellspacing=5>
|
2020-01-23 06:08:10 +01:00
|
|
|
<tr><td>%s:</td><td><b><span class=new-count>%s</span></b></td></tr>
|
2020-02-19 09:46:12 +01:00
|
|
|
<tr><td>%s:</td><td><b><span class=learn-count>%s</span></b></td></tr>
|
2020-01-23 06:08:10 +01:00
|
|
|
<tr><td>%s:</td><td><b><span class=review-count>%s</span></b></td></tr>
|
2012-12-21 08:51:59 +01:00
|
|
|
</table>
|
|
|
|
</td><td align=center>
|
2019-12-23 01:34:10 +01:00
|
|
|
%s</td></tr></table>""" % (
|
2021-01-25 12:11:03 +01:00
|
|
|
tr(TR.ACTIONS_NEW),
|
|
|
|
counts[0],
|
|
|
|
tr(TR.SCHEDULING_LEARNING),
|
|
|
|
counts[1],
|
|
|
|
tr(TR.STUDYING_TO_REVIEW),
|
|
|
|
counts[2],
|
|
|
|
but("study", tr(TR.STUDYING_STUDY_NOW), id="study", extra=" autofocus"),
|
|
|
|
)
|
2012-12-21 08:51:59 +01:00
|
|
|
|
|
|
|
_body = """
|
|
|
|
<center>
|
|
|
|
<h3>%(deck)s</h3>
|
|
|
|
%(shareLink)s
|
|
|
|
%(desc)s
|
|
|
|
%(table)s
|
|
|
|
</center>
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Bottom area
|
|
|
|
######################################################################
|
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def _renderBottom(self) -> None:
|
2012-12-21 08:51:59 +01:00
|
|
|
links = [
|
2020-11-17 08:42:43 +01:00
|
|
|
["O", "opts", tr(TR.ACTIONS_OPTIONS)],
|
2012-12-21 08:51:59 +01:00
|
|
|
]
|
2019-12-23 01:34:10 +01:00
|
|
|
if self.mw.col.decks.current()["dyn"]:
|
2020-11-17 08:42:43 +01:00
|
|
|
links.append(["R", "refresh", tr(TR.ACTIONS_REBUILD)])
|
|
|
|
links.append(["E", "empty", tr(TR.STUDYING_EMPTY)])
|
2012-12-21 08:51:59 +01:00
|
|
|
else:
|
2020-11-17 08:42:43 +01:00
|
|
|
links.append(["C", "studymore", tr(TR.ACTIONS_CUSTOM_STUDY)])
|
2019-12-23 01:34:10 +01:00
|
|
|
# links.append(["F", "cram", _("Filter/Cram")])
|
rework sibling handling and change bury semantics
First, burying changes:
- unburying now happens on day rollover, or when manually unburying from
overview screen
- burying is not performed when returning to deck list, or when closing
collection, so burying now must mark cards as modified to ensure sync
consistent
- because they're no longer temporary to a session, make sure we exclude them
in filtered decks in -is:suspended
Sibling spacing changes:
- core behaviour now based on automatically burying related cards when we
answer a card
- applies to reviews, optionally to new cards, and never to cards in the
learning queue (partly because we can't suspend/bury cards in that queue at
the moment)
- this means spacing works consistently in filtered decks now, works on
reviews even when user is late to review, and provides better separation of
new cards
- if burying new cards disabled, we just discard them from the current queue.
an option to set due=ord*space+due would be nicer, but would require
changing a lot of code and is more appropriate for a future major version
change. discarding from queue suffers from the same issue as the new card
cycling in that queue rebuilds may cause cards to be shown close together,
so the default burying behaviour is preferable
- refer to them as 'related cards' rather than 'siblings'
These changes don't require any changes to the database format, so they
should hopefully coexist with older clients without issue.
2013-08-10 08:54:33 +02:00
|
|
|
if self.mw.col.sched.haveBuried():
|
2020-11-17 08:42:43 +01:00
|
|
|
links.append(["U", "unbury", tr(TR.STUDYING_UNBURY)])
|
2012-12-21 08:51:59 +01:00
|
|
|
buf = ""
|
|
|
|
for b in links:
|
|
|
|
if b[0]:
|
2020-11-17 12:47:47 +01:00
|
|
|
b[0] = tr(TR.ACTIONS_SHORTCUT_KEY, val=shortcut(b[0]))
|
2012-12-21 08:51:59 +01:00
|
|
|
buf += """
|
2019-12-23 01:34:10 +01:00
|
|
|
<button title="%s" onclick='pycmd("%s")'>%s</button>""" % tuple(
|
|
|
|
b
|
|
|
|
)
|
2020-02-12 22:00:13 +01:00
|
|
|
self.bottom.draw(
|
|
|
|
buf=buf, link_handler=self._linkHandler, web_context=OverviewBottomBar(self)
|
|
|
|
)
|
2012-12-21 08:51:59 +01:00
|
|
|
|
|
|
|
# Studying more
|
|
|
|
######################################################################
|
|
|
|
|
2021-02-01 13:08:56 +01:00
|
|
|
def onStudyMore(self) -> None:
|
2012-12-21 08:51:59 +01:00
|
|
|
import aqt.customstudy
|
2019-12-23 01:34:10 +01:00
|
|
|
|
2012-12-21 08:51:59 +01:00
|
|
|
aqt.customstudy.CustomStudy(self.mw)
|