Fix live wiresheet: resolve type names and load schema gracefully

- Add type_name_map on SoxClient so components loaded after connect
  resolve proper names (e.g. control::And2) instead of kit::typeN.
  This lets the slot registry and final_components_registry match,
  so component boxes show their slots and property values.

- Load live schema gracefully: skip missing kit manifests instead of
  aborting, compile the kits we have, and warn about missing ones in
  the status bar.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-12 13:43:44 +03:00
co-authored by Claude Opus 4.6
parent 4c90c1c241
commit 4e38847f91
4 changed files with 32 additions and 8 deletions
+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.084" VERSION = "0.0.0.085"
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
+1
View File
@@ -142,6 +142,7 @@ class DeviceSession:
}) })
registry[(kit_id, type_id_val)] = slots registry[(kit_id, type_id_val)] = slots
full_name = f"{kit_name}::{type_name}" full_name = f"{kit_name}::{type_name}"
self.sox_client.type_name_map[(kit_id, type_id_val)] = full_name
# update type_name on any cached component of this type # update type_name on any cached component of this type
for c in self.sox_client.cache: for c in self.sox_client.cache:
if c is not None and c.kit_id == kit_id and c.type_id == type_id_val: if c is not None and c.kit_id == kit_id and c.type_id == type_id_val:
+23 -7
View File
@@ -1969,13 +1969,29 @@ def _load_live_schema(ds):
"""Loads schema kits from the device's schema parts into the editor registry.""" """Loads schema kits from the device's schema parts into the editor registry."""
app_state.active_schema_kits.clear() app_state.active_schema_kits.clear()
app_state.final_components_registry.clear() app_state.final_components_registry.clear()
if ds.sox_client and ds.sox_client.schema_parts: if not (ds.sox_client and ds.sox_client.schema_parts):
for part in ds.sox_client.schema_parts: return
app_state.active_schema_kits[part.name] = f"{part.checksum & 0xFFFFFFFF:08x}"
try: for part in ds.sox_client.schema_parts:
schema.load_schema_kits_and_manifests() app_state.active_schema_kits[part.name] = f"{part.checksum & 0xFFFFFFFF:08x}"
except Exception:
pass # Collect manifests we have, skip missing kits (device may use kits
# not installed on this computer — load what we can)
manifest_paths = []
missing = []
for name, checksum in app_state.active_schema_kits.items():
path = schema.find_manifest_path(name, checksum)
if path:
manifest_paths.append(path)
else:
missing.append(name)
if manifest_paths:
schema.compile_schema_registry(manifest_paths)
if missing:
app_state.set_status(
f"Missing kit manifests: {', '.join(missing)}", warn=True)
def do_device_disconnect(): def do_device_disconnect():
+7
View File
@@ -363,6 +363,10 @@ class SoxClient:
# each slot dict: {name, id, type_name, is_config, is_runtime, is_action, is_operator, is_as_str} # each slot dict: {name, id, type_name, is_config, is_runtime, is_action, is_operator, is_as_str}
self.slot_registry = {} self.slot_registry = {}
# type name map — set externally by device_session
# maps (kit_id, type_id) -> "kit::TypeName" for proper type resolution
self.type_name_map = {}
# event callback: called on main thread via queue # event callback: called on main thread via queue
self.on_event = None # fn(comp_id, what_char) self.on_event = None # fn(comp_id, what_char)
@@ -853,6 +857,9 @@ class SoxClient:
comp.links = links comp.links = links
def _resolve_type_name(self, kit_id, type_id_val): def _resolve_type_name(self, kit_id, type_id_val):
resolved = self.type_name_map.get((kit_id, type_id_val))
if resolved:
return resolved
if self.schema_parts and 0 <= kit_id < len(self.schema_parts): if self.schema_parts and 0 <= kit_id < len(self.schema_parts):
kit_name = self.schema_parts[kit_id].name kit_name = self.schema_parts[kit_id].name
else: else: