View menu: tree/palette toggle, and Back/Forward through opened sheets

Tree / Palette hides the left column so the wiresheet has the whole window.
ttk has no hide flag for a pane, so the column is dropped from the paned
window and re-inserted at the front, which is why the configured width is
re-applied afterwards.

Back and Forward walk the sheets opened this session, with two arrow buttons
in a new toolbar on the same commands. History entries hold the element whose
children are painted rather than a tree item id: rebuilding the tree hands out
fresh ids, while the elements themselves survive. Recording runs from the tree
selection handler, the one route every sheet opening takes, and is suppressed
while a walk drives that selection so it cannot rewrite its own trail. Opening
a different file retires the history; a delete or an undo drops only the
entries whose element has left the document, keeping the position on screen.

open_file builds the tree inline instead of going through
refresh_treeview_from_dom, so it never raised the tree-filled callback and the
history had no way to see a new file. It and reset_to_startup_state now fire
it, which also gets the tree column fitted on load rather than on the first
resize.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-04 21:25:03 +03:00
co-authored by Claude Opus 5
parent 5424d84156
commit 23a8bfbaa8
4 changed files with 275 additions and 2 deletions
+6
View File
@@ -106,6 +106,9 @@ def reset_to_startup_state():
for item in app_state.tree.get_children():
app_state.tree.delete(item)
if _tree_filled is not None:
_tree_filled()
if app_state.canvas is not None:
app_state.canvas.delete("all")
wiresheet.draw_grid()
@@ -161,6 +164,9 @@ def open_file():
else:
parse_xml_to_tree(tree, root_node, app_state.xml_root_element)
if _tree_filled is not None:
_tree_filled()
except schema.MissingManifestError as missing:
messagebox.showerror(
"Kit manifest missing",