SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Press Pull: the dialog the Q shortcut opens is titled "Press Pull", not "Extrude" (#11705) (#11712)
Sebastian7bb016e5e4ea
diff --git a/assets/locales/pending/press-pull-dialog-title.json b/assets/locales/pending/press-pull-dialog-title.jsonnew file mode 100644index 0000000000..af7c74cc80--- /dev/null+++ b/assets/locales/pending/press-pull-dialog-title.json@@ -0,0 +1,10 @@+{+ "ar": { "ui.heading_press_pull": "ضغط وسحب" },+ "de": { "ui.heading_press_pull": "DRÜCKEN/ZIEHEN" },+ "en": { "ui.heading_press_pull": "PRESS PULL" },+ "he": { "ui.heading_press_pull": "דחיפה/משיכה" },+ "ja": { "ui.heading_press_pull": "プレス プル" },+ "ko": { "ui.heading_press_pull": "밀기/당기기" },+ "vi": { "ui.heading_press_pull": "KÉO/ĐẨY" },+ "zh": { "ui.heading_press_pull": "按压拖动" }+}diff --git a/attribution/pending/press-pull-dialog-title.md b/attribution/pending/press-pull-dialog-title.mdnew file mode 100644index 0000000000..9c09149471--- /dev/null+++ b/attribution/pending/press-pull-dialog-title.md@@ -0,0 +1 @@+| assets/locales/pending/press-pull-dialog-title.json | SolidCraft contributors | Original Press Pull dialog title translations for SolidCraft's English catalog; no external text used | MIT OR Apache-2.0 |diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rsindex b635422fb2..bf4c4f2bc2 100644--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@ -2631,6 +2631,18 @@ fn title(k: &Kind) -> &'static str {}}+/// Whether the dialog is an extrude opened by Press Pull (the Q shortcut), which says+/// PRESS PULL, not EXTRUDE (#11705).+fn press_pull_extrude(d: &Dialog) -> bool {+ d.press_pull && matches!(d.kind, Kind::Extrude { .. })+}++/// The dialog's title: an extrude opened by Press Pull (the Q shortcut) says PRESS PULL, not+/// EXTRUDE (#11705).+fn title_of(d: &Dialog) -> &'static str {+ if press_pull_extrude(d) { "PRESS PULL" } else { title(&d.kind) }+}+fn hint(inp: &SelInput) -> &'static str {let a = inp.accept;if a & PROFILES != 0 {@@ -3831,7 +3843,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {let mut value_fields = Vec::new();let wide = matches!(&d.kind, Kind::Motion(k) if k.wide());- let raw_title = title(&d.kind);+ let raw_title = title_of(&d);let heading = if d.editing.is_some() { crate::i18n::format("dialog.edit_title", &[("title", tr(raw_title))]) } else { tr(raw_title).to_string() };let frame = crate::ui_kit::Panel::feature_frame(ctx, app.ui.layout, side);// OK is offered once the inputs make a feature.@@ -3866,7 +3878,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {);let grow_key = egui::Id::unique(("sc_dialog_label_grow", raw_title));let label_grow = ctx.data(|data| data.get_temp::<f32>(grow_key)).unwrap_or(0.0).min((vp.width() - t.space_24 - card_width(&d)).max(0.0));- let panel = crate::ui_kit::Panel::new(&heading, egui::Id::unique(("sc_dialog", title(&d.kind))), anchor, drag_bounds, side, frame)+ let panel = crate::ui_kit::Panel::new(&heading, egui::Id::unique(("sc_dialog", title_of(&d))), anchor, drag_bounds, side, frame).actions(ok_label, close_label);let panel = if let Some(column) = column {panel.width(column.width()).joined(crate::ui_kit::DockEdges { left: true, top: true, ..Default::default() })@@ -3888,7 +3900,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {let mut painted = false;if let Kind::ConfirmDelete { with, fail, .. } = &d.kind {let detail = with.join(" · ");- let (closed, action) = crate::ui_kit::Confirm::new(egui::Id::unique(("sc_dialog", title(&d.kind))), "delete", &heading)+ let (closed, action) = crate::ui_kit::Confirm::new(egui::Id::unique(("sc_dialog", title_of(&d))), "delete", &heading).tone(crate::ui_kit::Tone::Danger).actions("Delete", "Cancel", None).detail(&detail)@@ -3907,7 +3919,12 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {} else {let response = window.open(&mut keep).show(ctx, |ui| {painted = ui.is_visible() && !ui.is_sizing_pass();- let spec = dense::command(&d.kind).and_then(solidcraft_engine::find_command);+ // A Press Pull's extrude shows the Press Pull command, not Extrude (#11705).+ let spec = if press_pull_extrude(&d) {+ solidcraft_engine::find_command("solid.press_pull")+ } else {+ dense::command(&d.kind).and_then(solidcraft_engine::find_command)+ };let icon = spec.as_ref().map_or("", |s| s.icon);let label = spec.as_ref().map_or(heading.as_str(), |s| tr(s.label));let label = if d.editing.is_some() { heading.as_str() } else { label };@@ -4991,7 +5008,7 @@ pub(crate) fn feature_frame(s: &Session, component: u64) -> solidcraft_engine::d/// The feature dialog's current operation name for a reviewed issue draft.pub(crate) fn report_title(d: &Dialog) -> String {- title(&d.kind).to_string()+ title_of(d).to_string()}/// The commands OK runs (an edit rebuilds its feature in place); the live preview runs the same.diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 9708dd61f5..f80b5ef2c5 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -2179,12 +2179,12 @@ impl SolveApp {}let empty = sel.is_empty();self.start("solid.extrude");- if empty- && let Some(d) = &mut self.dialog- && let Some(input) = d.inputs.first_mut()- {- input.accept |= selection::FACES | selection::EDGES;+ if let Some(d) = &mut self.dialog {+ // Opened by Press Pull, so the dialog says so, whatever was picked (#11705).d.press_pull = true;+ if empty && let Some(input) = d.inputs.first_mut() {+ input.accept |= selection::FACES | selection::EDGES;+ }}return;}diff --git a/crates/ui-egui/src/preselect_tests.rs b/crates/ui-egui/src/preselect_tests.rsindex 0a9a210e3c..06a646c176 100644--- a/crates/ui-egui/src/preselect_tests.rs+++ b/crates/ui-egui/src/preselect_tests.rs@@ -932,6 +932,58 @@ fn press_pull_then_curved_face_offsets_it() {assert!(matches!(app.dialog.as_ref().unwrap().kind, Kind::Extrude { .. }));}+/// Whether an accessibility node labeled `text` is drawn inside the published rect+/// `rect_handle` ("dialog:header" is the dialog's heading band), so a same-named widget+/// elsewhere on screen cannot satisfy the check.+fn label_in(h: &crate::scenario::Harness, rect_handle: &str, text: &str) -> bool {+ let Some(rect) = crate::scenario::rect_of(rect_handle) else { return false };+ let Some(tree) = h.output.accesskit_update.as_ref() else { return false };+ tree.nodes.iter().any(|(_, n)| {+ (n.label() == Some(text) || n.value() == Some(text))+ && n.bounds().is_some_and(|b| rect.contains(egui::pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32)))+ })+}++/// The dialog the Q shortcut opens says Press Pull, not Extrude (#11705), with a planar face+/// picked first or nothing at all; a plain Extrude still says Extrude.+#[test]+fn press_pull_dialog_is_titled_press_pull() {+ let mut app = boxed();+ let top = face(&app, Vec3::new(20.0, 15.0, 20.0));+ let d = start(&mut app, vec![top], "solid.press_pull");+ assert!(matches!(d.kind, Kind::Extrude { .. }));+ assert!(d.press_pull);+ assert_eq!(crate::dialogs::report_title(&d), "PRESS PULL");++ let mut app = boxed();+ app.start("solid.press_pull");+ let d = app.dialog.clone().unwrap();+ assert!(matches!(d.kind, Kind::Extrude { .. }));+ assert!(d.press_pull);+ assert_eq!(crate::dialogs::report_title(&d), "PRESS PULL");++ let mut app = boxed();+ app.start("solid.extrude");+ let d = app.dialog.clone().unwrap();+ assert!(matches!(d.kind, Kind::Extrude { .. }));+ assert!(!d.press_pull);+ assert_eq!(crate::dialogs::report_title(&d), "EXTRUDE");++ // The heading drawn in the panel says it too, found by role and place in its band.+ let mut h = crate::scenario::Harness::new();+ h.app.run("solid.box", json!({"length": 40, "width": 30, "height": 20})).unwrap();+ h.step(&json!({"start": "solid.press_pull"})).unwrap();+ h.frames(2);+ assert!(label_in(&h, "dialog:header", "Press Pull"), "the drawn header is Press Pull");+ assert!(!label_in(&h, "dialog:header", "Extrude"), "the drawn header is not Extrude");++ let mut h = crate::scenario::Harness::new();+ h.app.run("solid.box", json!({"length": 40, "width": 30, "height": 20})).unwrap();+ h.step(&json!({"start": "solid.extrude"})).unwrap();+ h.frames(2);+ assert!(label_in(&h, "dialog:header", "Extrude"), "a plain Extrude header is Extrude");+}+/// Press Pull on a fillet's round face reopens the fillet to change its radius, as the/// command does, rather than an Offset Face that refuses it (#1932): picked first, or picked/// with Press Pull already open.diff --git a/crates/ui-egui/tests/scenarios/press_pull_dialog_title.json b/crates/ui-egui/tests/scenarios/press_pull_dialog_title.jsonnew file mode 100644index 0000000000..74152f7b96--- /dev/null+++ b/crates/ui-egui/tests/scenarios/press_pull_dialog_title.json@@ -0,0 +1,10 @@+[+ {"note": "#11705: the Q shortcut is Press Pull, so the dialog it opens says Press Pull, not Extrude; a plain Extrude (E) still says Extrude."},+ {"call": "engine.execute", "params": {"command": "solid.box", "params": {"length": 40, "width": 30, "height": 20}}},+ {"key": "Q"},+ {"expect": {"dialog": "press_pull: true", "shown": "Press Pull", "errors": 0}},+ {"key": "Escape"},+ {"expect": {"dialog": null, "errors": 0}},+ {"key": "E"},+ {"expect": {"dialog": "press_pull: false", "shown": "Extrude", "errors": 0}}+]