From 89aab509489bea696012ea31c6e09c350182898c Mon Sep 17 00:00:00 2001 From: Arda Aydin Date: Sat, 12 Sep 2026 13:55:12 +0300 Subject: [PATCH] Fix live wiresheet links and DOM structure to match .sax format - Build root children directly under instead of wrapping them in a element. This matches the .sax DOM structure where is the container, so component paths like /AHU/TmpCont/X match between link references and get_component_path. - Fix _comp_path to produce /AHU/TmpCont/X format (skip root id 0, leading /) matching the .sax link path convention. - Format float property values to 4 decimal places instead of full Python float precision (22.0116 vs 22.011558532714844). Co-Authored-By: Claude Opus 4.6 --- app_state.py | 2 +- device_session.py | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app_state.py b/app_state.py index 945c528..2f9aa77 100644 --- a/app_state.py +++ b/app_state.py @@ -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.085" +VERSION = "0.0.0.086" PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties") DEFAULT_GRID_SIZE = 10 DEFAULT_ADD_TIMESTAMP = True diff --git a/device_session.py b/device_session.py index 47db2f9..ff218dc 100644 --- a/device_session.py +++ b/device_session.py @@ -237,7 +237,15 @@ class DeviceSession: app_elem = ET.SubElement(sax_root, "app") if root_comp is not None: - self._build_comp_element(app_elem, root_comp) + # Build children of root directly under , matching .sax format + # where IS the root container (not a ) + for child_id in root_comp.children: + child_comp = self.sox_client.cache_get(child_id) + if child_comp is not None: + self._build_comp_element(app_elem, child_comp) + else: + ET.SubElement(app_elem, "comp", + name="...", id=str(child_id), type="") return sax_root @@ -259,8 +267,12 @@ class DeviceSession: name = slot["name"] if name in sox_comp.values: val = sox_comp.values[name] + if isinstance(val, float): + val_str = f"{val:.4f}".rstrip("0").rstrip(".") + else: + val_str = str(val) ET.SubElement(comp_elem, "prop", - name=name, val=str(val)) + name=name, val=val_str) for child_id in sox_comp.children: child_comp = self.sox_client.cache_get(child_id) @@ -330,7 +342,7 @@ class DeviceSession: if not parts: return None parts.reverse() - return "/".join(parts) + return "/" + "/".join(parts) # ── Update DOM from COV ─────────────────────────────────────