Add a Properties view for the app root
The root tree row now names the app component, "app (<host:port>)" or "app (<file>)", and offers Properties from its context menu and on double-click. The live DOM's <app> element now carries its type and slot values, and the refresh-by-id lookup finds it, so the view shows real sys::App values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -293,7 +293,8 @@ def show_properties(comp):
|
||||
)
|
||||
properties_panel.frame.pack(fill=tk.BOTH, expand=True)
|
||||
record_visit(VIEW_PROPERTIES, comp)
|
||||
app_state.set_status(f"Properties: {comp.get('name', '?')}")
|
||||
default_name = "App" if comp.tag == "app" else "?"
|
||||
app_state.set_status(f"Properties: {comp.get('name', default_name)}")
|
||||
|
||||
|
||||
def dismiss_properties(restore_canvas=True):
|
||||
@@ -1064,6 +1065,12 @@ def on_tree_right_click(event):
|
||||
|
||||
if parent_id == "":
|
||||
tree_root_context_menu.delete(0, tk.END)
|
||||
# The root row names the <app> itself, which has slots of its own to show.
|
||||
app_element = app_state.tree_element_map.get(item_id)
|
||||
if app_element is not None:
|
||||
tree_root_context_menu.add_command(
|
||||
label="Properties", command=lambda: show_properties(app_element))
|
||||
tree_root_context_menu.add_separator()
|
||||
if app_state.live_mode and app_state.device_session and app_state.device_session.is_connected:
|
||||
for action_name in _APP_ACTIONS:
|
||||
tree_root_context_menu.add_command(
|
||||
@@ -1100,10 +1107,14 @@ def on_tree_double_click(event):
|
||||
"""Double-click on a tree node opens its special view (or Properties)."""
|
||||
tree = app_state.tree
|
||||
item_id = tree.identify_row(event.y)
|
||||
if not item_id or tree.parent(item_id) == "":
|
||||
if not item_id:
|
||||
return
|
||||
comp = app_state.tree_element_map.get(item_id)
|
||||
if comp is not None:
|
||||
if comp is None:
|
||||
return
|
||||
if tree.parent(item_id) == "":
|
||||
show_properties(comp)
|
||||
else:
|
||||
_open_special_view(comp)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user