ChessPenguin 0.6.3
Some checks failed
CI / macos-build (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / check (push) Waiting to run
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / publish (push) Has been cancelled
Some checks failed
CI / macos-build (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / check (push) Waiting to run
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / publish (push) Has been cancelled
Opening index: games from a set-up position are left to the pass; exact preparation progress; quiet import notes; clearer preparation text; randomized Mega test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4b92fa32de
commit
e11e09aa18
13 changed files with 305 additions and 67 deletions
|
|
@ -1550,20 +1550,20 @@ const ROWS: &[[&str; 6]] = &[
|
|||
"+ Aggiungi motore…",
|
||||
],
|
||||
[
|
||||
"Preparing fast position search… {p} %",
|
||||
"Подготовка быстрого поиска по позиции… {p} %",
|
||||
"Préparation de la recherche rapide par position… {p} %",
|
||||
"Schnelle Stellungssuche wird vorbereitet… {p} %",
|
||||
"Preparando la búsqueda rápida por posición… {p} %",
|
||||
"Preparazione della ricerca rapida per posizione… {p} %",
|
||||
"Speeding up search in this database (once)… {p} %",
|
||||
"Ускоряю поиск по этой базе (один раз)… {p} %",
|
||||
"Accélération de la recherche dans cette base (une seule fois)… {p} %",
|
||||
"Suche in dieser Datenbank wird beschleunigt (einmalig)… {p} %",
|
||||
"Acelerando la búsqueda en esta base (una sola vez)… {p} %",
|
||||
"Velocizzo la ricerca in questa base (una volta sola)… {p} %",
|
||||
],
|
||||
[
|
||||
"The search index of the base is built once and kept in the cache.",
|
||||
"Индекс поиска по базе строится один раз и хранится в кэше.",
|
||||
"L'index de recherche de la base est construit une fois et conservé dans le cache.",
|
||||
"Der Suchindex der Datenbank wird einmal erstellt und im Cache behalten.",
|
||||
"El índice de búsqueda de la base se construye una vez y se guarda en la caché.",
|
||||
"L'indice di ricerca della base viene costruito una volta e tenuto nella cache.",
|
||||
"An index for fast position search is built once and kept in the cache. Searching works meanwhile, only slower.",
|
||||
"Строится индекс для быстрого поиска по позиции. Это делается один раз, результат хранится в кэше. Пока идёт подготовка, поиск работает, но медленнее.",
|
||||
"Un index pour la recherche rapide par position est construit une fois et conservé dans le cache. La recherche fonctionne en attendant, mais plus lentement.",
|
||||
"Ein Index für die schnelle Stellungssuche wird einmal erstellt und im Cache behalten. Die Suche funktioniert währenddessen, nur langsamer.",
|
||||
"Se construye una vez un índice para la búsqueda rápida por posición y se guarda en la caché. Mientras tanto la búsqueda funciona, aunque más despacio.",
|
||||
"Un indice per la ricerca rapida per posizione viene costruito una volta e tenuto nella cache. Nel frattempo la ricerca funziona, solo più lentamente.",
|
||||
],
|
||||
[
|
||||
"Position search needs about {n} MB of free memory for this database.",
|
||||
|
|
|
|||
|
|
@ -239,7 +239,8 @@ pub struct LargeView {
|
|||
/// Building the search index of the base (our booster when `.cbb` cannot be used,
|
||||
/// the opening positions), once the board is used; `booster_failed` keeps a
|
||||
/// failure from being retried.
|
||||
booster: Option<Background<bool>>,
|
||||
/// The job and the work it has to do (in its progress units).
|
||||
booster: Option<(Background<bool>, usize)>,
|
||||
booster_failed: bool,
|
||||
board: SearchBoard,
|
||||
only_order: bool,
|
||||
|
|
@ -461,7 +462,7 @@ impl LargeView {
|
|||
/// Builds the search index in the background when the board is in use and the
|
||||
/// base lacks something (`Base::prepare`); searches meanwhile run without it.
|
||||
fn update_booster(&mut self, db: &Arc<Database>, now: f64, ctx: &egui::Context) {
|
||||
if let Some(b) = &self.booster
|
||||
if let Some((b, _)) = &self.booster
|
||||
&& let Some(result) = b.poll()
|
||||
{
|
||||
self.booster = None;
|
||||
|
|
@ -475,8 +476,9 @@ impl LargeView {
|
|||
{
|
||||
return;
|
||||
}
|
||||
let work = db.as_chessbase().map_or(0, |b| b.prepare_work());
|
||||
let db = db.clone();
|
||||
self.booster = Background::spawn(ctx, now, move |progress, cancel| {
|
||||
let job = Background::spawn(ctx, now, move |progress, cancel| {
|
||||
match db.as_chessbase()?.prepare(progress, cancel) {
|
||||
Ok(true) => Some(true),
|
||||
Ok(false) => None,
|
||||
|
|
@ -486,6 +488,7 @@ impl LargeView {
|
|||
}
|
||||
}
|
||||
});
|
||||
self.booster = job.map(|j| (j, work));
|
||||
}
|
||||
|
||||
fn start(&mut self, db: &Arc<Database>, request: Request, now: f64, ctx: &egui::Context) {
|
||||
|
|
@ -590,20 +593,19 @@ impl LargeView {
|
|||
.job
|
||||
.as_ref()
|
||||
.map(|j| (j.work.progress() as f32 / total.max(1) as f32).min(1.0));
|
||||
if let Some(b) = &self.booster {
|
||||
// The pass over the records, then the sort of the index.
|
||||
let p = (b.progress() as f32 / (2 * total).max(1) as f32).min(1.0);
|
||||
if let Some((b, work)) = &self.booster {
|
||||
let p = (b.progress() as f32 / (*work).max(1) as f32).min(1.0);
|
||||
ui.horizontal(|ui| {
|
||||
ui.add(egui::Spinner::new().size(14.0));
|
||||
ui.label(
|
||||
RichText::new(trf(
|
||||
"Preparing fast position search… {p} %",
|
||||
"Speeding up search in this database (once)… {p} %",
|
||||
&[("p", &format!("{:.0}", p * 100.0))],
|
||||
))
|
||||
.weak(),
|
||||
)
|
||||
.on_hover_text(tr(
|
||||
"The search index of the base is built once and kept in the cache.",
|
||||
"An index for fast position search is built once and kept in the cache. Searching works meanwhile, only slower.",
|
||||
));
|
||||
});
|
||||
}
|
||||
|
|
@ -1330,12 +1332,7 @@ impl LargeView {
|
|||
ui.add(egui::Spinner::new().size(14.0));
|
||||
ui.label(RichText::new(format!("{:.0} %", p * 100.0)).weak());
|
||||
}
|
||||
if notes > 0
|
||||
&& ui
|
||||
.button(RichText::new(format!("⚠ {notes}")).color(ui.visuals().warn_fg_color))
|
||||
.on_hover_text(tr("Import notes"))
|
||||
.clicked()
|
||||
{
|
||||
if notes > 0 && crate::widgets::notes_button(ui, notes).clicked() {
|
||||
open_notes = true;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ impl Library {
|
|||
ui.add_space(4.0);
|
||||
egui::ScrollArea::vertical().max_height(420.0).show(ui, |ui| {
|
||||
for n in &info.notes {
|
||||
ui.label(RichText::new(format!("⚠ {n}")).color(ui.visuals().warn_fg_color));
|
||||
ui.label(format!("• {n}"));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -838,14 +838,7 @@ impl Library {
|
|||
}
|
||||
}
|
||||
let notes = self.info.get(&path).map_or(0, |i| i.notes.len());
|
||||
if notes > 0
|
||||
&& ui
|
||||
.button(
|
||||
RichText::new(format!("⚠ {notes}")).color(ui.visuals().warn_fg_color),
|
||||
)
|
||||
.on_hover_text(tr("Import notes"))
|
||||
.clicked()
|
||||
{
|
||||
if notes > 0 && crate::widgets::notes_button(ui, notes).clicked() {
|
||||
self.notes_open = Some(path.clone());
|
||||
}
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
|
|
|
|||
|
|
@ -26,3 +26,9 @@ fn x_button(ui: &mut Ui, size: egui::Vec2, d: f32) -> egui::Response {
|
|||
.line_segment([c + vec2(-d, d), c + vec2(d, -d)], stroke);
|
||||
resp
|
||||
}
|
||||
|
||||
/// The quiet "ℹ n" of import notes: minor remarks, so no colour and no frame.
|
||||
pub fn notes_button(ui: &mut egui::Ui, notes: usize) -> egui::Response {
|
||||
ui.add(egui::Button::new(egui::RichText::new(format!("ℹ {notes}")).weak().small()).frame(false))
|
||||
.on_hover_text(crate::i18n::tr("Import notes"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue