Manage Kits as embedded panel, fix checksum zero-padding mismatch

Manage Kits now opens inside the editor pane (like Properties and Link
View) instead of a separate Toplevel window. Also normalize hex
checksums by stripping leading zeros so .kit and manifest filenames
that disagree on padding (e.g. 462d43e vs 0462d43e) still resolve to
a version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-08 21:08:59 +03:00
co-authored by Claude Opus 4.6
parent da0e18a9c3
commit a77edead25
4 changed files with 197 additions and 158 deletions
+44 -6
View File
@@ -111,11 +111,12 @@ zoom_label = None
menu_view = None
show_left_column_var = None
# The Properties and Link views each take the editor pane over from the canvas rather
# than floating above it, so at most one of the three is on screen and these two say
# which. Both None means the sheet is showing.
# The Properties, Link and Kits views each take the editor pane over from the canvas
# rather than floating above it, so at most one of the four is on screen and these three
# say which. All None means the sheet is showing.
properties_panel = None
link_panel = None
kits_panel = None
# The sheet to put the tree back on when a sheet change is refused because of unsaved
# edits, and the flag that stops the restoring selection from being read as a fresh
@@ -204,7 +205,7 @@ def delete_component(comp):
def editor_panel_showing():
"""Whether something other than the wiresheet has the editor pane."""
return properties_panel is not None or link_panel is not None
return properties_panel is not None or link_panel is not None or kits_panel is not None
def _take_editor_pane():
@@ -316,17 +317,54 @@ def dismiss_link_view(restore_canvas=True):
_give_editor_pane_back()
def show_kits():
"""Puts the kit table in the editor pane, in place of the wiresheet."""
global kits_panel
if app_state.xml_root_element is None:
messagebox.showinfo("Manage Kits", "Open a SAX file first.")
return
if app_state.xml_root_element.find("schema") is None:
messagebox.showwarning("Manage Kits", "This file has no <schema> block to manage.")
return
if not close_editor_panel():
return
_take_editor_pane()
kits_panel = manage_kits.build_kits_panel(
frame_editor, on_applied=refresh_palette_kits, on_close=dismiss_kits,
)
kits_panel.frame.pack(fill=tk.BOTH, expand=True)
app_state.set_status("Manage Kits")
def dismiss_kits(restore_canvas=True):
"""Takes the Kits view down and gives the pane back."""
global kits_panel
if kits_panel is None:
return
kits_panel.destroy()
kits_panel = None
if restore_canvas:
_give_editor_pane_back()
def close_editor_panel(force=False):
"""Frees the editor pane, asking about unsaved edits first. True if it is now free.
Every way of leaving a panel goes through this, so "you have not saved that" is
asked once, in one place, whether the user pressed Close, picked another sheet,
walked the history or opened a different component. Only the Properties view has
anything to ask about; the Link View simply stands down.
anything to ask about; other views simply stand down.
"""
if link_panel is not None:
dismiss_link_view()
return True
if kits_panel is not None:
dismiss_kits()
return True
if properties_panel is None:
return True
if force:
@@ -1919,7 +1957,7 @@ menu_bar.add_cascade(label="View", menu=menu_view)
menu_kits = tk.Menu(menu_bar, tearoff=0)
menu_kits.add_command(
label="Manage Kits...",
command=lambda: manage_kits.open_dialog(on_applied=refresh_palette_kits)
command=show_kits
)
menu_bar.add_cascade(label="Kits", menu=menu_kits)