Tidy Layout on Control+W only

Cmd+W closes the window on macOS, so the Command half of the pair is left
alone; this is the one shortcut that is not bound on both modifiers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-04 22:41:03 +03:00
co-authored by Claude Opus 5
parent 5f66ecef7b
commit 0166be3454
3 changed files with 9 additions and 7 deletions
+3 -2
View File
@@ -83,11 +83,12 @@ Undoing back to the depth of the last save clears the dirty tint rather than lea
| `Ctrl`/`Cmd` + `Y` or `Ctrl`/`Cmd` + `Shift` + `Z` | Redo | | `Ctrl`/`Cmd` + `Y` or `Ctrl`/`Cmd` + `Shift` + `Z` | Redo |
| `Del` / `Backspace` | Delete selected component | | `Del` / `Backspace` | Delete selected component |
| `Ctrl`/`Cmd` + `B` | Show or hide the tree/palette column | | `Ctrl`/`Cmd` + `B` | Show or hide the tree/palette column |
| `Ctrl`/`Cmd` + `W` | Tidy Layout: re-flow the open sheet | | `Ctrl` + `W` | Tidy Layout: re-flow the open sheet |
| `Alt` + `Left` / `Alt` + `Right` | Back and forward through the sheets opened this session | | `Alt` + `Left` / `Alt` + `Right` | Back and forward through the sheets opened this session |
Both `Command-` and `Control-` are bound for each, so the same build works on macOS and Both `Command-` and `Control-` are bound for each, so the same build works on macOS and
Windows; menu accelerators render as `Cmd` or `Ctrl` per platform. Windows; menu accelerators render as `Cmd` or `Ctrl` per platform. Tidy Layout is the
exception, on `Control-` alone: `Cmd` + `W` closes the window on macOS.
### The View menu ### The View menu
+1 -1
View File
@@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it.
import configparser import configparser
import os import os
VERSION = "0.0.0.031" VERSION = "0.0.0.032"
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties") PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
DEFAULT_GRID_SIZE = 10 DEFAULT_GRID_SIZE = 10
DEFAULT_ADD_TIMESTAMP = True DEFAULT_ADD_TIMESTAMP = True
+5 -4
View File
@@ -1174,7 +1174,6 @@ SHORTCUTS = [
("z", do_undo), ("z", do_undo),
("y", do_redo), ("y", do_redo),
("b", toggle_left_column), ("b", toggle_left_column),
("w", do_tidy_layout),
] ]
for key, handler in SHORTCUTS: for key, handler in SHORTCUTS:
window.bind_all(f"<Command-{key}>", handler) window.bind_all(f"<Command-{key}>", handler)
@@ -1188,6 +1187,10 @@ window.bind_all("<Control-Shift-Z>", do_redo)
window.bind_all("<Delete>", delete_selected_component) window.bind_all("<Delete>", delete_selected_component)
window.bind_all("<BackSpace>", delete_selected_component) window.bind_all("<BackSpace>", delete_selected_component)
# Tidy Layout is the one shortcut bound on Control alone: Cmd+W closes the window on
# macOS, and shadowing that would be a poor trade for a second way to re-flow a sheet.
window.bind_all("<Control-w>", do_tidy_layout)
# Sheet history: the browser chords, in both the Alt and the mac bracket spelling. # Sheet history: the browser chords, in both the Alt and the mac bracket spelling.
window.bind_all("<Alt-Left>", go_back) window.bind_all("<Alt-Left>", go_back)
window.bind_all("<Alt-Right>", go_forward) window.bind_all("<Alt-Right>", go_forward)
@@ -1230,9 +1233,7 @@ menu_view.add_command(
label=MENU_FORWARD_LABEL, command=go_forward, accelerator="Alt+Right", state="disabled" label=MENU_FORWARD_LABEL, command=go_forward, accelerator="Alt+Right", state="disabled"
) )
menu_view.add_separator() menu_view.add_separator()
menu_view.add_command( menu_view.add_command(label="Tidy Layout", command=do_tidy_layout, accelerator="Ctrl+W")
label="Tidy Layout", command=do_tidy_layout, accelerator=f"{accel_mod}+W"
)
menu_bar.add_cascade(label="View", menu=menu_view) menu_bar.add_cascade(label="View", menu=menu_view)
menu_kits = tk.Menu(menu_bar, tearoff=0) menu_kits = tk.Menu(menu_bar, tearoff=0)