Skip to content

Add public access to child layout data in UIWidget#2848

Open
pvcraven wants to merge 1 commit intodevelopmentfrom
feature/child-data-access
Open

Add public access to child layout data in UIWidget#2848
pvcraven wants to merge 1 commit intodevelopmentfrom
feature/child-data-access

Conversation

@pvcraven
Copy link
Copy Markdown
Member

@pvcraven pvcraven commented May 7, 2026

Summary

  • Adds get_child_data(child) to UIWidget — returns the live layout kwargs dict (e.g., anchor_x, align_x) for a child widget, or None if not found
  • Adds get_child_entry(index) to UIWidget — returns (child, data) tuple by index, supporting negative indices
  • Modifying the returned dict affects layout on the next do_layout() call, enabling in-place repositioning without remove/re-add cycles

Test plan

  • get_child_data() returns correct dict for added child
  • get_child_data() returns None for unknown widget
  • Modifying returned dict affects layout positioning after do_layout()
  • get_child_entry(0) returns first child with data
  • get_child_entry(-1) returns last child (Python index semantics)
  • get_child_entry(out_of_range) raises IndexError
  • Works with UIAnchorLayout, UIBoxLayout, UIGridLayout
  • After remove() + add(), returns new data
  • All 72 existing GUI layout tests pass

🤖 Generated with Claude Code

Provides public access to a child's layout data (anchor_x, align_x,
etc.) without accessing the private _children list. Modifying the
returned dict updates the layout on the next do_layout() call.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant