LVGL fix argument to remove_cb

This commit is contained in:
Stephan Hadinger 2022-01-23 09:39:24 +01:00
parent 692b7ec8c3
commit 7cb4f72761
2 changed files with 10 additions and 7 deletions

View File

@ -369,8 +369,8 @@ const be_ntv_func_def_t lv_obj_func[] = {
{ "refresh_ext_draw_size", (void*) &lv_obj_refresh_ext_draw_size, "", "(lv.lv_obj)" },
{ "refresh_self_size", (void*) &lv_obj_refresh_self_size, "b", "(lv.lv_obj)" },
{ "refresh_style", (void*) &lv_obj_refresh_style, "", "(lv.lv_obj)i(lv.lv_style_prop)" },
{ "remove_event_cb", (void*) &lv_obj_remove_event_cb, "b", "(lv.lv_obj)^lv_event_cb^" },
{ "remove_event_cb_with_user_data", (void*) &lv_obj_remove_event_cb_with_user_data, "b", "(lv.lv_obj)^lv_event_cb^." },
{ "remove_event_cb", (void*) &lv_obj_remove_event_cb, "b", "(lv.lv_obj)." },
{ "remove_event_cb_with_user_data", (void*) &lv_obj_remove_event_cb_with_user_data, "b", "(lv.lv_obj).." },
{ "remove_event_dsc", (void*) &lv_obj_remove_event_dsc, "b", "(lv.lv_obj)i" },
{ "remove_local_style_prop", (void*) &lv_obj_remove_local_style_prop, "b", "(lv.lv_obj)(lv.lv_style_prop)i" },
{ "remove_style", (void*) &lv_obj_remove_style, "", "(lv.lv_obj)(lv.lv_style)i" },

View File

@ -238,6 +238,7 @@ with open(lv_widgets_file) as f:
c_args = ""
args_raw = [ x.strip(" \t\n\r") for x in g.group(3).split(",") ] # split by comma and strip
# print(args_raw)
func_name = g.group(2)
for arg_raw in args_raw:
# Ex: 'const lv_obj_t * parent' -> 'const ', 'lv_obj_t', ' * ', 'parent', ''
# Ex: 'bool auto_fit' -> '', 'bool', ' ', 'auto_fit', ''
@ -264,10 +265,13 @@ with open(lv_widgets_file) as f:
c_args += ga_type
else:
if ga_type.endswith("_cb"):
# it's a callback type, we encode it differently
if ga_type not in lv_cb_types:
lv_cb_types.append(ga_type)
c_args += "^" + ga_type + "^"
if 'remove_' in func_name: # if the call is to remove the cb, just treat as an 'anything' parameter
c_args += "."
else:
# it's a callback type, we encode it differently
if ga_type not in lv_cb_types:
lv_cb_types.append(ga_type)
c_args += "^" + ga_type + "^"
else:
# we have a high-level type that we treat as a class name, enclose in parenthesis
c_args += "(" + "lv." + ga_type + ")"
@ -276,7 +280,6 @@ with open(lv_widgets_file) as f:
c_args += "[......]" # allow 6 additional parameters
# analyze function name and determine if it needs to be assigned to a specific class
func_name = g.group(2)
# Ex: func_name -> 'lv_obj_set_parent'
if func_name.startswith("_"): continue # skip low-level
if func_name.startswith("lv_debug_"): continue # skip debug