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
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use std::env;
use anyhow::Result;
use ninja_gen::action::BuildAction;
use ninja_gen::archives::Platform;
@ -125,7 +123,14 @@ impl BuildAction for BuildWheel {
}
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);
// Set the project directory based on which package we're building
@ -222,15 +227,19 @@ struct Sphinx {
impl BuildAction for Sphinx {
fn command(&self) -> &str {
if env::var("OFFLINE_BUILD").is_err() {
"$uv sync --extra sphinx && $python python/sphinx/build.py"
} else {
if std::env::var("OFFLINE_BUILD").ok().as_deref() == Some("1") {
"$python python/sphinx/build.py"
} else {
"$uv sync --extra sphinx && $python python/sphinx/build.py"
}
}
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"]);
// Set environment variable to use the existing 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-suspend-leeches = Suspend leeches
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
# to show the total number of cards that can be recalled or retrieved on a
# specific date.

View file

@ -9,17 +9,23 @@ use anyhow::Result;
pub fn relaunch_in_terminal() -> Result<()> {
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 = [
("x-terminal-emulator", vec!["-e"]),
("gnome-terminal", vec!["--"]),
("konsole", vec!["-e"]),
("xfce4-terminal", vec!["-e"]),
// commonly used for riced systems
("alacritty", vec!["-e"]),
("kitty", vec![]),
// minimalistic terminals for constrained systems
("foot", vec![]),
("urxvt", 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 {

View file

@ -181,6 +181,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
margin-bottom: 1.5rem;
}
.modal {
z-index: 1066;
background-color: rgba($color: black, $alpha: 0.5);
}
.modal-title {
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) {
opacity: 0;
display: none;
cursor: initial;
}
</style>

View file

@ -20,53 +20,64 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</script>
<Item>
<div class="easy-days-settings">
<table>
<thead>
<tr>
<th></th>
<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}
<tr>
<td class="day">{day}</td>
<td colspan="3">
<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 class="container">
<div class="easy-days-settings">
<span></span>
<span class="header min-col">{tr.deckConfigEasyDaysMinimum()}</span>
<span class="header">{tr.deckConfigEasyDaysReduced()}</span>
<span class="header normal-col">{tr.deckConfigEasyDaysNormal()}</span>
{#each easyDays as day, index}
<span class="day">{day}</span>
<div class="input-container">
<input
type="range"
bind:value={values[index]}
step={0.5}
max={1.0}
min={0.0}
list="easy_day_steplist"
/>
</div>
{/each}
</div>
</div>
</Item>
<style>
.easy-days-settings table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
<style lang="scss">
.container {
display: flex;
justify-content: center;
}
.easy-days-settings th,
.easy-days-settings td {
padding: 8px;
border-bottom: var(--border) solid 1px;
.easy-days-settings {
width: 100%;
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;
}
}
.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 {
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;
font-size: smaller;
}
.min-col {
text-align: start;
}
.normal-col {
text-align: end;
}
</style>

View file

@ -296,7 +296,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
min={0}
max={9999}
>
<SettingTitle on:click={() => openHelpModal("simulateFsrsReview")}>
<SettingTitle on:click={() => openHelpModal("newLimit")}>
{tr.schedulingNewCardsday()}
</SettingTitle>
</SpinBoxRow>
@ -307,7 +307,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
min={0}
max={9999}
>
<SettingTitle on:click={() => openHelpModal("simulateFsrsReview")}>
<SettingTitle on:click={() => openHelpModal("reviewLimit")}>
{tr.schedulingMaximumReviewsday()}
</SettingTitle>
</SpinBoxRow>
@ -327,9 +327,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
min={1}
max={36500}
>
<SettingTitle
on:click={() => openHelpModal("simulateFsrsReview")}
>
<SettingTitle on:click={() => openHelpModal("maximumInterval")}>
{tr.schedulingMaximumInterval()}
</SettingTitle>
</SpinBoxRow>
@ -339,9 +337,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
defaultValue={$config.reviewOrder}
choices={reviewOrderChoices($fsrs)}
>
<SettingTitle
on:click={() => openHelpModal("simulateFsrsReview")}
>
<SettingTitle on:click={() => openHelpModal("reviewSortOrder")}>
{tr.deckConfigReviewSortOrder()}
</SettingTitle>
</EnumSelectorRow>
@ -351,7 +347,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
defaultValue={$newCardsIgnoreReviewLimit}
>
<SettingTitle
on:click={() => openHelpModal("simulateFsrsReview")}
on:click={() => openHelpModal("newCardsIgnoreReviewLimit")}
>
<GlobalLabel
title={tr.deckConfigNewCardsIgnoreReviewLimit()}
@ -372,9 +368,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
defaultValue={$config.leechAction ==
DeckConfig_Config_LeechAction.SUSPEND}
>
<SettingTitle
on:click={() => openHelpModal("simulateFsrsReview")}
>
<SettingTitle on:click={() => openHelpModal("leechAction")}>
{tr.deckConfigSuspendLeeches()}
</SettingTitle>
</SwitchRow>
@ -387,7 +381,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
max={9999}
>
<SettingTitle
on:click={() => openHelpModal("simulateFsrsReview")}
on:click={() => openHelpModal("leechThreshold")}
>
{tr.schedulingLeechThreshold()}
</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'}"
disabled={computing}
on:click={() => {
$config.newPerDay = simulateFsrsRequest.newLimit;
$config.reviewsPerDay = simulateFsrsRequest.reviewLimit;
$config.maximumReviewInterval = simulateFsrsRequest.maxInterval;
$config.desiredRetention = simulateFsrsRequest.desiredRetention;
$newCardsIgnoreReviewLimit =
simulateFsrsRequest.newCardsIgnoreReviewLimit;
$config.reviewOrder = simulateFsrsRequest.reviewOrder;
$config.leechAction = suspendLeeches
? DeckConfig_Config_LeechAction.SUSPEND
: DeckConfig_Config_LeechAction.TAG_ONLY;
$config.leechThreshold = leechThreshold;
$config.easyDaysPercentages = [...easyDayPercentages];
onPresetChange();
if (confirm(tr.deckConfigSaveOptionsToPresetConfirm())) {
$config.newPerDay = simulateFsrsRequest.newLimit;
$config.reviewsPerDay = simulateFsrsRequest.reviewLimit;
$config.maximumReviewInterval =
simulateFsrsRequest.maxInterval;
$config.desiredRetention =
simulateFsrsRequest.desiredRetention;
$newCardsIgnoreReviewLimit =
simulateFsrsRequest.newCardsIgnoreReviewLimit;
$config.reviewOrder = simulateFsrsRequest.reviewOrder;
$config.leechAction = suspendLeeches
? DeckConfig_Config_LeechAction.SUSPEND
: DeckConfig_Config_LeechAction.TAG_ONLY;
$config.leechThreshold = leechThreshold;
$config.easyDaysPercentages = [...easyDayPercentages];
onPresetChange();
}
}}
>
{tr.deckConfigSaveOptionsToPreset()}