mirror of
https://github.com/ankitects/anki.git
synced 2026-01-11 04:53:55 -05:00
support setting showEstimates
This commit is contained in:
parent
bc7b50ed73
commit
529084f51b
1 changed files with 15 additions and 4 deletions
|
|
@ -6,6 +6,7 @@ from __future__ import annotations
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
from anki.utils import html_to_text_line
|
||||||
from collections.abc import Generator, Sequence
|
from collections.abc import Generator, Sequence
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
|
|
@ -1300,20 +1301,30 @@ class FlexibleReviewer(Reviewer):
|
||||||
else:
|
else:
|
||||||
browser.onSearchActivated()
|
browser.onSearchActivated()
|
||||||
|
|
||||||
def _add_middle_buttons_for_question_side(self) -> None:
|
def _answer_button_label(self, ease: int, label: str) -> str:
|
||||||
|
"""
|
||||||
|
If estTimes (showEstimates) are enabled, return the estimate as string.
|
||||||
|
Otherwise, return the first letter of the text label.
|
||||||
|
"""
|
||||||
|
if self.mw.col.conf["estTimes"]:
|
||||||
|
button_times = self.mw.col.sched.describe_next_states(self._v3.states)
|
||||||
|
return button_times[ease - 1]
|
||||||
|
else:
|
||||||
|
return html_to_text_line(label)[:1].upper()
|
||||||
|
|
||||||
|
def _add_middle_buttons_for_answer_side(self) -> None:
|
||||||
self.mw.bottomWidget.middle_bucket.reset(is_visible=True)
|
self.mw.bottomWidget.middle_bucket.reset(is_visible=True)
|
||||||
assert isinstance(self.mw.col.sched, V3Scheduler)
|
assert isinstance(self.mw.col.sched, V3Scheduler)
|
||||||
labels = self.mw.col.sched.describe_next_states(self._v3.states)
|
|
||||||
for ease, label in self._answerButtonList():
|
for ease, label in self._answerButtonList():
|
||||||
self.mw.bottomWidget.middle_bucket.add_button(
|
self.mw.bottomWidget.middle_bucket.add_button(
|
||||||
FlexiblePushButton(
|
FlexiblePushButton(
|
||||||
text=f"{labels[ease - 1]}[{ease_to_answer_key_short(ease)}]",
|
text=f"{self._answer_button_label(ease, label)}[{ease_to_answer_key_short(ease)}]",
|
||||||
text_color=self._ease_to_color[ease],
|
text_color=self._ease_to_color[ease],
|
||||||
),
|
),
|
||||||
on_clicked=partial(self._answerCard, cast(Literal[1, 2, 3, 4], ease)),
|
on_clicked=partial(self._answerCard, cast(Literal[1, 2, 3, 4], ease)),
|
||||||
)
|
)
|
||||||
|
|
||||||
def _add_middle_buttons_for_answer_side(self) -> None:
|
def _add_middle_buttons_for_question_side(self) -> None:
|
||||||
self.mw.bottomWidget.middle_bucket.reset(is_visible=True)
|
self.mw.bottomWidget.middle_bucket.reset(is_visible=True)
|
||||||
|
|
||||||
if self.mw.col.conf["dueCounts"]:
|
if self.mw.col.conf["dueCounts"]:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue