Wiresheet: arrow nudges keep the selection and the sheet's focus
Ctrl+A hands the sheet the keyboard, and repainting the same sheet keeps whatever of the selection is still on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it.
|
||||
import configparser
|
||||
import os
|
||||
|
||||
VERSION = "0.0.0.179"
|
||||
VERSION = "0.0.0.180"
|
||||
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
||||
DEFAULT_GRID_SIZE = 10
|
||||
DEFAULT_ADD_TIMESTAMP = True
|
||||
|
||||
@@ -1357,6 +1357,8 @@ def select_all_boxes(event=None):
|
||||
return None
|
||||
wiresheet.deselect_link() # links and boxes are never selected together
|
||||
select_canvas_boxes(list(app_state.canvas_comp_map))
|
||||
# Hand the sheet the keyboard, so the arrows move the boxes rather than the tree.
|
||||
app_state.canvas.focus_set()
|
||||
count = len(app_state.selected_canvas_tags)
|
||||
app_state.set_status(f"{count} component{'s' if count != 1 else ''} selected.")
|
||||
return "break"
|
||||
@@ -2270,7 +2272,15 @@ def nudge_selected_boxes(dx, dy):
|
||||
"meta_before": meta_prop.get("val") if meta_prop is not None else None})
|
||||
canvas.move(tag, shift_x, shift_y)
|
||||
app_state.drag_data.update(tag=tags[0], group=group, moved=True, collapse_to=None)
|
||||
pressed_last = app_state.selected_canvas_tag
|
||||
on_canvas_release(None)
|
||||
# The same boxes stay selected, and the sheet keeps the keyboard, so the next
|
||||
# arrow press moves them again.
|
||||
still_here = [t for t in tags if t in app_state.canvas_comp_map and t != pressed_last]
|
||||
if pressed_last in app_state.canvas_comp_map:
|
||||
still_here.append(pressed_last)
|
||||
select_canvas_boxes(still_here)
|
||||
canvas.focus_set()
|
||||
return "break"
|
||||
|
||||
|
||||
|
||||
@@ -1234,6 +1234,11 @@ def render_components(components_to_render):
|
||||
"""Handles parsing and visual painting of given component listings on canvas with slot attributes."""
|
||||
canvas = app_state.canvas
|
||||
app_state.active_components_list = components_to_render
|
||||
# Repainting the same sheet (a refresh, an undo, a device update) keeps whatever of
|
||||
# the selection is still on it; another sheet starts with nothing selected.
|
||||
kept = [app_state.canvas_comp_map.get(t) for t in app_state.selected_canvas_tags
|
||||
if t != app_state.selected_canvas_tag]
|
||||
kept.append(app_state.canvas_comp_map.get(app_state.selected_canvas_tag))
|
||||
app_state.selected_canvas_tag = None
|
||||
app_state.selected_canvas_tags.clear()
|
||||
|
||||
@@ -1275,6 +1280,15 @@ def render_components(components_to_render):
|
||||
draw_links()
|
||||
apply_sheet_zoom(fonts)
|
||||
|
||||
on_sheet = set(components_to_render)
|
||||
for element in kept:
|
||||
if element is not None and element in on_sheet:
|
||||
tag = app_state.canvas_tag_by_element[element]
|
||||
app_state.selected_canvas_tags.add(tag)
|
||||
app_state.selected_canvas_tag = tag
|
||||
for tag in app_state.selected_canvas_tags:
|
||||
canvas.itemconfig(f"{tag} && block_outline", outline="#1f4e79", width=3)
|
||||
|
||||
|
||||
def apply_sheet_zoom(fonts):
|
||||
"""Scales the finished sheet to app_state.zoom and sizes the canvas to match.
|
||||
|
||||
Reference in New Issue
Block a user