Merge branch 'main' into svelte-reviewer-bottom

This commit is contained in:
Luc Mcgrady 2025-11-19 20:56:39 +00:00 committed by GitHub
commit d8108c93a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 46 additions and 15 deletions

View file

@ -254,6 +254,7 @@ nav1s <nav1s@proton.me>
Ranjit Odedra <ranjitodedra.dev@gmail.com> Ranjit Odedra <ranjitodedra.dev@gmail.com>
Eltaurus <https://github.com/Eltaurus-Lt> Eltaurus <https://github.com/Eltaurus-Lt>
jariji jariji
Francisco Esteva <fr.esteva@duocuc.cl>
******************** ********************

View file

@ -47,6 +47,9 @@
<property name="insertPolicy"> <property name="insertPolicy">
<enum>QComboBox::NoInsert</enum> <enum>QComboBox::NoInsert</enum>
</property> </property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLengthWithIcon</enum>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

View file

@ -94,8 +94,15 @@ class TTSPlayer:
rank -= 1 rank -= 1
# if no preferred voices match, we fall back on language # if no requested voices match, use a preferred fallback voice
# with a rank of -100 # (for example, Apple Samantha) with rank of -50
for avail in avail_voices:
if avail.lang == tag.lang:
if avail.lang == "en_US" and avail.name.startswith("Apple_Samantha"):
return TTSVoiceMatch(voice=avail, rank=-50)
# if no requested or preferred voices match, we fall back on
# the first available voice for the language, with a rank of -100
for avail in avail_voices: for avail in avail_voices:
if avail.lang == tag.lang: if avail.lang == tag.lang:
return TTSVoiceMatch(voice=avail, rank=-100) return TTSVoiceMatch(voice=avail, rank=-100)

View file

@ -809,7 +809,7 @@ def ensureWidgetInScreenBoundaries(widget: QWidget) -> None:
wsize = widget.size() wsize = widget.size()
cappedWidth = min(geom.width(), wsize.width()) cappedWidth = min(geom.width(), wsize.width())
cappedHeight = min(geom.height(), wsize.height()) cappedHeight = min(geom.height(), wsize.height())
if cappedWidth > wsize.width() or cappedHeight > wsize.height(): if cappedWidth < wsize.width() or cappedHeight < wsize.height():
widget.resize(QSize(cappedWidth, cappedHeight)) widget.resize(QSize(cappedWidth, cappedHeight))
# ensure widget is inside top left # ensure widget is inside top left

View file

@ -1,6 +1,7 @@
// 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::collections::HashSet;
use std::io::BufRead; use std::io::BufRead;
use std::io::BufReader; use std::io::BufReader;
use std::io::Read; use std::io::Read;
@ -106,6 +107,8 @@ struct ColumnContext {
notetype_column: Option<usize>, notetype_column: Option<usize>,
/// Source column indices for the fields of a notetype /// Source column indices for the fields of a notetype
field_source_columns: FieldSourceColumns, field_source_columns: FieldSourceColumns,
/// Metadata column indices (1-based)
meta_columns: HashSet<usize>,
/// How fields are converted to strings. Used for escaping HTML if /// How fields are converted to strings. Used for escaping HTML if
/// appropriate. /// appropriate.
stringify: fn(&str) -> String, stringify: fn(&str) -> String,
@ -119,6 +122,7 @@ impl ColumnContext {
deck_column: metadata.deck()?.column(), deck_column: metadata.deck()?.column(),
notetype_column: metadata.notetype()?.column(), notetype_column: metadata.notetype()?.column(),
field_source_columns: metadata.field_source_columns()?, field_source_columns: metadata.field_source_columns()?,
meta_columns: metadata.meta_columns(),
stringify: stringify_fn(metadata.is_html), stringify: stringify_fn(metadata.is_html),
}) })
} }
@ -166,11 +170,19 @@ impl ColumnContext {
} }
fn gather_note_fields(&self, record: &csv::StringRecord) -> Vec<Option<String>> { fn gather_note_fields(&self, record: &csv::StringRecord) -> Vec<Option<String>> {
let stringify = self.stringify; let op = |i| record.get(i - 1).map(self.stringify);
self.field_source_columns if !self.field_source_columns.is_empty() {
.iter() self.field_source_columns
.map(|opt| opt.and_then(|idx| record.get(idx - 1)).map(stringify)) .iter()
.collect() .map(|opt| opt.and_then(op))
.collect()
} else {
// notetype column provided, assume all non-metadata columns are notetype fields
(1..=record.len())
.filter(|i| !self.meta_columns.contains(i))
.map(op)
.collect()
}
} }
} }

View file

@ -291,11 +291,8 @@ impl CsvMetadataHelpers for CsvMetadata {
.map(|&i| (i > 0).then_some(i as usize)) .map(|&i| (i > 0).then_some(i as usize))
.collect(), .collect(),
CsvNotetype::NotetypeColumn(_) => { CsvNotetype::NotetypeColumn(_) => {
let meta_columns = self.meta_columns(); // each row's notetype could have varying number of fields
(1..self.column_labels.len() + 1) vec![]
.filter(|idx| !meta_columns.contains(idx))
.map(Some)
.collect()
} }
}) })
} }

View file

@ -443,9 +443,20 @@ impl Collection {
.storage .storage
.get_deck(card.deck_id)? .get_deck(card.deck_id)?
.or_not_found(card.deck_id)?; .or_not_found(card.deck_id)?;
let config = self.home_deck_config(deck.config_id(), card.original_deck_id)?; let home_deck = if card.original_deck_id.0 == 0 {
&deck
} else {
&self
.storage
.get_deck(card.original_deck_id)?
.or_not_found(card.original_deck_id)?
};
let config = self
.storage
.get_deck_config(home_deck.config_id().or_invalid("home deck is filtered")?)?
.unwrap_or_default();
let desired_retention = deck.effective_desired_retention(&config); let desired_retention = home_deck.effective_desired_retention(&config);
let fsrs_enabled = self.get_config_bool(BoolKey::Fsrs); let fsrs_enabled = self.get_config_bool(BoolKey::Fsrs);
let fsrs_next_states = if fsrs_enabled { let fsrs_next_states = if fsrs_enabled {
let params = config.fsrs_params(); let params = config.fsrs_params();