From 5bd85dded617a9617e3cfd01fd56968dc22372d6 Mon Sep 17 00:00:00 2001 From: DuBearte <130190089+DuBearte@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:30:40 +0000 Subject: [PATCH] Keyboard Shortcuts: the read-only list says so and leads to the editable page (#7409) (#7449) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * claim: #7409 * Keyboard Shortcuts: the read-only list says so and leads to the editable page (#7409) Home › Keyboard shortcuts and Help › Keyboard Shortcuts open the Shortcuts page read-only, in the Preferences window with its sidebar and Cancel/Apply/OK, so it looked exactly like Settings › Shortcuts with Import…, Reset All and recording missing. The read-only page now says "Read-only list: shortcuts can't be changed here." and has an "Edit shortcuts" button that turns the same page into the editable one. Strings in assets/locales/pending/shortcuts-read-only-note.json (en, ja, zh). Harness test opens it both ways, checks the note, clicks Edit shortcuts, and finds Import…, Reset All and a recordable binding. Co-Authored-By: Claude Opus 5.5 * Pending locale: Arabic, Hebrew and Vietnamese for the read-only shortcuts note Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: bherbruck --- .../pending/shortcuts-read-only-note.json | 26 ++++++++++++ crates/ui-egui/src/keymap.rs | 42 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 assets/locales/pending/shortcuts-read-only-note.json diff --git a/assets/locales/pending/shortcuts-read-only-note.json b/assets/locales/pending/shortcuts-read-only-note.json new file mode 100644 index 000000000..df6a6dbb2 --- /dev/null +++ b/assets/locales/pending/shortcuts-read-only-note.json @@ -0,0 +1,26 @@ +{ + "en": { + "Read-only list: shortcuts can't be changed here.": "Read-only list: shortcuts can't be changed here.", + "Edit shortcuts": "Edit shortcuts" + }, + "ja": { + "Read-only list: shortcuts can't be changed here.": "読み取り専用の一覧です。ここではショートカットを変更できません。", + "Edit shortcuts": "ショートカットを編集" + }, + "zh": { + "Read-only list: shortcuts can't be changed here.": "只读列表:此处无法更改快捷键。", + "Edit shortcuts": "编辑快捷键" + }, + "ar": { + "Read-only list: shortcuts can't be changed here.": "قائمة للقراءة فقط: لا يمكن تغيير الاختصارات هنا.", + "Edit shortcuts": "تعديل الاختصارات" + }, + "he": { + "Read-only list: shortcuts can't be changed here.": "רשימה לקריאה בלבד: לא ניתן לשנות כאן קיצורי דרך.", + "Edit shortcuts": "עריכת קיצורי דרך" + }, + "vi": { + "Read-only list: shortcuts can't be changed here.": "Danh sách chỉ đọc: không thể thay đổi phím tắt ở đây.", + "Edit shortcuts": "Sửa phím tắt" + } +} diff --git a/crates/ui-egui/src/keymap.rs b/crates/ui-egui/src/keymap.rs index 0660ab43f..421ca0a8b 100644 --- a/crates/ui-egui/src/keymap.rs +++ b/crates/ui-egui/src/keymap.rs @@ -619,6 +619,18 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) { } ui_kit::text(ui, app.tr_label("Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation)."), ui_kit::Text::Note("navigation")); } + // The list Help and Home open looks like the Shortcuts page of Preferences: say it can't + // be changed here, and lead to the page where it can (#7409). + if !filtering && app.keymap.read_only { + ui.horizontal_wrapped(|ui| { + ui_kit::text(ui, app.tr_label("Read-only list: shortcuts can't be changed here."), ui_kit::Text::Note("shortcut_read_only")); + let edit = ui_kit::button(ui, app.tr_label("Edit shortcuts"), ui_kit::Button::Normal); + crate::scenario::publish_target("keymap:edit", edit.rect); + if edit.clicked() { + app.keymap.read_only = false; + } + }); + } if !filtering && !app.keymap.read_only { ui_kit::text(ui, app.tr("ui.shortcut_capture_hint"), ui_kit::Text::Note("shortcut_capture_help")); if app.keymap.capturing.is_some() { @@ -1468,4 +1480,34 @@ mod card_tests { } } } + + /// #7409: the read-only list (Home › Keyboard shortcuts, Help › Keyboard Shortcuts) looked + /// like the editable page with Import… missing. It says it is read-only, and Edit shortcuts + /// turns the same page into the editable one: Import…, Reset All and recording are there. + #[test] + fn read_only_shortcuts_say_so_and_edit_shortcuts_unlocks_them() { + for open in ["home", "help"] { + let mut h = Harness::new(); + h.app.home.open = false; + h.app.keymap.filter = "solid.extrude".into(); + if open == "home" { + h.app.keymap.open = true; + h.app.keymap.read_only = true; + } else { + h.call("ui.help", json!({"item":"shortcuts"})); + } + h.frames(4); + assert!(h.app.keymap.read_only, "{open}"); + assert!(h.widget("Read-only list: shortcuts can't be changed here.").is_some(), "{open}"); + assert!(h.widget("Import…").is_none(), "{open}: no Import… while read-only"); + assert!(scenario::handle_at("keymap:capture:solid.extrude").is_none()); + h.step(&json!({"widget":"Edit shortcuts"})).unwrap(); + h.frames(4); + assert!(!h.app.keymap.read_only, "{open}: editable after Edit shortcuts"); + assert!(h.widget("Read-only list: shortcuts can't be changed here.").is_none(), "{open}"); + assert!(h.widget("Edit shortcuts").is_none(), "{open}"); + assert!(h.widget("Import…").is_some() && h.widget("Reset All").is_some(), "{open}"); + assert!(scenario::handle_at("keymap:capture:solid.extrude").is_some(), "{open}: a binding can be recorded"); + } + } }