mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
* Feature Question Action Show Reminder (#3064) Added a option in the deck config that allow the user to choose in Autoupdate mode between showing a reminder or revealing the card. Also added my name to the contributors * Update ftl/core/deck-config.ftl
This commit is contained in:
parent
e486d6b513
commit
d8f2782c26
9 changed files with 77 additions and 3 deletions
|
@ -171,7 +171,9 @@ ijqq <ijqq@protonmail.ch>
|
|||
AntoineQ1 <https://github.com/AntoineQ1>
|
||||
jthulhu <https://github.com/jthulhu>
|
||||
Escape0707 <tothesong@gmail.com>
|
||||
Loudwig <https://github.com/Loudwig>
|
||||
Wu Yi-Wei <https://github.com/Ianwu0812>
|
||||
|
||||
********************
|
||||
|
||||
The text of the 3 clause BSD license follows:
|
||||
|
|
|
@ -237,6 +237,10 @@ deck-config-seconds-to-show-question = Seconds to show question for
|
|||
deck-config-seconds-to-show-question-tooltip-2 = When auto advance is activated, the number of seconds to wait before revealing the answer. Set to 0 to disable.
|
||||
deck-config-seconds-to-show-answer = Seconds to show answer for
|
||||
deck-config-seconds-to-show-answer-tooltip-2 = When auto advance is activated, the number of seconds to wait before applying the answer action. Set to 0 to disable.
|
||||
deck-config-question-action-show-answer = Show Answer
|
||||
deck-config-question-action-show-reminder = Show Reminder
|
||||
deck-config-question-action = Question action
|
||||
deck-config-question-action-tool-tip = The action to perform after the question is shown, and time has elapsed.
|
||||
deck-config-answer-action = Answer action
|
||||
deck-config-answer-action-tooltip = The action to perform on the current card before automatically advancing to the next one.
|
||||
deck-config-wait-for-audio-tooltip = Wait for audio to finish before automatically revealing answer or next question
|
||||
|
|
|
@ -56,4 +56,5 @@ studying-minute =
|
|||
[one] { $count } minute.
|
||||
*[other] { $count } minutes.
|
||||
}
|
||||
studying-question-time-elapsed = Question time elapsed
|
||||
studying-answer-time-elapsed = Answer time elapsed
|
||||
|
|
|
@ -100,7 +100,10 @@ message DeckConfig {
|
|||
ANSWER_ACTION_ANSWER_HARD = 3;
|
||||
ANSWER_ACTION_SHOW_REMINDER = 4;
|
||||
}
|
||||
|
||||
enum QuestionAction {
|
||||
QUESTION_ACTION_SHOW_ANSWER = 0;
|
||||
QUESTION_ACTION_SHOW_REMINDER = 1;
|
||||
}
|
||||
repeated float learn_steps = 1;
|
||||
repeated float relearn_steps = 2;
|
||||
|
||||
|
@ -144,6 +147,7 @@ message DeckConfig {
|
|||
bool stop_timer_on_answer = 38;
|
||||
float seconds_to_show_question = 41;
|
||||
float seconds_to_show_answer = 42;
|
||||
QuestionAction question_action = 36;
|
||||
AnswerAction answer_action = 43;
|
||||
bool wait_for_audio = 44;
|
||||
bool skip_question_when_replaying_answer = 26;
|
||||
|
|
|
@ -137,6 +137,11 @@ class AnswerAction(Enum):
|
|||
SHOW_REMINDER = 4
|
||||
|
||||
|
||||
class QuestionAction(Enum):
|
||||
SHOW_ANSWER = 0
|
||||
SHOW_REMINDER = 1
|
||||
|
||||
|
||||
class Reviewer:
|
||||
def __init__(self, mw: AnkiQt) -> None:
|
||||
self.mw = mw
|
||||
|
@ -423,7 +428,15 @@ class Reviewer:
|
|||
):
|
||||
self.auto_advance_enabled = False
|
||||
return
|
||||
self._showAnswer()
|
||||
try:
|
||||
question_action = list(QuestionAction)[conf["questionAction"]]
|
||||
except IndexError:
|
||||
question_action = QuestionAction.SHOW_ANSWER
|
||||
|
||||
if question_action == QuestionAction.SHOW_ANSWER:
|
||||
self._showAnswer()
|
||||
else:
|
||||
tooltip(tr.studying_question_time_elapsed())
|
||||
|
||||
def autoplay(self, card: Card) -> bool:
|
||||
print("use card.autoplay() instead of reviewer.autoplay(card)")
|
||||
|
|
|
@ -11,6 +11,7 @@ pub use anki_proto::deck_config::deck_config::config::LeechAction;
|
|||
pub use anki_proto::deck_config::deck_config::config::NewCardGatherPriority;
|
||||
pub use anki_proto::deck_config::deck_config::config::NewCardInsertOrder;
|
||||
pub use anki_proto::deck_config::deck_config::config::NewCardSortOrder;
|
||||
pub use anki_proto::deck_config::deck_config::config::QuestionAction;
|
||||
pub use anki_proto::deck_config::deck_config::config::ReviewCardOrder;
|
||||
pub use anki_proto::deck_config::deck_config::config::ReviewMix;
|
||||
pub use anki_proto::deck_config::deck_config::Config as DeckConfigInner;
|
||||
|
@ -66,6 +67,7 @@ const DEFAULT_DECK_CONFIG_INNER: DeckConfigInner = DeckConfigInner {
|
|||
stop_timer_on_answer: false,
|
||||
seconds_to_show_question: 0.0,
|
||||
seconds_to_show_answer: 0.0,
|
||||
question_action: QuestionAction::ShowAnswer as i32,
|
||||
answer_action: AnswerAction::BuryCard as i32,
|
||||
wait_for_audio: true,
|
||||
skip_question_when_replaying_answer: false,
|
||||
|
|
|
@ -82,6 +82,8 @@ pub struct DeckConfSchema11 {
|
|||
#[serde(default)]
|
||||
seconds_to_show_answer: f32,
|
||||
#[serde(default)]
|
||||
question_action: QuestionAction,
|
||||
#[serde(default)]
|
||||
answer_action: AnswerAction,
|
||||
#[serde(default = "wait_for_audio_default")]
|
||||
wait_for_audio: bool,
|
||||
|
@ -94,6 +96,14 @@ pub struct DeckConfSchema11 {
|
|||
#[serde(flatten)]
|
||||
other: HashMap<String, Value>,
|
||||
}
|
||||
#[derive(Serialize_repr, Deserialize_repr, Debug, PartialEq, Eq, Clone)]
|
||||
#[repr(u8)]
|
||||
#[derive(Default)]
|
||||
pub enum QuestionAction {
|
||||
#[default]
|
||||
ShowAnswer = 0,
|
||||
ShowReminder = 1,
|
||||
}
|
||||
|
||||
#[derive(Serialize_repr, Deserialize_repr, Debug, PartialEq, Eq, Clone)]
|
||||
#[repr(u8)]
|
||||
|
@ -278,6 +288,7 @@ impl Default for DeckConfSchema11 {
|
|||
stop_timer_on_answer: false,
|
||||
seconds_to_show_question: 0.0,
|
||||
seconds_to_show_answer: 0.0,
|
||||
question_action: QuestionAction::ShowAnswer,
|
||||
answer_action: AnswerAction::BuryCard,
|
||||
wait_for_audio: true,
|
||||
replayq: true,
|
||||
|
@ -365,6 +376,7 @@ impl From<DeckConfSchema11> for DeckConfig {
|
|||
stop_timer_on_answer: c.stop_timer_on_answer,
|
||||
seconds_to_show_question: c.seconds_to_show_question,
|
||||
seconds_to_show_answer: c.seconds_to_show_answer,
|
||||
question_action: c.question_action as i32,
|
||||
answer_action: c.answer_action as i32,
|
||||
wait_for_audio: c.wait_for_audio,
|
||||
skip_question_when_replaying_answer: !c.replayq,
|
||||
|
@ -431,6 +443,10 @@ impl From<DeckConfig> for DeckConfSchema11 {
|
|||
4 => AnswerAction::ShowReminder,
|
||||
_ => AnswerAction::BuryCard,
|
||||
},
|
||||
question_action: match i.question_action {
|
||||
1 => QuestionAction::ShowReminder,
|
||||
_ => QuestionAction::ShowAnswer,
|
||||
},
|
||||
wait_for_audio: i.wait_for_audio,
|
||||
replayq: !i.skip_question_when_replaying_answer,
|
||||
dynamic: false,
|
||||
|
@ -509,6 +525,7 @@ static RESERVED_DECKCONF_KEYS: Set<&'static str> = phf_set! {
|
|||
"stopTimerOnAnswer",
|
||||
"secondsToShowQuestion",
|
||||
"secondsToShowAnswer",
|
||||
"questionAction",
|
||||
"answerAction",
|
||||
"waitForAudio",
|
||||
"sm2Retention",
|
||||
|
|
|
@ -17,7 +17,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
import TitledContainer from "$lib/components/TitledContainer.svelte";
|
||||
import type { HelpItem } from "$lib/components/types";
|
||||
|
||||
import { answerChoices } from "./choices";
|
||||
import { answerChoices, questionActionChoices } from "./choices";
|
||||
import type { DeckOptionsState } from "./lib";
|
||||
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
|
||||
|
||||
|
@ -44,6 +44,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
title: tr.deckConfigAnswerAction(),
|
||||
help: tr.deckConfigAnswerActionTooltip(),
|
||||
},
|
||||
questionAction: {
|
||||
title: tr.deckConfigQuestionAction(),
|
||||
help: tr.deckConfigQuestionActionToolTip(),
|
||||
},
|
||||
};
|
||||
const helpSections = Object.values(settings) as HelpItem[];
|
||||
|
||||
|
@ -130,5 +134,19 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
</SettingTitle>
|
||||
</EnumSelectorRow>
|
||||
</Item>
|
||||
<Item>
|
||||
<EnumSelectorRow
|
||||
bind:value={$config.questionAction}
|
||||
defaultValue={defaults.questionAction}
|
||||
choices={questionActionChoices()}
|
||||
>
|
||||
<SettingTitle
|
||||
on:click={() =>
|
||||
openHelpModal(Object.keys(settings).indexOf("questionAction"))}
|
||||
>
|
||||
{settings.questionAction.title}
|
||||
</SettingTitle>
|
||||
</EnumSelectorRow>
|
||||
</Item>
|
||||
</DynamicallySlottable>
|
||||
</TitledContainer>
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
DeckConfig_Config_NewCardGatherPriority,
|
||||
DeckConfig_Config_NewCardInsertOrder,
|
||||
DeckConfig_Config_NewCardSortOrder,
|
||||
DeckConfig_Config_QuestionAction,
|
||||
DeckConfig_Config_ReviewCardOrder,
|
||||
DeckConfig_Config_ReviewMix,
|
||||
} from "@generated/anki/deck_config_pb";
|
||||
|
@ -184,3 +185,15 @@ export function answerChoices(): Choice<DeckConfig_Config_AnswerAction>[] {
|
|||
},
|
||||
];
|
||||
}
|
||||
export function questionActionChoices(): Choice<DeckConfig_Config_QuestionAction>[] {
|
||||
return [
|
||||
{
|
||||
label: tr.deckConfigQuestionActionShowAnswer(),
|
||||
value: DeckConfig_Config_QuestionAction.SHOW_ANSWER,
|
||||
},
|
||||
{
|
||||
label: tr.deckConfigQuestionActionShowReminder(),
|
||||
value: DeckConfig_Config_QuestionAction.SHOW_REMINDER,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue