Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(property): add property name #6329

Merged
merged 6 commits into from
Jun 19, 2024
Merged

Conversation

XuNeo
Copy link
Collaborator

@XuNeo XuNeo commented Jun 3, 2024

Description of the feature or fix

Binding language like lua or js prefer to use name to set property.
This patch is one of the series to make bindings easier to set widget property.

Added a table to convert property name to ID. The name table is generated automatically though properties.py script, based on the property ID definitions.

If the name is not provided for specified widget, then recursively looking up its base classes. bsearch is used to match up strings.

The test has passed.

This API is experimental and is subject to change if binding language requires differently.

Notes

src/widgets/property/lv_style_properties.c Outdated Show resolved Hide resolved
scripts/properties.py Show resolved Hide resolved
Property ID contains the property index number and property type. Check
if the property index is in range or not.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
@XuNeo XuNeo force-pushed the property-name branch 2 times, most recently from 0975b05 to 6b311c2 Compare June 10, 2024 07:11
@W-Mai
Copy link
Contributor

W-Mai commented Jun 10, 2024

LGTM

@kisvegabor
Copy link
Member

It seems to be very useful for us with the editor too. It looks good to me, but @coevin @liamHowatt and @richardgazdik could you also take look at it?

Copy link

@coevin coevin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Collaborator

@liamHowatt liamHowatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool metaprogramming and use of bsearch 🙂

src/core/lv_obj_property.c Outdated Show resolved Hide resolved
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
Since now lv_point_t is a basic property value type, pivot can be treated as a normal value instead of void * pointer.
Add a test for it

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
{"flag_checkable", LV_PROPERTY_OBJ_FLAG_CHECKABLE,},
{"flag_click_focusable", LV_PROPERTY_OBJ_FLAG_CLICK_FOCUSABLE,},
{"flag_clickable", LV_PROPERTY_OBJ_FLAG_CLICKABLE,},
{"flag_end", LV_PROPERTY_OBJ_FLAG_END,},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid adding it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you concerned about the flash size? flag is treated as a property so it's automatically included here. Maybe we should remove the flag property totally?

src/widgets/property/lv_obj_property_names.h Outdated Show resolved Hide resolved
{"flag_checkable", LV_PROPERTY_OBJ_FLAG_CHECKABLE,},
{"flag_click_focusable", LV_PROPERTY_OBJ_FLAG_CLICK_FOCUSABLE,},
{"flag_clickable", LV_PROPERTY_OBJ_FLAG_CLICKABLE,},
{"flag_end", LV_PROPERTY_OBJ_FLAG_END,},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you concerned about the flash size? flag is treated as a property so it's automatically included here. Maybe we should remove the flag property totally?

@kisvegabor kisvegabor merged commit 438e943 into lvgl:master Jun 19, 2024
18 checks passed
@XuNeo XuNeo deleted the property-name branch June 20, 2024 01:38
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.

None yet

6 participants