refactor: rename cnt to count

This commit is contained in:
Gabor Kiss-Vamosi
2023-11-15 22:38:24 +01:00
parent 43a231cf5a
commit 235d580a51
52 changed files with 185 additions and 175 deletions

View File

@@ -65,7 +65,7 @@ static void file_explorer_event_handler(lv_event_t * e)
}
else if(code == LV_EVENT_READY) {
lv_obj_t * tb = lv_file_explorer_get_file_table(obj);
uint16_t sum = lv_table_get_row_cnt(tb);
uint16_t sum = lv_table_get_row_count(tb);
sort_by_file_kind(tb, 0, (sum - 1));
}

View File

@@ -53,7 +53,7 @@ def file_explorer_event_handler(e) :
elif code == lv.EVENT.READY :
tb = obj.explorer_get_file_table()
sum = tb.get_row_cnt()
sum = tb.get_row_count()
# print("sum: ",sum)
sort_by_file_kind(tb, 0, (sum - 1));

View File

@@ -91,7 +91,7 @@ static void cont_observer_cb(lv_subject_t * subject, lv_observer_t * observer)
uint32_t i;
uint32_t delay = 0;
uint32_t child_cnt_prev = lv_obj_get_child_cnt(cont);
uint32_t child_cnt_prev = lv_obj_get_child_count(cont);
for(i = 0; i < child_cnt_prev; i++) {
lv_obj_t * child = lv_obj_get_child(cont, i);
lv_anim_set_var(&a, child);
@@ -132,7 +132,7 @@ static void cont_observer_cb(lv_subject_t * subject, lv_observer_t * observer)
/*Animate in the new widgets*/
lv_anim_set_ready_cb(&a, NULL);
for(i = child_cnt_prev; i < lv_obj_get_child_cnt(cont); i++) {
for(i = child_cnt_prev; i < lv_obj_get_child_count(cont); i++) {
lv_obj_t * child = lv_obj_get_child(cont, i);
lv_anim_set_var(&a, child);
if(prev_v < cur_v) {

View File

@@ -11,7 +11,7 @@ static void scroll_event_cb(lv_event_t * e)
int32_t r = lv_obj_get_height(cont) * 7 / 10;
uint32_t i;
uint32_t child_cnt = lv_obj_get_child_cnt(cont);
uint32_t child_cnt = lv_obj_get_child_count(cont);
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = lv_obj_get_child(cont, i);
lv_area_t child_a;

View File

@@ -8,7 +8,7 @@ def scroll_event_cb(e):
r = cont.get_height() * 7 // 10
child_cnt = cont.get_child_cnt()
child_cnt = cont.get_child_conut()
for i in range(child_cnt):
child = cont.get_child(i)
child_a = lv.area_t()

View File

@@ -23,7 +23,7 @@ static void event_handler(lv_event_t * e)
}
lv_obj_t * parent = lv_obj_get_parent(obj);
uint32_t i;
for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
for(i = 0; i < lv_obj_get_child_count(parent); i++) {
lv_obj_t * child = lv_obj_get_child(parent, i);
if(child == currentButton) {
lv_obj_add_state(child, LV_STATE_CHECKED);
@@ -64,7 +64,7 @@ static void event_handler_center(lv_event_t * e)
if(currentButton == NULL) return;
lv_obj_t * parent = lv_obj_get_parent(currentButton);
const uint32_t pos = lv_obj_get_child_cnt(parent) / 2;
const uint32_t pos = lv_obj_get_child_count(parent) / 2;
lv_obj_move_to_index(currentButton, pos);
@@ -99,7 +99,7 @@ static void event_handler_swap(lv_event_t * e)
const lv_event_code_t code = lv_event_get_code(e);
// lv_obj_t* obj = lv_event_get_target(e);
if((code == LV_EVENT_CLICKED) || (code == LV_EVENT_LONG_PRESSED_REPEAT)) {
uint32_t cnt = lv_obj_get_child_cnt(list1);
uint32_t cnt = lv_obj_get_child_count(list1);
for(int i = 0; i < 100; i++)
if(cnt > 1) {
lv_obj_t * obj = lv_obj_get_child(list1, rand() % cnt);

View File

@@ -13,7 +13,7 @@ def event_handler(e):
else:
currentButton = obj
parent = obj.get_parent()
for i in range( parent.get_child_cnt()):
for i in range( parent.get_child_conut()):
child = parent.get_child(i)
if child == currentButton:
child.add_state(lv.STATE.CHECKED)
@@ -51,7 +51,7 @@ def event_handler_center(e):
if currentButton == None:
return
parent = currentButton.get_parent()
pos = parent.get_child_cnt() // 2
pos = parent.get_child_conut() // 2
currentButton.move_to_index(pos)
currentButton.scroll_to_view(lv.ANIM.ON)
@@ -82,7 +82,7 @@ def event_handler_swap(e):
code = e.get_code()
obj = e.get_target_obj()
if code == lv.EVENT.CLICKED:
cnt = list1.get_child_cnt()
cnt = list1.get_child_conut()
for i in range(100):
if cnt > 1:
obj = list1.get_child(urandom.getrandbits(32) % cnt )

View File

@@ -71,8 +71,8 @@ void lv_example_table_2(void)
lv_obj_set_size(table, LV_SIZE_CONTENT, 200);
lv_table_set_col_width(table, 0, 150);
lv_table_set_row_cnt(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/
lv_table_set_col_cnt(table, 1);
lv_table_set_row_count(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/
lv_table_set_col_count(table, 1);
/*Don't make the cell pressed, we will draw something different in the event*/
lv_obj_remove_style(table, NULL, LV_PART_ITEMS | LV_STATE_PRESSED);