Merge branch 'main' into ally-fix-border-ratio-too-low

This commit is contained in:
GithubAnon0000 2025-07-07 11:15:46 +00:00 committed by GitHub
commit 31ae59ee14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 112 additions and 90 deletions

View file

@ -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) {
build.add_inputs("uv", inputs![":uv_binary"]); 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("", &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");

View file

@ -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.

View file

@ -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 {

View file

@ -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;
} }

View file

@ -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>

View file

@ -20,53 +20,64 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</script> </script>
<Item> <Item>
<div class="easy-days-settings"> <div class="container">
<table> <div class="easy-days-settings">
<thead> <span></span>
<tr> <span class="header min-col">{tr.deckConfigEasyDaysMinimum()}</span>
<th></th> <span class="header">{tr.deckConfigEasyDaysReduced()}</span>
<th class="header min-col"> <span class="header normal-col">{tr.deckConfigEasyDaysNormal()}</span>
<span>{tr.deckConfigEasyDaysMinimum()}</span>
</th> {#each easyDays as day, index}
<th class="header text-center"> <span class="day">{day}</span>
<span>{tr.deckConfigEasyDaysReduced()}</span> <div class="input-container">
</th> <input
<th class="header normal-col"> type="range"
<span>{tr.deckConfigEasyDaysNormal()}</span> bind:value={values[index]}
</th> step={0.5}
</tr> max={1.0}
</thead> min={0.0}
<tbody> list="easy_day_steplist"
{#each easyDays as day, index} />
<tr> </div>
<td class="day">{day}</td> {/each}
<td colspan="3"> </div>
<input
type="range"
bind:value={values[index]}
step={0.5}
max={1.0}
min={0.0}
list="easy_day_steplist"
/>
</td>
</tr>
{/each}
</tbody>
</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-bottom: var(--border) solid 1px; border-collapse: collapse;
display: grid;
grid-template-columns: auto 1fr 1fr 1fr;
border-collapse: collapse;
& > * {
padding: 8px 16px;
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;
@ -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>

View file

@ -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,19 +441,23 @@ 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={() => {
$config.newPerDay = simulateFsrsRequest.newLimit; if (confirm(tr.deckConfigSaveOptionsToPresetConfirm())) {
$config.reviewsPerDay = simulateFsrsRequest.reviewLimit; $config.newPerDay = simulateFsrsRequest.newLimit;
$config.maximumReviewInterval = simulateFsrsRequest.maxInterval; $config.reviewsPerDay = simulateFsrsRequest.reviewLimit;
$config.desiredRetention = simulateFsrsRequest.desiredRetention; $config.maximumReviewInterval =
$newCardsIgnoreReviewLimit = simulateFsrsRequest.maxInterval;
simulateFsrsRequest.newCardsIgnoreReviewLimit; $config.desiredRetention =
$config.reviewOrder = simulateFsrsRequest.reviewOrder; simulateFsrsRequest.desiredRetention;
$config.leechAction = suspendLeeches $newCardsIgnoreReviewLimit =
? DeckConfig_Config_LeechAction.SUSPEND simulateFsrsRequest.newCardsIgnoreReviewLimit;
: DeckConfig_Config_LeechAction.TAG_ONLY; $config.reviewOrder = simulateFsrsRequest.reviewOrder;
$config.leechThreshold = leechThreshold; $config.leechAction = suspendLeeches
$config.easyDaysPercentages = [...easyDayPercentages]; ? DeckConfig_Config_LeechAction.SUSPEND
onPresetChange(); : DeckConfig_Config_LeechAction.TAG_ONLY;
$config.leechThreshold = leechThreshold;
$config.easyDaysPercentages = [...easyDayPercentages];
onPresetChange();
}
}} }}
> >
{tr.deckConfigSaveOptionsToPreset()} {tr.deckConfigSaveOptionsToPreset()}