From 335f25da06bb03c4f30ea0d0d7633a804401f7e9 Mon Sep 17 00:00:00 2001 From: aiongg Date: Fri, 16 Oct 2026 04:07:14 +0000 Subject: [PATCH] =?UTF-8?q?Integration:=20#1035=20Preflight=20Panel?= =?UTF-8?q?=E2=80=A6=20shows=20the=20panel=20when=20it=20is=20already=20op?= =?UTF-8?q?en=20instead=20of=20closing=20it;=20errors=20go=20to=20the=20st?= =?UTF-8?q?atus=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/ui-egui/src/chrome.rs | 18 +++++++++++++++++- crates/ui-egui/src/i18n/ar.rs | 1 + crates/ui-egui/src/i18n/cs.rs | 1 + crates/ui-egui/src/i18n/de.rs | 1 + crates/ui-egui/src/i18n/fr.rs | 1 + crates/ui-egui/src/i18n/ja.rs | 1 + crates/ui-egui/src/i18n/ka.rs | 1 + crates/ui-egui/src/i18n/pl.rs | 1 + crates/ui-egui/src/i18n/ru.rs | 1 + 9 files changed, 25 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index da05cfef1..9c83ffe69 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -735,6 +735,16 @@ pub fn doc_tabs(app: &mut DesignApp, ui: &mut egui::Ui) { } } +/// Show the Preflight panel. `window.panel` toggles a panel that is already open, so it runs +/// only when Preflight isn't showing. +fn show_preflight(app: &mut DesignApp) { + if app.ui.open_panel.as_deref() != Some("preflight") + && let Err(e) = app.run("window.panel", json!({"panel": "preflight"})) + { + app.status(e); + } +} + pub fn status_bar(app: &mut DesignApp, ui: &mut egui::Ui) { let t = Tokens::get(ui.ctx()); let resp = egui::Panel::bottom("status_bar") @@ -810,7 +820,7 @@ pub fn status_bar(app: &mut DesignApp, ui: &mut egui::Ui) { // As in InDesign, the count opens a menu that leads to the Preflight panel. crate::menus::menu_button(ui, egui::RichText::new(count).font(small.clone()), |ui| { if ui.button(crate::i18n::tr(&app.ui.language, "Preflight Panel…")).clicked() { - let _ = app.run("window.panel", json!({"panel": "preflight"})); + show_preflight(app); ui.close(); } }); @@ -1234,6 +1244,12 @@ mod tests { // Preflight is not a dock tab: `window.panel` shows it as its own panel. assert_eq!(h.state().app.ui.open_panel.as_deref(), Some("preflight")); h.get_by_label("Preflight"); + // With the panel already showing, the entry keeps it open. + h.get_by_label("No errors ▾").click(); + h.run_steps(3); + h.get_by_label("Preflight Panel…").click(); + h.run_steps(3); + assert_eq!(h.state().app.ui.open_panel.as_deref(), Some("preflight")); } /// A very long document name made its tab grow past the window, hiding the close button diff --git a/crates/ui-egui/src/i18n/ar.rs b/crates/ui-egui/src/i18n/ar.rs index c3d88b231..3d7b11e7a 100644 --- a/crates/ui-egui/src/i18n/ar.rs +++ b/crates/ui-egui/src/i18n/ar.rs @@ -1916,6 +1916,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[ ("Picas", "بيكا"), ("Place with Import Options", "وضع مع خيارات الاستيراد"), ("Preflight", "الفحص المسبق"), + ("Preflight Panel…", "لوحة الفحص المسبق…"), ("Previous", "السابق"), ("Previous Page Number", "رقم الصفحة السابقة"), ("Print Booklet", "طباعة كتيّب"), diff --git a/crates/ui-egui/src/i18n/cs.rs b/crates/ui-egui/src/i18n/cs.rs index 6b329db45..e77e72a1c 100644 --- a/crates/ui-egui/src/i18n/cs.rs +++ b/crates/ui-egui/src/i18n/cs.rs @@ -1710,6 +1710,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[ ("Paragraph Symbol", "Symbol odstavce"), ("Picas", "Piky"), ("Preflight", "Předtisková kontrola"), + ("Preflight Panel…", "Panel předtiskové kontroly…"), ("Previous Page Number", "Číslo předchozí stránky"), ("Punctuation Space", "Mezera šířky interpunkce"), ("Quarter Space", "Čtvrtina čtverčíku"), diff --git a/crates/ui-egui/src/i18n/de.rs b/crates/ui-egui/src/i18n/de.rs index fa7098797..adcd3110c 100644 --- a/crates/ui-egui/src/i18n/de.rs +++ b/crates/ui-egui/src/i18n/de.rs @@ -1728,6 +1728,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[ ("Paragraph Symbol", "Absatzzeichen"), ("Picas", "Pica"), ("Preflight", "Preflight"), + ("Preflight Panel…", "Preflight-Bedienfeld …"), ("Previous Page Number", "Vorherige Seitenzahl"), ("Punctuation Space", "Interpunktionsleerzeichen"), ("Quarter Space", "Viertelgeviert"), diff --git a/crates/ui-egui/src/i18n/fr.rs b/crates/ui-egui/src/i18n/fr.rs index 9ccb87a3d..46e0a1fae 100644 --- a/crates/ui-egui/src/i18n/fr.rs +++ b/crates/ui-egui/src/i18n/fr.rs @@ -146,6 +146,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[ ("Picas", "Picas"), ("Place with Import Options", "Importer avec les options d'importation"), ("Preflight", "Contrôle en amont"), + ("Preflight Panel…", "Panneau Contrôle en amont…"), ("Previous Page", "Page précédente"), ("Previous Page Number", "Numéro de la page précédente"), ("Print Booklet", "Imprimer le cahier"), diff --git a/crates/ui-egui/src/i18n/ja.rs b/crates/ui-egui/src/i18n/ja.rs index 7eea64d76..5acaa5e34 100644 --- a/crates/ui-egui/src/i18n/ja.rs +++ b/crates/ui-egui/src/i18n/ja.rs @@ -1926,6 +1926,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[ ("Paragraph Symbol", "段落記号"), ("Picas", "パイカ"), ("Preflight", "プリフライト"), + ("Preflight Panel…", "プリフライトパネル…"), ("Previous Page Number", "前のページ番号"), ("Punctuation Space", "句読点幅スペース"), ("Quarter Space", "四分スペース"), diff --git a/crates/ui-egui/src/i18n/ka.rs b/crates/ui-egui/src/i18n/ka.rs index a1d636398..09afe1abd 100644 --- a/crates/ui-egui/src/i18n/ka.rs +++ b/crates/ui-egui/src/i18n/ka.rs @@ -1738,6 +1738,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[ ("Paragraph Symbol", "აბზაცის სიმბოლო"), ("Picas", "პიკები"), ("Preflight", "ბეჭდვისწინა შემოწმება"), + ("Preflight Panel…", "ბეჭდვისწინა შემოწმების პანელი…"), ("Previous Page Number", "წინა გვერდის ნომერი"), ("Punctuation Space", "პუნქტუაციის შორისი"), ("Quarter Space", "მეოთხედი შორისი"), diff --git a/crates/ui-egui/src/i18n/pl.rs b/crates/ui-egui/src/i18n/pl.rs index ef41e6929..68d685d99 100644 --- a/crates/ui-egui/src/i18n/pl.rs +++ b/crates/ui-egui/src/i18n/pl.rs @@ -1682,6 +1682,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[ ("Paragraph Symbol", "Symbol akapitu"), ("Picas", "Pica"), ("Preflight", "Inspekcja wstępna"), + ("Preflight Panel…", "Panel inspekcji wstępnej…"), ("Previous Page Number", "Numer poprzedniej strony"), ("Punctuation Space", "Spacja interpunkcyjna"), ("Quarter Space", "Ćwierćfiret"), diff --git a/crates/ui-egui/src/i18n/ru.rs b/crates/ui-egui/src/i18n/ru.rs index dd52bb83e..251555ca5 100644 --- a/crates/ui-egui/src/i18n/ru.rs +++ b/crates/ui-egui/src/i18n/ru.rs @@ -1692,6 +1692,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[ ("Paragraph Symbol", "Знак абзаца"), ("Picas", "Пики"), ("Preflight", "Предпечатная проверка"), + ("Preflight Panel…", "Панель предпечатной проверки…"), ("Previous Page Number", "Номер предыдущей страницы"), ("Punctuation Space", "Пунктуационный пробел"), ("Quarter Space", "Четверть шпации"),