feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class - All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name - Entity delegates name to its sprite member - Add find(name, scene=None) function for exact match search - Add findAll(pattern, scene=None) with wildcard support (* matches any sequence) - Both functions search recursively through Frame children and Grid entities - Comprehensive test coverage for all functionality This provides a simple way to find UI elements by name in Python scripts, supporting both exact matches and wildcard patterns. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
97067a104e
commit
edfe3ba184
13 changed files with 557 additions and 6 deletions
|
|
@ -288,6 +288,7 @@ PyGetSetDef UISprite::getsetters[] = {
|
|||
{"texture", (getter)UISprite::get_texture, (setter)UISprite::set_texture, "Texture object", NULL},
|
||||
{"click", (getter)UIDrawable::get_click, (setter)UIDrawable::set_click, "Object called with (x, y, button) when clicked", (void*)PyObjectsEnum::UISPRITE},
|
||||
{"z_index", (getter)UIDrawable::get_int, (setter)UIDrawable::set_int, "Z-order for rendering (lower values rendered first)", (void*)PyObjectsEnum::UISPRITE},
|
||||
{"name", (getter)UIDrawable::get_name, (setter)UIDrawable::set_name, "Name for finding elements", (void*)PyObjectsEnum::UISPRITE},
|
||||
{"pos", (getter)UISprite::get_pos, (setter)UISprite::set_pos, "Position as a Vector", NULL},
|
||||
UIDRAWABLE_GETSETTERS,
|
||||
{NULL}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue