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
@@ -7,12 +7,12 @@
void lv_example_get_started_1(void)
{
/*Change the active screen's background color*/
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x003a57), LV_PART_MAIN);
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);
/*Create a white label, set its text and align it to the center*/
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 world");
lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
}
@@ -1,9 +1,9 @@
# Change the active screen's background color
scr = lv.scr_act()
scr = lv.screen_active()
scr.set_style_bg_color(lv.color_hex(0x003a57), lv.PART.MAIN)
# Create a white label, set its text and align it to the center
label = lv.label(lv.scr_act())
label = lv.label(lv.screen_active())
label.set_text("Hello world")
label.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN)
label.align(lv.ALIGN.CENTER, 0, 0)
@@ -20,7 +20,7 @@ static void btn_event_cb(lv_event_t * e)
*/
void lv_example_get_started_2(void)
{
lv_obj_t * btn = lv_button_create(lv_scr_act()); /*Add a button the current screen*/
lv_obj_t * btn = lv_button_create(lv_screen_active()); /*Add a button the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 120, 50); /*Set its size*/
lv_obj_add_event(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/
@@ -5,7 +5,7 @@ class CounterBtn():
# Create a button with a label and react on click event.
#
button = lv.button(lv.scr_act()) # Add a button the current screen
button = lv.button(lv.screen_active()) # Add a button the current screen
button.set_pos(10, 10) # Set its position
button.set_size(120, 50) # Set its size
button.align(lv.ALIGN.CENTER,0,0)
@@ -50,7 +50,7 @@ void lv_example_get_started_3(void)
style_init();
/*Create a button and use the new styles*/
lv_obj_t * btn = lv_button_create(lv_scr_act());
lv_obj_t * btn = lv_button_create(lv_screen_active());
/* Remove the styles coming from the theme
* Note that size and position are also stored as style properties
* so lv_obj_remove_style_all will remove the set size and position too */
@@ -66,7 +66,7 @@ void lv_example_get_started_3(void)
lv_obj_center(label);
/*Create another button and use the red style too*/
lv_obj_t * btn2 = lv_button_create(lv_scr_act());
lv_obj_t * btn2 = lv_button_create(lv_screen_active());
lv_obj_remove_style_all(btn2); /*Remove the styles coming from the theme*/
lv_obj_set_pos(btn2, 10, 80);
lv_obj_set_size(btn2, 120, 50);
@@ -32,7 +32,7 @@ style_button_pressed.set_bg_color(lv.palette_main(lv.PALETTE.BLUE))
style_button_pressed.set_bg_grad_color(lv.palette_darken(lv.PALETTE.RED, 3))
# Create a button and use the new styles
button = lv.button(lv.scr_act()) # Add a button the current screen
button = lv.button(lv.screen_active()) # Add a button the current screen
# Remove the styles coming from the theme
# Note that size and position are also stored as style properties
# so lv_obj_remove_style_all will remove the set size and position too
@@ -47,12 +47,12 @@ label.set_text("Button") # Set the labels text
label.center()
# Create a slider in the center of the display
slider = lv.slider(lv.scr_act())
slider = lv.slider(lv.screen_active())
slider.set_width(200) # Set the width
slider.center() # Align to the center of the parent (screen)
# Create another button and use the red style too
button2 = lv.button(lv.scr_act())
button2 = lv.button(lv.screen_active())
button2.remove_style_all() # Remove the styles coming from the theme
button2.set_pos(10, 80) # Set its position
button2.set_size(120, 50) # Set its size
@@ -18,13 +18,13 @@ static void slider_event_cb(lv_event_t * e)
void lv_example_get_started_4(void)
{
/*Create a slider in the center of the display*/
lv_obj_t * slider = lv_slider_create(lv_scr_act());
lv_obj_t * slider = lv_slider_create(lv_screen_active());
lv_obj_set_width(slider, 200); /*Set the width*/
lv_obj_center(slider); /*Align to the center of the parent (screen)*/
lv_obj_add_event(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Assign an event function*/
/*Create a label above the slider*/
label = lv_label_create(lv_scr_act());
label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "0");
lv_obj_align_to(label, slider, LV_ALIGN_OUT_TOP_MID, 0, -15); /*Align top of the slider*/
}
@@ -9,13 +9,13 @@ def slider_event_cb(e):
#
# Create a slider in the center of the display
slider = lv.slider(lv.scr_act())
slider = lv.slider(lv.screen_active())
slider.set_width(200) # Set the width
slider.center() # Align to the center of the parent (screen)
slider.add_event(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) # Assign an event function
# Create a label above the slider
label = lv.label(lv.scr_act())
label = lv.label(lv.screen_active())
label.set_text("0")
label.align_to(slider, lv.ALIGN.OUT_TOP_MID, 0, -15) # Align below the slider