Pre-load root children on connect and add placeholders for uncached nodes

On connect, also loads root's immediate children so the first tree level
shows real names. For deeper levels, inserts placeholder <comp> elements
for uncached children so the Treeview shows + expand arrows for folders
that have children on the device.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-12 09:20:49 +03:00
co-authored by Claude Opus 4.6
parent d32285abe8
commit 0674f32637
2 changed files with 8 additions and 1 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 os
VERSION = "0.0.0.079"
VERSION = "0.0.0.080"
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
DEFAULT_GRID_SIZE = 10
DEFAULT_ADD_TIMESTAMP = True
+7
View File
@@ -35,6 +35,9 @@ class DeviceSession:
self._load_slot_registry(parts)
root_comp = self.sox_client.load(0)
# Pre-load immediate children so the tree shows the first level
if root_comp and root_comp.children:
self.load_children(root_comp.id)
return root_comp
def disconnect(self):
@@ -228,6 +231,10 @@ class DeviceSession:
child_comp = self.sox_client.cache_get(child_id)
if child_comp is not None:
self._build_comp_element(comp_elem, child_comp)
else:
# Placeholder so the tree shows a + expand arrow for uncached children
ET.SubElement(comp_elem, "comp",
name="...", id=str(child_id), type="")
return comp_elem