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:
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user