mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
Merge branch 'main' into ally-fix-border-ratio-too-low
This commit is contained in:
commit
31ae59ee14
7 changed files with 112 additions and 90 deletions
|
@ -1,8 +1,6 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use std::env;
|
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ninja_gen::action::BuildAction;
|
use ninja_gen::action::BuildAction;
|
||||||
use ninja_gen::archives::Platform;
|
use ninja_gen::archives::Platform;
|
||||||
|
@ -125,7 +123,14 @@ impl BuildAction for BuildWheel {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn files(&mut self, build: &mut impl FilesHandle) {
|
fn files(&mut self, build: &mut impl FilesHandle) {
|
||||||
|
if std::env::var("OFFLINE_BUILD").ok().as_deref() == Some("1") {
|
||||||
|
let uv_path =
|
||||||
|
std::env::var("UV_BINARY").expect("UV_BINARY must be set in OFFLINE_BUILD mode");
|
||||||
|
build.add_inputs("uv", inputs![uv_path]);
|
||||||
|
} else {
|
||||||
build.add_inputs("uv", inputs![":uv_binary"]);
|
build.add_inputs("uv", inputs![":uv_binary"]);
|
||||||
|
}
|
||||||
|
|
||||||
build.add_inputs("", &self.deps);
|
build.add_inputs("", &self.deps);
|
||||||
|
|
||||||
// Set the project directory based on which package we're building
|
// Set the project directory based on which package we're building
|
||||||
|
@ -222,15 +227,19 @@ struct Sphinx {
|
||||||
|
|
||||||
impl BuildAction for Sphinx {
|
impl BuildAction for Sphinx {
|
||||||
fn command(&self) -> &str {
|
fn command(&self) -> &str {
|
||||||
if env::var("OFFLINE_BUILD").is_err() {
|
if std::env::var("OFFLINE_BUILD").ok().as_deref() == Some("1") {
|
||||||
"$uv sync --extra sphinx && $python python/sphinx/build.py"
|
|
||||||
} else {
|
|
||||||
"$python python/sphinx/build.py"
|
"$python python/sphinx/build.py"
|
||||||
|
} else {
|
||||||
|
"$uv sync --extra sphinx && $python python/sphinx/build.py"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn files(&mut self, build: &mut impl FilesHandle) {
|
fn files(&mut self, build: &mut impl FilesHandle) {
|
||||||
if env::var("OFFLINE_BUILD").is_err() {
|
if std::env::var("OFFLINE_BUILD").ok().as_deref() == Some("1") {
|
||||||
|
let uv_path =
|
||||||
|
std::env::var("UV_BINARY").expect("UV_BINARY must be set in OFFLINE_BUILD mode");
|
||||||
|
build.add_inputs("uv", inputs![uv_path]);
|
||||||
|
} else {
|
||||||
build.add_inputs("uv", inputs![":uv_binary"]);
|
build.add_inputs("uv", inputs![":uv_binary"]);
|
||||||
// Set environment variable to use the existing pyenv
|
// Set environment variable to use the existing pyenv
|
||||||
build.add_variable("pyenv_path", "$builddir/pyenv");
|
build.add_variable("pyenv_path", "$builddir/pyenv");
|
||||||
|
|
|
@ -514,6 +514,7 @@ deck-config-advanced-settings = Advanced Settings
|
||||||
deck-config-smooth-graph = Smooth graph
|
deck-config-smooth-graph = Smooth graph
|
||||||
deck-config-suspend-leeches = Suspend leeches
|
deck-config-suspend-leeches = Suspend leeches
|
||||||
deck-config-save-options-to-preset = Save Changes to Preset
|
deck-config-save-options-to-preset = Save Changes to Preset
|
||||||
|
deck-config-save-options-to-preset-confirm = Overwrite the options in your current preset with the options that are currently set in the simulator?
|
||||||
# Radio button in the FSRS simulation diagram (Deck options -> FSRS) selecting
|
# Radio button in the FSRS simulation diagram (Deck options -> FSRS) selecting
|
||||||
# to show the total number of cards that can be recalled or retrieved on a
|
# to show the total number of cards that can be recalled or retrieved on a
|
||||||
# specific date.
|
# specific date.
|
||||||
|
|
|
@ -9,17 +9,23 @@ use anyhow::Result;
|
||||||
pub fn relaunch_in_terminal() -> Result<()> {
|
pub fn relaunch_in_terminal() -> Result<()> {
|
||||||
let current_exe = std::env::current_exe().context("Failed to get current executable path")?;
|
let current_exe = std::env::current_exe().context("Failed to get current executable path")?;
|
||||||
|
|
||||||
// Try terminals in order of preference
|
// Try terminals in roughly most specific to least specific.
|
||||||
|
// First, try commonly used terminals for riced systems.
|
||||||
|
// Second, try the minimalist/compatibility terminals.
|
||||||
|
// Finally, try terminals usually installed by default.
|
||||||
let terminals = [
|
let terminals = [
|
||||||
("x-terminal-emulator", vec!["-e"]),
|
// commonly used for riced systems
|
||||||
("gnome-terminal", vec!["--"]),
|
|
||||||
("konsole", vec!["-e"]),
|
|
||||||
("xfce4-terminal", vec!["-e"]),
|
|
||||||
("alacritty", vec!["-e"]),
|
("alacritty", vec!["-e"]),
|
||||||
("kitty", vec![]),
|
("kitty", vec![]),
|
||||||
|
// minimalistic terminals for constrained systems
|
||||||
("foot", vec![]),
|
("foot", vec![]),
|
||||||
("urxvt", vec!["-e"]),
|
("urxvt", vec!["-e"]),
|
||||||
("xterm", vec!["-e"]),
|
("xterm", vec!["-e"]),
|
||||||
|
("x-terminal-emulator", vec!["-e"]),
|
||||||
|
// default installs for the most common distros
|
||||||
|
("xfce4-terminal", vec!["-e"]),
|
||||||
|
("gnome-terminal", vec!["--"]),
|
||||||
|
("konsole", vec!["-e"]),
|
||||||
];
|
];
|
||||||
|
|
||||||
for (terminal_cmd, args) in &terminals {
|
for (terminal_cmd, args) in &terminals {
|
||||||
|
|
|
@ -181,6 +181,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
z-index: 1066;
|
||||||
|
background-color: rgba($color: black, $alpha: 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
.modal-title {
|
.modal-title {
|
||||||
margin-inline-end: 0.75rem;
|
margin-inline-end: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
}
|
}
|
||||||
|
|
||||||
.hide :global(.badge) {
|
.hide :global(.badge) {
|
||||||
opacity: 0;
|
display: none;
|
||||||
cursor: initial;
|
cursor: initial;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -20,27 +20,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Item>
|
<Item>
|
||||||
|
<div class="container">
|
||||||
<div class="easy-days-settings">
|
<div class="easy-days-settings">
|
||||||
<table>
|
<span></span>
|
||||||
<thead>
|
<span class="header min-col">{tr.deckConfigEasyDaysMinimum()}</span>
|
||||||
<tr>
|
<span class="header">{tr.deckConfigEasyDaysReduced()}</span>
|
||||||
<th></th>
|
<span class="header normal-col">{tr.deckConfigEasyDaysNormal()}</span>
|
||||||
<th class="header min-col">
|
|
||||||
<span>{tr.deckConfigEasyDaysMinimum()}</span>
|
|
||||||
</th>
|
|
||||||
<th class="header text-center">
|
|
||||||
<span>{tr.deckConfigEasyDaysReduced()}</span>
|
|
||||||
</th>
|
|
||||||
<th class="header normal-col">
|
|
||||||
<span>{tr.deckConfigEasyDaysNormal()}</span>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{#each easyDays as day, index}
|
{#each easyDays as day, index}
|
||||||
<tr>
|
<span class="day">{day}</span>
|
||||||
<td class="day">{day}</td>
|
<div class="input-container">
|
||||||
<td colspan="3">
|
|
||||||
<input
|
<input
|
||||||
type="range"
|
type="range"
|
||||||
bind:value={values[index]}
|
bind:value={values[index]}
|
||||||
|
@ -49,25 +38,47 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
min={0.0}
|
min={0.0}
|
||||||
list="easy_day_steplist"
|
list="easy_day_steplist"
|
||||||
/>
|
/>
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</Item>
|
</Item>
|
||||||
|
|
||||||
<style>
|
<style lang="scss">
|
||||||
.easy-days-settings table {
|
.container {
|
||||||
width: 100%;
|
display: flex;
|
||||||
border-collapse: collapse;
|
justify-content: center;
|
||||||
table-layout: fixed;
|
|
||||||
}
|
}
|
||||||
.easy-days-settings th,
|
.easy-days-settings {
|
||||||
.easy-days-settings td {
|
width: 100%;
|
||||||
padding: 8px;
|
max-width: 1000px;
|
||||||
|
border-collapse: collapse;
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto 1fr 1fr 1fr;
|
||||||
|
|
||||||
|
border-collapse: collapse;
|
||||||
|
& > * {
|
||||||
|
padding: 8px 16px;
|
||||||
border-bottom: var(--border) solid 1px;
|
border-bottom: var(--border) solid 1px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.input-container {
|
||||||
|
grid-column: 2 / span 3;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
&.min-col {
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.normal-col {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
.header {
|
.header {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
|
@ -80,12 +91,4 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
}
|
}
|
||||||
|
|
||||||
.min-col {
|
|
||||||
text-align: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.normal-col {
|
|
||||||
text-align: end;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -296,7 +296,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
min={0}
|
min={0}
|
||||||
max={9999}
|
max={9999}
|
||||||
>
|
>
|
||||||
<SettingTitle on:click={() => openHelpModal("simulateFsrsReview")}>
|
<SettingTitle on:click={() => openHelpModal("newLimit")}>
|
||||||
{tr.schedulingNewCardsday()}
|
{tr.schedulingNewCardsday()}
|
||||||
</SettingTitle>
|
</SettingTitle>
|
||||||
</SpinBoxRow>
|
</SpinBoxRow>
|
||||||
|
@ -307,7 +307,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
min={0}
|
min={0}
|
||||||
max={9999}
|
max={9999}
|
||||||
>
|
>
|
||||||
<SettingTitle on:click={() => openHelpModal("simulateFsrsReview")}>
|
<SettingTitle on:click={() => openHelpModal("reviewLimit")}>
|
||||||
{tr.schedulingMaximumReviewsday()}
|
{tr.schedulingMaximumReviewsday()}
|
||||||
</SettingTitle>
|
</SettingTitle>
|
||||||
</SpinBoxRow>
|
</SpinBoxRow>
|
||||||
|
@ -327,9 +327,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
min={1}
|
min={1}
|
||||||
max={36500}
|
max={36500}
|
||||||
>
|
>
|
||||||
<SettingTitle
|
<SettingTitle on:click={() => openHelpModal("maximumInterval")}>
|
||||||
on:click={() => openHelpModal("simulateFsrsReview")}
|
|
||||||
>
|
|
||||||
{tr.schedulingMaximumInterval()}
|
{tr.schedulingMaximumInterval()}
|
||||||
</SettingTitle>
|
</SettingTitle>
|
||||||
</SpinBoxRow>
|
</SpinBoxRow>
|
||||||
|
@ -339,9 +337,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
defaultValue={$config.reviewOrder}
|
defaultValue={$config.reviewOrder}
|
||||||
choices={reviewOrderChoices($fsrs)}
|
choices={reviewOrderChoices($fsrs)}
|
||||||
>
|
>
|
||||||
<SettingTitle
|
<SettingTitle on:click={() => openHelpModal("reviewSortOrder")}>
|
||||||
on:click={() => openHelpModal("simulateFsrsReview")}
|
|
||||||
>
|
|
||||||
{tr.deckConfigReviewSortOrder()}
|
{tr.deckConfigReviewSortOrder()}
|
||||||
</SettingTitle>
|
</SettingTitle>
|
||||||
</EnumSelectorRow>
|
</EnumSelectorRow>
|
||||||
|
@ -351,7 +347,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
defaultValue={$newCardsIgnoreReviewLimit}
|
defaultValue={$newCardsIgnoreReviewLimit}
|
||||||
>
|
>
|
||||||
<SettingTitle
|
<SettingTitle
|
||||||
on:click={() => openHelpModal("simulateFsrsReview")}
|
on:click={() => openHelpModal("newCardsIgnoreReviewLimit")}
|
||||||
>
|
>
|
||||||
<GlobalLabel
|
<GlobalLabel
|
||||||
title={tr.deckConfigNewCardsIgnoreReviewLimit()}
|
title={tr.deckConfigNewCardsIgnoreReviewLimit()}
|
||||||
|
@ -372,9 +368,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
defaultValue={$config.leechAction ==
|
defaultValue={$config.leechAction ==
|
||||||
DeckConfig_Config_LeechAction.SUSPEND}
|
DeckConfig_Config_LeechAction.SUSPEND}
|
||||||
>
|
>
|
||||||
<SettingTitle
|
<SettingTitle on:click={() => openHelpModal("leechAction")}>
|
||||||
on:click={() => openHelpModal("simulateFsrsReview")}
|
|
||||||
>
|
|
||||||
{tr.deckConfigSuspendLeeches()}
|
{tr.deckConfigSuspendLeeches()}
|
||||||
</SettingTitle>
|
</SettingTitle>
|
||||||
</SwitchRow>
|
</SwitchRow>
|
||||||
|
@ -387,7 +381,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
max={9999}
|
max={9999}
|
||||||
>
|
>
|
||||||
<SettingTitle
|
<SettingTitle
|
||||||
on:click={() => openHelpModal("simulateFsrsReview")}
|
on:click={() => openHelpModal("leechThreshold")}
|
||||||
>
|
>
|
||||||
{tr.schedulingLeechThreshold()}
|
{tr.schedulingLeechThreshold()}
|
||||||
</SettingTitle>
|
</SettingTitle>
|
||||||
|
@ -447,10 +441,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
class="btn {computing ? 'btn-warning' : 'btn-primary'}"
|
class="btn {computing ? 'btn-warning' : 'btn-primary'}"
|
||||||
disabled={computing}
|
disabled={computing}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
if (confirm(tr.deckConfigSaveOptionsToPresetConfirm())) {
|
||||||
$config.newPerDay = simulateFsrsRequest.newLimit;
|
$config.newPerDay = simulateFsrsRequest.newLimit;
|
||||||
$config.reviewsPerDay = simulateFsrsRequest.reviewLimit;
|
$config.reviewsPerDay = simulateFsrsRequest.reviewLimit;
|
||||||
$config.maximumReviewInterval = simulateFsrsRequest.maxInterval;
|
$config.maximumReviewInterval =
|
||||||
$config.desiredRetention = simulateFsrsRequest.desiredRetention;
|
simulateFsrsRequest.maxInterval;
|
||||||
|
$config.desiredRetention =
|
||||||
|
simulateFsrsRequest.desiredRetention;
|
||||||
$newCardsIgnoreReviewLimit =
|
$newCardsIgnoreReviewLimit =
|
||||||
simulateFsrsRequest.newCardsIgnoreReviewLimit;
|
simulateFsrsRequest.newCardsIgnoreReviewLimit;
|
||||||
$config.reviewOrder = simulateFsrsRequest.reviewOrder;
|
$config.reviewOrder = simulateFsrsRequest.reviewOrder;
|
||||||
|
@ -460,6 +457,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
$config.leechThreshold = leechThreshold;
|
$config.leechThreshold = leechThreshold;
|
||||||
$config.easyDaysPercentages = [...easyDayPercentages];
|
$config.easyDaysPercentages = [...easyDayPercentages];
|
||||||
onPresetChange();
|
onPresetChange();
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tr.deckConfigSaveOptionsToPreset()}
|
{tr.deckConfigSaveOptionsToPreset()}
|
||||||
|
|
Loading…
Reference in a new issue