mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
./check
This commit is contained in:
parent
6c540c89f1
commit
860a8b4295
7 changed files with 74 additions and 44 deletions
|
@ -334,7 +334,7 @@ def is_sveltekit_page(path: str) -> bool:
|
|||
"import-csv",
|
||||
"import-page",
|
||||
"image-occlusion",
|
||||
"reviewer-bottom"
|
||||
"reviewer-bottom",
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -839,9 +839,7 @@ timerStopped = false;
|
|||
maxTime = self.card.time_limit() / 1000
|
||||
else:
|
||||
maxTime = 0
|
||||
self.bottom.web.eval(
|
||||
"_showQuestion(%s,%d);" % ("", maxTime)
|
||||
)
|
||||
self.bottom.web.eval("_showQuestion(%s,%d);" % ("", maxTime))
|
||||
|
||||
def _showEaseButtons(self) -> None:
|
||||
if not self._states_mutated:
|
||||
|
@ -853,11 +851,10 @@ timerStopped = false;
|
|||
f"_showAnswer({json.dumps(middle)}, {json.dumps(conf['stopTimerOnAnswer'])});"
|
||||
)
|
||||
|
||||
def _remaining(self) -> str:
|
||||
def _remaining(self):
|
||||
if not self.mw.col.conf["dueCounts"]:
|
||||
return ""
|
||||
|
||||
counts: list[int | str]
|
||||
idx, counts = self._v3.counts()
|
||||
self.bottom.web.eval(f"_updateRemaining({json.dumps(counts)},{idx})")
|
||||
|
||||
|
@ -889,13 +886,13 @@ timerStopped = false;
|
|||
)
|
||||
return buttons_tuple
|
||||
|
||||
def _answerButtons(self) -> str:
|
||||
def _answerButtons(self):
|
||||
default = self._defaultEase()
|
||||
|
||||
assert isinstance(self.mw.col.sched, V3Scheduler)
|
||||
labels = self.mw.col.sched.describe_next_states(self._v3.states)
|
||||
|
||||
def but(i: int, label: str) -> str:
|
||||
def but(i: int, label: str):
|
||||
if i == default:
|
||||
id = "defease"
|
||||
else:
|
||||
|
@ -915,7 +912,6 @@ timerStopped = false;
|
|||
}
|
||||
|
||||
return [but(ease, label) for ease, label in self._answerButtonList()]
|
||||
|
||||
|
||||
def _buttonTime(self, i: int, v3_labels: Sequence[str]) -> str:
|
||||
if self.mw.col.conf["estTimes"]:
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
<!--
|
||||
Copyright: Ankitects Pty Ltd and contributors
|
||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { writable } from "svelte/store";
|
||||
import { bridgeCommand } from "@tslib/bridgecommand";
|
||||
import ReviewerBottom from "./ReviewerBottom.svelte";
|
||||
import type {AnswerButtonInfo} from "./types"
|
||||
import "./index.scss"
|
||||
import type { AnswerButtonInfo } from "./types";
|
||||
import "./index.scss";
|
||||
|
||||
const answerButtons = writable<AnswerButtonInfo[]>([])
|
||||
const remaining = writable<[number, number, number]>([0, 0, 0])
|
||||
const remainingIndex = writable<number>(-1)
|
||||
const answerButtons = writable<AnswerButtonInfo[]>([]);
|
||||
const remaining = writable<[number, number, number]>([0, 0, 0]);
|
||||
const remainingIndex = writable<number>(-1);
|
||||
|
||||
onMount(() => {
|
||||
/*
|
||||
|
@ -37,7 +41,6 @@
|
|||
|
||||
let intervalId: number | undefined;
|
||||
|
||||
|
||||
function _showQuestion(_txt: string, _maxTime_: number): void {
|
||||
_showAnswer([]);
|
||||
globalThis.time = 0;
|
||||
|
@ -58,14 +61,14 @@
|
|||
}
|
||||
|
||||
function _showAnswer(info: AnswerButtonInfo[], _stopTimer = false): void {
|
||||
console.log(info)
|
||||
console.log(info);
|
||||
answerButtons.set(info);
|
||||
// timerStopped = stopTimer;
|
||||
}
|
||||
|
||||
function _updateRemaining(counts: [number, number, number], idx: number) {
|
||||
remaining.set(counts)
|
||||
remainingIndex.set(idx)
|
||||
remaining.set(counts);
|
||||
remainingIndex.set(idx);
|
||||
}
|
||||
|
||||
globalThis._showQuestion = _showQuestion;
|
||||
|
@ -85,5 +88,4 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
|
||||
<ReviewerBottom {answerButtons} {remaining} {remainingIndex}></ReviewerBottom>
|
||||
<ReviewerBottom {answerButtons} {remaining} {remainingIndex}></ReviewerBottom>
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
<!--
|
||||
Copyright: Ankitects Pty Ltd and contributors
|
||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { bridgeCommand } from "@tslib/bridgecommand";
|
||||
import type { AnswerButtonInfo } from "./types";
|
||||
|
||||
export let info: AnswerButtonInfo
|
||||
export let info: AnswerButtonInfo;
|
||||
</script>
|
||||
|
||||
<button on:click={()=>bridgeCommand(`ease${info.i}`)}>
|
||||
<button on:click={() => bridgeCommand(`ease${info.i}`)}>
|
||||
{info.label}
|
||||
</button>
|
||||
</button>
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
<!--
|
||||
Copyright: Ankitects Pty Ltd and contributors
|
||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
-->
|
||||
<script lang="ts">
|
||||
export let underlined: boolean
|
||||
export let cls: string
|
||||
export let underlined: boolean;
|
||||
export let cls: string;
|
||||
</script>
|
||||
|
||||
<span class={cls}>
|
||||
{#if underlined}
|
||||
<u><slot/></u>
|
||||
<u><slot /></u>
|
||||
{:else}
|
||||
<slot/>
|
||||
<slot />
|
||||
{/if}
|
||||
</span>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
<!--
|
||||
Copyright: Ankitects Pty Ltd and contributors
|
||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
-->
|
||||
<script lang="ts">
|
||||
import type { Writable } from "svelte/store";
|
||||
import AnswerButton from "./AnswerButton.svelte";
|
||||
|
@ -6,23 +10,34 @@
|
|||
import RemainingNumber from "./RemainingNumber.svelte";
|
||||
import type { AnswerButtonInfo } from "./types";
|
||||
|
||||
export let answerButtons: Writable<AnswerButtonInfo[]>
|
||||
export let remaining: Writable<number[]>
|
||||
export let remainingIndex: Writable<number>
|
||||
export let answerButtons: Writable<AnswerButtonInfo[]>;
|
||||
export let remaining: Writable<number[]>;
|
||||
export let remainingIndex: Writable<number>;
|
||||
|
||||
$: console.log($remaining)
|
||||
$: console.log($remaining);
|
||||
</script>
|
||||
|
||||
<div id="outer" class="fancy">
|
||||
<div id="tableinner">
|
||||
<div>
|
||||
<button title={tr.actionsShortcutKey({val: "E"})} on:click={()=>bridgeCommand("edit")}>{tr.studyingEdit()}</button>
|
||||
<button
|
||||
title={tr.actionsShortcutKey({ val: "E" })}
|
||||
on:click={() => bridgeCommand("edit")}
|
||||
>
|
||||
{tr.studyingEdit()}
|
||||
</button>
|
||||
</div>
|
||||
<div class="review-buttons">
|
||||
<span>
|
||||
<RemainingNumber cls="new-count" underlined={$remainingIndex === 0}>{$remaining[0]}</RemainingNumber> +
|
||||
<RemainingNumber cls="learn-count" underlined={$remainingIndex === 1}>{$remaining[1]}</RemainingNumber> +
|
||||
<RemainingNumber cls="review-count" underlined={$remainingIndex === 2}>{$remaining[2]}</RemainingNumber>
|
||||
<RemainingNumber cls="new-count" underlined={$remainingIndex === 0}>
|
||||
{$remaining[0]}
|
||||
</RemainingNumber> +
|
||||
<RemainingNumber cls="learn-count" underlined={$remainingIndex === 1}>
|
||||
{$remaining[1]}
|
||||
</RemainingNumber> +
|
||||
<RemainingNumber cls="review-count" underlined={$remainingIndex === 2}>
|
||||
{$remaining[2]}
|
||||
</RemainingNumber>
|
||||
</span>
|
||||
<div>
|
||||
{#if $answerButtons.length}
|
||||
|
@ -30,12 +45,19 @@
|
|||
<AnswerButton info={answerButton}></AnswerButton>
|
||||
{/each}
|
||||
{:else}
|
||||
<button on:click={()=>bridgeCommand("ans")}>{tr.studyingShowAnswer()}</button>
|
||||
<button on:click={() => bridgeCommand("ans")}>
|
||||
{tr.studyingShowAnswer()}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button on:click={()=>bridgeCommand("more")} title={tr.actionsShortcutKey({val: "M"})}>{tr.studyingMore()}↧</button>
|
||||
<button
|
||||
on:click={() => bridgeCommand("more")}
|
||||
title={tr.actionsShortcutKey({ val: "M" })}
|
||||
>
|
||||
{tr.studyingMore()}↧
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -52,6 +74,6 @@
|
|||
.review-buttons {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
// Copyright: Ankitects Pty Ltd and contributors
|
||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
export interface AnswerButtonInfo {
|
||||
"extra": string,
|
||||
"key": string,
|
||||
"i": number,
|
||||
"label": string,
|
||||
"due": string,
|
||||
}
|
||||
"extra": string;
|
||||
"key": string;
|
||||
"i": number;
|
||||
"label": string;
|
||||
"due": string;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue