From 098881741b215205dbf72d6c287757b6178ec2f0 Mon Sep 17 00:00:00 2001 From: RumovZ Date: Mon, 14 Feb 2022 09:57:01 +0100 Subject: [PATCH] Show buried until daily limits in overview screen (#1664) * Show buried until daily limits in overview screen This explains differences between the counts shown in the deck tree and those shown in the overview screen. Closes #1633. * interday learning cards can be buried too (dae) * add 'buried' tooltip to bury counts; generate row in helper fn (dae) * Use grey for buried counts --- qt/aqt/overview.py | 39 ++++++++++++++++++++++++++------------- sass/card-counts.scss | 14 ++++++++++++++ 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/qt/aqt/overview.py b/qt/aqt/overview.py index a11473e2f..84c5e2f75 100644 --- a/qt/aqt/overview.py +++ b/qt/aqt/overview.py @@ -221,25 +221,38 @@ class Overview: def _table(self) -> str | None: counts = list(self.mw.col.sched.counts()) + tree_counts = self.mw.col.sched.deck_due_tree( + self.mw.col.decks.get_current_id() + ) but = self.mw.button - return """ + buried_new = tree_counts.new_count - counts[0] + buried_learning = tree_counts.learn_count - counts[1] + buried_review = tree_counts.review_count - counts[2] + buried_label = tr.browsing_buried() + + def number_row(title: str, klass: str, count: int, buried_count: int) -> str: + return f""" + + {title}: + + + {count} + {buried_count or ""} + + + +""" + + return f"""
- - - +{number_row(tr.actions_new(), "new-count", counts[0], buried_new)} +{number_row(tr.scheduling_learning(), "learn-count", counts[1], buried_learning)} +{number_row(tr.studying_to_review(), "review-count", counts[2], buried_review)}
{}:{}
{}:{}
{}:{}
-{}
""".format( - tr.actions_new(), - counts[0], - tr.scheduling_learning(), - counts[1], - tr.studying_to_review(), - counts[2], - but("study", tr.studying_study_now(), id="study", extra=" autofocus"), - ) +{but("study", tr.studying_study_now(), id="study", extra=" autofocus")}""" _body = """
diff --git a/sass/card-counts.scss b/sass/card-counts.scss index 86bb2a520..767aec7e3 100644 --- a/sass/card-counts.scss +++ b/sass/card-counts.scss @@ -13,3 +13,17 @@ .zero-count { color: var(--zero-count); } + +.bury-count { + color: var(--disabled); + font-weight: bold; + margin-inline-start: 2px; + + &::before { + content: "+"; + } + + &:empty { + display: none; + } +}