refactor: scr -> screen, act->active, del->delete, remove in obj_clear_flag/state

This commit is contained in:
Gabor Kiss-Vamosi
2023-10-12 20:37:27 +02:00
parent 0ff2d1c2e4
commit 9ec5417dd3
468 changed files with 1330 additions and 1288 deletions

View File

@@ -39,12 +39,12 @@ static void sw_event_cb(lv_event_t * e)
*/
void lv_example_anim_1(void)
{
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "Hello animations!");
lv_obj_set_pos(label, 100, 10);
lv_obj_t * sw = lv_switch_create(lv_scr_act());
lv_obj_t * sw = lv_switch_create(lv_screen_active());
lv_obj_center(sw);
lv_obj_add_state(sw, LV_STATE_CHECKED);
lv_obj_add_event(sw, sw_event_cb, LV_EVENT_VALUE_CHANGED, label);

View File

@@ -27,12 +27,12 @@ def sw_event_cb(e,label):
# Start animation on an event
#
label = lv.label(lv.scr_act())
label = lv.label(lv.screen_active())
label.set_text("Hello animations!")
label.set_pos(100, 10)
sw = lv.switch(lv.scr_act())
sw = lv.switch(lv.screen_active())
sw.center()
sw.add_state(lv.STATE.CHECKED)
sw.add_event(lambda e: sw_event_cb(e,label), lv.EVENT.VALUE_CHANGED, None)

View File

@@ -18,7 +18,7 @@ static void anim_size_cb(void * var, int32_t v)
void lv_example_anim_2(void)
{
lv_obj_t * obj = lv_obj_create(lv_scr_act());
lv_obj_t * obj = lv_obj_create(lv_screen_active());
lv_obj_set_style_bg_color(obj, lv_palette_main(LV_PALETTE_RED), 0);
lv_obj_set_style_radius(obj, LV_RADIUS_CIRCLE, 0);

View File

@@ -8,7 +8,7 @@ def anim_size_cb(obj, v):
#
# Create a playback animation
#
obj = lv.obj(lv.scr_act())
obj = lv.obj(lv.screen_active())
obj.set_style_bg_color(lv.palette_main(lv.PALETTE.RED), 0)
obj.set_style_radius(lv.RADIUS_CIRCLE, 0)

View File

@@ -40,7 +40,7 @@ void lv_example_anim_3(void)
static lv_coord_t row_dsc[] = {30, 10, 10, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_style_pad_all(cont, 2, LV_PART_MAIN);
lv_obj_set_style_pad_column(cont, 10, LV_PART_MAIN);
lv_obj_set_style_pad_row(cont, 10, LV_PART_MAIN);
@@ -122,7 +122,7 @@ static void page_obj_init(lv_obj_t * par)
ginfo.anim_obj = lv_obj_create(par);
lv_obj_set_size(ginfo.anim_obj, 30, 30);
lv_obj_set_align(ginfo.anim_obj, LV_ALIGN_TOP_LEFT);
lv_obj_clear_flag(ginfo.anim_obj, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_remove_flag(ginfo.anim_obj, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_style_bg_color(ginfo.anim_obj, lv_palette_main(LV_PALETTE_RED), LV_PART_MAIN);
lv_obj_set_grid_cell(ginfo.anim_obj, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 0, 1);

View File

@@ -19,7 +19,7 @@ class LvExampleAnim_3():
self.p1 = 0
self.p2 = 0
self.cont = lv.obj(lv.scr_act())
self.cont = lv.obj(lv.screen_active())
self.cont.set_style_pad_all(2, lv.PART.MAIN)
self.cont.set_style_pad_column(10, lv.PART.MAIN)
self.cont.set_style_pad_row(10, lv.PART.MAIN)
@@ -42,7 +42,7 @@ class LvExampleAnim_3():
self.anim_obj = lv.obj(par)
self.anim_obj.set_size(30, 30)
self.anim_obj.set_align(lv.ALIGN.TOP_LEFT)
self.anim_obj.clear_flag(lv.obj.FLAG.SCROLLABLE)
self.anim_obj.remove_flag(lv.obj.FLAG.SCROLLABLE)
self.anim_obj.set_style_bg_color(lv.palette_main(lv.PALETTE.RED), lv.PART.MAIN)
self.anim_obj.set_grid_cell(lv.GRID_ALIGN.START, 0, 1,lv.GRID_ALIGN.START, 0, 1)

View File

@@ -102,11 +102,11 @@ static void btn_start_event_handler(lv_event_t * e)
lv_anim_timeline_start(anim_timeline);
}
static void btn_del_event_handler(lv_event_t * e)
static void btn_delete_event_handler(lv_event_t * e)
{
LV_UNUSED(e);
if(anim_timeline) {
lv_anim_timeline_del(anim_timeline);
lv_anim_timeline_delete(anim_timeline);
anim_timeline = NULL;
}
}
@@ -136,7 +136,7 @@ static void slider_prg_event_handler(lv_event_t * e)
*/
void lv_example_anim_timeline_1(void)
{
lv_obj_t * par = lv_scr_act();
lv_obj_t * par = lv_screen_active();
lv_obj_set_flex_flow(par, LV_FLEX_FLOW_ROW);
lv_obj_set_flex_align(par, LV_FLEX_ALIGN_SPACE_AROUND, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
@@ -153,7 +153,7 @@ void lv_example_anim_timeline_1(void)
/* create btn_del */
lv_obj_t * btn_del = lv_button_create(par);
lv_obj_add_event(btn_del, btn_del_event_handler, LV_EVENT_CLICKED, NULL);
lv_obj_add_event(btn_del, btn_delete_event_handler, LV_EVENT_CLICKED, NULL);
lv_obj_add_flag(btn_del, LV_OBJ_FLAG_IGNORE_LAYOUT);
lv_obj_align(btn_del, LV_ALIGN_TOP_MID, 0, 20);

View File

@@ -7,7 +7,7 @@ class LV_ExampleAnimTimeline_1(object):
# Create an animation timeline
#
self.par = lv.scr_act()
self.par = lv.screen_active()
self.par.set_flex_flow(lv.FLEX_FLOW.ROW)
self.par.set_flex_align(lv.FLEX_ALIGN.SPACE_AROUND, lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.CENTER)
@@ -22,7 +22,7 @@ class LV_ExampleAnimTimeline_1(object):
self.label_run.center()
self.button_del = lv.button(self.par)
self.button_del.add_event(self.button_del_event_handler, lv.EVENT.CLICKED, None)
self.button_del.add_event(self.button_delete_event_handler, lv.EVENT.CLICKED, None)
self.button_del.add_flag(lv.obj.FLAG.IGNORE_LAYOUT)
self.button_del.align(lv.ALIGN.TOP_MID, 50, 20)
@@ -134,9 +134,9 @@ class LV_ExampleAnimTimeline_1(object):
self.anim_timeline.set_reverse(reverse)
self.anim_timeline.start()
def button_del_event_handler(self,e):
def button_delete_event_handler(self,e):
if self.anim_timeline:
self.anim_timeline._del()
self.anim_timeline._delete()
self.anim_timeline = None