Link popup: go to the sheet the other end of the link is on
Right-clicking a wire or a knob now offers Go to Link Wire Sheet "<name>", naming the sheet the far end is on -- the end a grey knob stands in for. A link with both ends on the open sheet has nowhere to go, so the entry is left off rather than greyed out. find_component_by_path turns a link's from/to reference back into the component it points at, the inverse of get_component_path, and the sheet is that component's parent; a parent of <app> is the file's root node, which the popup names after the file. Arriving selects the same link and scrolls it to the middle of the view. It is found by its element rather than by the tag it was picked on, since a repaint hands out fresh wire tags, and it waits for that repaint from an after_idle callback: ttk queues its selection event rather than dispatching it, so the sheet is not painted when the tree node is selected -- and painting a sheet clears the selected link, which was wiping the selection this feature had just made. The jump is an ordinary sheet opening, so Back returns to where the link was picked. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -128,6 +128,24 @@ element has left the document, keeping the position on screen. Walking the histo
|
||||
the tree selection, which is what paints the sheet, and is suppressed from recording so a
|
||||
walk cannot rewrite the trail it is following.
|
||||
|
||||
### Following a link to its other sheet
|
||||
|
||||
Right-clicking a wire or a knob offers **Go to Link Wire Sheet "<name>"** alongside Delete
|
||||
Link, naming the sheet the far end of that link is on -- the end a grey knob stands in
|
||||
for. The entry is left off a link with both ends on the open sheet, which has nowhere to
|
||||
go. `find_component_by_path` in `sax_dom` turns a `<link>`'s from/to reference back into
|
||||
the component it points at, the inverse of `get_component_path`, and the sheet is that
|
||||
component's parent; a parent of `<app>` is the file's root node, which the popup names
|
||||
after the file.
|
||||
|
||||
The jump selects the same link again once it arrives. It has to be found by its element
|
||||
rather than by the tag it was picked on, because a repaint hands out fresh wire tags, and
|
||||
it has to wait for that repaint: ttk queues its selection event rather than dispatching
|
||||
it, so the sheet is not painted at the point the tree node is selected -- and painting a
|
||||
sheet clears whatever link was selected. The selection is therefore made from an
|
||||
`after_idle` callback, and the link is scrolled to the middle of the view. Arriving is an
|
||||
ordinary sheet opening, so **Back** returns to the sheet the link was picked on.
|
||||
|
||||
### Testing without a window
|
||||
|
||||
`app_state`, `sax_dom`, `schema`, `undo` and `wiresheet` import with no display, so the
|
||||
|
||||
Reference in New Issue
Block a user