refactor: scr -> screen, act->active, del->delete, remove in obj_clear_flag/state
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ static void event_cb(lv_event_t * e)
|
||||
*/
|
||||
void lv_example_event_1(void)
|
||||
{
|
||||
lv_obj_t * btn = lv_button_create(lv_scr_act());
|
||||
lv_obj_t * btn = lv_button_create(lv_screen_active());
|
||||
lv_obj_set_size(btn, 100, 50);
|
||||
lv_obj_center(btn);
|
||||
lv_obj_add_event(btn, event_cb, LV_EVENT_CLICKED, NULL);
|
||||
|
||||
@@ -5,7 +5,7 @@ class Event_1():
|
||||
# Add click event to a button
|
||||
#
|
||||
|
||||
button = lv.button(lv.scr_act())
|
||||
button = lv.button(lv.screen_active())
|
||||
button.set_size(100, 50)
|
||||
button.center()
|
||||
button.add_event(self.event_cb, lv.EVENT.CLICKED, None)
|
||||
|
||||
@@ -29,7 +29,7 @@ static void event_cb(lv_event_t * e)
|
||||
*/
|
||||
void lv_example_event_2(void)
|
||||
{
|
||||
lv_obj_t * btn = lv_button_create(lv_scr_act());
|
||||
lv_obj_t * btn = lv_button_create(lv_screen_active());
|
||||
lv_obj_set_size(btn, 100, 50);
|
||||
lv_obj_center(btn);
|
||||
|
||||
@@ -37,7 +37,7 @@ void lv_example_event_2(void)
|
||||
lv_label_set_text(btn_label, "Click me!");
|
||||
lv_obj_center(btn_label);
|
||||
|
||||
lv_obj_t * info_label = lv_label_create(lv_scr_act());
|
||||
lv_obj_t * info_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(info_label, "The last button event:\nNone");
|
||||
|
||||
lv_obj_add_event(btn, event_cb, LV_EVENT_ALL, info_label);
|
||||
|
||||
@@ -8,7 +8,7 @@ def event_cb(e,label):
|
||||
label.set_text("The last button event:\nLV_EVENT_LONG_PRESSED")
|
||||
elif code == lv.EVENT.LONG_PRESSED_REPEAT:
|
||||
label.set_text("The last button event:\nLV_EVENT_LONG_PRESSED_REPEAT")
|
||||
button = lv.button(lv.scr_act())
|
||||
button = lv.button(lv.screen_active())
|
||||
button.set_size(100, 50)
|
||||
button.center()
|
||||
|
||||
@@ -16,7 +16,7 @@ button_label = lv.label(button)
|
||||
button_label.set_text("Click me!")
|
||||
button_label.center()
|
||||
|
||||
info_label = lv.label(lv.scr_act())
|
||||
info_label = lv.label(lv.screen_active())
|
||||
info_label.set_text("The last button event:\nNone")
|
||||
|
||||
button.add_event(lambda e: event_cb(e,info_label), lv.EVENT.ALL, None)
|
||||
|
||||
@@ -22,7 +22,7 @@ static void event_cb(lv_event_t * e)
|
||||
void lv_example_event_3(void)
|
||||
{
|
||||
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(cont, 290, 200);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW_WRAP);
|
||||
|
||||
@@ -17,7 +17,7 @@ def event_cb(e):
|
||||
# Demonstrate event bubbling
|
||||
#
|
||||
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_size(290, 200)
|
||||
cont.center()
|
||||
cont.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP)
|
||||
|
||||
@@ -47,7 +47,7 @@ static void event_cb(lv_event_t * e)
|
||||
*/
|
||||
void lv_example_event_4(void)
|
||||
{
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(cont, 200, 200);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_add_event(cont, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||
|
||||
@@ -6,7 +6,7 @@ class LV_Example_Event_4:
|
||||
#
|
||||
self.size = 0
|
||||
self.size_dec = False
|
||||
self.cont = lv.obj(lv.scr_act())
|
||||
self.cont = lv.obj(lv.screen_active())
|
||||
self.cont.set_size(200, 200)
|
||||
self.cont.center()
|
||||
self.cont.add_event(self.event_cb, lv.EVENT.DRAW_TASK_ADDED, None)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
void lv_example_flex_1(void)
|
||||
{
|
||||
/*Create a container with ROW flex direction*/
|
||||
lv_obj_t * cont_row = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont_row = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(cont_row, 300, 75);
|
||||
lv_obj_align(cont_row, LV_ALIGN_TOP_MID, 0, 5);
|
||||
lv_obj_set_flex_flow(cont_row, LV_FLEX_FLOW_ROW);
|
||||
|
||||
/*Create a container with COLUMN flex direction*/
|
||||
lv_obj_t * cont_col = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont_col = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(cont_col, 200, 150);
|
||||
lv_obj_align_to(cont_col, cont_row, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
|
||||
lv_obj_set_flex_flow(cont_col, LV_FLEX_FLOW_COLUMN);
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
#
|
||||
|
||||
# Create a container with ROW flex direction
|
||||
cont_row = lv.obj(lv.scr_act())
|
||||
cont_row = lv.obj(lv.screen_active())
|
||||
cont_row.set_size(300, 75)
|
||||
cont_row.align(lv.ALIGN.TOP_MID, 0, 5)
|
||||
cont_row.set_flex_flow(lv.FLEX_FLOW.ROW)
|
||||
|
||||
# Create a container with COLUMN flex direction
|
||||
cont_col = lv.obj(lv.scr_act())
|
||||
cont_col = lv.obj(lv.screen_active())
|
||||
cont_col.set_size(200, 150)
|
||||
cont_col.align_to(cont_row, lv.ALIGN.OUT_BOTTOM_MID, 0, 5)
|
||||
cont_col.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
|
||||
@@ -12,7 +12,7 @@ void lv_example_flex_2(void)
|
||||
lv_style_set_flex_main_place(&style, LV_FLEX_ALIGN_SPACE_EVENLY);
|
||||
lv_style_set_layout(&style, LV_LAYOUT_FLEX);
|
||||
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_add_style(cont, &style, 0);
|
||||
|
||||
@@ -7,7 +7,7 @@ style.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP)
|
||||
style.set_flex_main_place(lv.FLEX_ALIGN.SPACE_EVENLY)
|
||||
style.set_layout(lv.LAYOUT.FLEX)
|
||||
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_size(300, 220)
|
||||
cont.center()
|
||||
cont.add_style(style, 0)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
void lv_example_flex_3(void)
|
||||
{
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Demonstrate flex grow.
|
||||
#
|
||||
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_size(300, 220)
|
||||
cont.center()
|
||||
cont.set_flex_flow(lv.FLEX_FLOW.ROW)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
void lv_example_flex_4(void)
|
||||
{
|
||||
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_COLUMN_REVERSE);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Reverse the order of flex items
|
||||
#
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_size(300, 220)
|
||||
cont.center()
|
||||
cont.set_flex_flow(lv.FLEX_FLOW.COLUMN_REVERSE)
|
||||
|
||||
@@ -16,7 +16,7 @@ static void column_gap_anim(void * obj, int32_t v)
|
||||
*/
|
||||
void lv_example_flex_5(void)
|
||||
{
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW_WRAP);
|
||||
|
||||
@@ -9,7 +9,7 @@ def column_gap_anim(obj, v):
|
||||
# Demonstrate the effect of column and row gap style properties
|
||||
#
|
||||
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_size(300, 220)
|
||||
cont.center()
|
||||
cont.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
void lv_example_flex_6(void)
|
||||
{
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_style_base_dir(cont, LV_BASE_DIR_RTL, 0);
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Also demonstrate how horizontal scrolling works with RTL.
|
||||
#
|
||||
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_style_base_dir(lv.BASE_DIR.RTL,0)
|
||||
cont.set_size(300, 220)
|
||||
cont.center()
|
||||
|
||||
@@ -10,7 +10,7 @@ void lv_example_grid_1(void)
|
||||
static lv_coord_t row_dsc[] = {50, 50, 50, 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_grid_column_dsc_array(cont, col_dsc, 0);
|
||||
lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0);
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
|
||||
@@ -6,7 +6,7 @@ col_dsc = [70, 70, 70, lv.GRID_TEMPLATE_LAST]
|
||||
row_dsc = [50, 50, 50, lv.GRID_TEMPLATE_LAST]
|
||||
|
||||
# Create a container with grid
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_style_grid_column_dsc_array(col_dsc, 0)
|
||||
cont.set_style_grid_row_dsc_array(row_dsc, 0)
|
||||
cont.set_size(300, 220)
|
||||
|
||||
@@ -11,7 +11,7 @@ void lv_example_grid_2(void)
|
||||
static lv_coord_t row_dsc[] = {50, 50, 50, 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_grid_dsc_array(cont, col_dsc, row_dsc);
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
|
||||
@@ -6,7 +6,7 @@ col_dsc = [70, 70, 70, lv.GRID_TEMPLATE_LAST]
|
||||
row_dsc = [50, 50, 50, lv.GRID_TEMPLATE_LAST]
|
||||
|
||||
# Create a container with grid
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_grid_dsc_array(col_dsc, row_dsc)
|
||||
cont.set_size(300, 220)
|
||||
cont.center()
|
||||
|
||||
@@ -17,7 +17,7 @@ void lv_example_grid_3(void)
|
||||
static lv_coord_t row_dsc[] = {50, LV_GRID_FR(1), 50, 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_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
|
||||
|
||||
@@ -15,7 +15,7 @@ col_dsc = [60, lv.grid_fr(1), lv.grid_fr(2), lv.GRID_TEMPLATE_LAST]
|
||||
row_dsc = [40, lv.grid_fr(1), 40, lv.GRID_TEMPLATE_LAST]
|
||||
|
||||
# Create a container with grid
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_size(300, 220)
|
||||
cont.center()
|
||||
cont.set_grid_dsc_array(col_dsc, row_dsc)
|
||||
|
||||
@@ -13,7 +13,7 @@ void lv_example_grid_4(void)
|
||||
/*Add space between the columns and move the rows to the bottom (end)*/
|
||||
|
||||
/*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_grid_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, LV_GRID_ALIGN_END);
|
||||
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
|
||||
@@ -9,7 +9,7 @@ row_dsc = [40, 40, 40, lv.GRID_TEMPLATE_LAST]
|
||||
# Add space between the columns and move the rows to the bottom (end)
|
||||
|
||||
# Create a container with grid
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_grid_align(lv.GRID_ALIGN.SPACE_BETWEEN, lv.GRID_ALIGN.END)
|
||||
cont.set_grid_dsc_array(col_dsc, row_dsc)
|
||||
cont.set_size(300, 220)
|
||||
|
||||
@@ -22,7 +22,7 @@ void lv_example_grid_5(void)
|
||||
static lv_coord_t row_dsc[] = {45, 45, 45, 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_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
|
||||
|
||||
@@ -13,7 +13,7 @@ col_dsc = [60, 60, 60, lv.GRID_TEMPLATE_LAST]
|
||||
row_dsc = [40, 40, 40, lv.GRID_TEMPLATE_LAST]
|
||||
|
||||
# Create a container with grid
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_size(300, 220)
|
||||
cont.center()
|
||||
cont.set_grid_dsc_array(col_dsc, row_dsc)
|
||||
|
||||
@@ -11,7 +11,7 @@ void lv_example_grid_6(void)
|
||||
static lv_coord_t row_dsc[] = {45, 45, 45, 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_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_style_base_dir(cont, LV_BASE_DIR_RTL, 0);
|
||||
|
||||
@@ -5,7 +5,7 @@ col_dsc = [60, 60, 60, lv.GRID_TEMPLATE_LAST]
|
||||
row_dsc = [40, 40, 40, lv.GRID_TEMPLATE_LAST]
|
||||
|
||||
# Create a container with grid
|
||||
cont = lv.obj(lv.scr_act())
|
||||
cont = lv.obj(lv.screen_active())
|
||||
cont.set_size(300, 220)
|
||||
cont.center()
|
||||
cont.set_style_base_dir(lv.BASE_DIR.RTL,0)
|
||||
|
||||
@@ -9,7 +9,7 @@ void lv_example_barcode_1(void)
|
||||
lv_color_t bg_color = lv_palette_lighten(LV_PALETTE_LIGHT_BLUE, 5);
|
||||
lv_color_t fg_color = lv_palette_darken(LV_PALETTE_BLUE, 4);
|
||||
|
||||
lv_obj_t * barcode = lv_barcode_create(lv_scr_act());
|
||||
lv_obj_t * barcode = lv_barcode_create(lv_screen_active());
|
||||
lv_obj_set_height(barcode, 50);
|
||||
lv_obj_center(barcode);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import display_driver
|
||||
bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
|
||||
fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
|
||||
|
||||
barcode = lv.barcode(lv.scr_act())
|
||||
barcode = lv.barcode(lv.screen_active())
|
||||
barcode.set_height(50)
|
||||
barcode.center()
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
void lv_example_bmp_1(void)
|
||||
{
|
||||
lv_obj_t * img = lv_image_create(lv_scr_act());
|
||||
lv_obj_t * img = lv_image_create(lv_screen_active());
|
||||
/* Assuming a File system is attached to letter 'A'
|
||||
* E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
|
||||
lv_image_set_src(img, "A:lvgl/examples/libs/bmp/example_32bit.bmp");
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
void lv_example_ffmpeg_1(void)
|
||||
{
|
||||
lv_obj_t * img = lv_image_create(lv_scr_act());
|
||||
lv_obj_t * img = lv_image_create(lv_screen_active());
|
||||
lv_image_set_src(img, "./lvgl/examples/libs/ffmpeg/ffmpeg.png");
|
||||
lv_obj_center(img);
|
||||
}
|
||||
@@ -20,7 +20,7 @@ void lv_example_ffmpeg_1(void)
|
||||
/*TODO
|
||||
*fallback for online examples*/
|
||||
|
||||
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, "FFmpeg is not installed");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ try:
|
||||
#
|
||||
# Open an image from a file
|
||||
#
|
||||
image = lv.image(lv.scr_act())
|
||||
image = lv.image(lv.screen_active())
|
||||
image.set_src("ffmpeg.png")
|
||||
image.center()
|
||||
except Exception as e:
|
||||
@@ -15,7 +15,7 @@ except Exception as e:
|
||||
# TODO
|
||||
# fallback for online examples
|
||||
|
||||
label = lv.label(lv.scr_act())
|
||||
label = lv.label(lv.screen_active())
|
||||
label.set_text("FFmpeg is not installed")
|
||||
label.center()
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ void lv_example_ffmpeg_2(void)
|
||||
{
|
||||
/*birds.mp4 is downloaded from http://www.videezy.com (Free Stock Footage by Videezy!)
|
||||
*https://www.videezy.com/abstract/44864-silhouettes-of-birds-over-the-sunset*/
|
||||
lv_obj_t * player = lv_ffmpeg_player_create(lv_scr_act());
|
||||
lv_obj_t * player = lv_ffmpeg_player_create(lv_screen_active());
|
||||
lv_ffmpeg_player_set_src(player, "./lvgl/examples/libs/ffmpeg/birds.mp4");
|
||||
lv_ffmpeg_player_set_auto_restart(player, true);
|
||||
lv_ffmpeg_player_set_cmd(player, LV_FFMPEG_PLAYER_CMD_START);
|
||||
@@ -23,7 +23,7 @@ void lv_example_ffmpeg_2(void)
|
||||
/*TODO
|
||||
*fallback for online examples*/
|
||||
|
||||
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, "FFmpeg is not installed");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import display_driver
|
||||
|
||||
# birds.mp4 is downloaded from http://www.videezy.com (Free Stock Footage by Videezy!)
|
||||
# https://www.videezy.com/abstract/44864-silhouettes-of-birds-over-the-sunset
|
||||
player = lv.ffmpeg_player(lv.scr_act())
|
||||
player = lv.ffmpeg_player(lv.screen_active())
|
||||
player.player_set_src("birds.mp4")
|
||||
player.player_set_auto_restart(True)
|
||||
player.player_set_cmd(lv.ffmpeg_player.PLAYER_CMD.START)
|
||||
|
||||
@@ -30,7 +30,7 @@ void lv_example_freetype_1(void)
|
||||
lv_style_set_text_align(&style, LV_TEXT_ALIGN_CENTER);
|
||||
|
||||
/*Create a label with the new style*/
|
||||
lv_obj_t * label = lv_label_create(lv_scr_act());
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_obj_add_style(label, &style, 0);
|
||||
lv_label_set_text(label, "Hello world\nI'm a font created with FreeType");
|
||||
lv_obj_center(label);
|
||||
@@ -42,7 +42,7 @@ void lv_example_freetype_1(void)
|
||||
/*TODO
|
||||
*fallback for online examples*/
|
||||
|
||||
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, "FreeType is not installed");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ style.set_text_font(font)
|
||||
style.set_text_align(lv.TEXT_ALIGN.CENTER)
|
||||
|
||||
# Create a label with the new style
|
||||
label = lv.label(lv.scr_act())
|
||||
label = lv.label(lv.screen_active())
|
||||
label.add_style(style, 0)
|
||||
label.set_text("Hello world\nI'm a font created with FreeType")
|
||||
label.center()
|
||||
|
||||
@@ -9,11 +9,11 @@ void lv_example_gif_1(void)
|
||||
LV_IMAGE_DECLARE(img_bulb_gif);
|
||||
lv_obj_t * img;
|
||||
|
||||
img = lv_gif_create(lv_scr_act());
|
||||
img = lv_gif_create(lv_screen_active());
|
||||
lv_gif_set_src(img, &img_bulb_gif);
|
||||
lv_obj_align(img, LV_ALIGN_LEFT_MID, 20, 0);
|
||||
|
||||
img = lv_gif_create(lv_scr_act());
|
||||
img = lv_gif_create(lv_screen_active());
|
||||
/* Assuming a File system is attached to letter 'A'
|
||||
* E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
|
||||
lv_gif_set_src(img, "A:lvgl/examples/libs/gif/bulb.gif");
|
||||
|
||||
@@ -16,11 +16,11 @@ image_bulb_gif = lv.image_dsc_t(
|
||||
"data": img_bulb_gif_map,
|
||||
}
|
||||
)
|
||||
image1 = lv.gif(lv.scr_act())
|
||||
image1 = lv.gif(lv.screen_active())
|
||||
image1.set_src(image_bulb_gif)
|
||||
image1.align(lv.ALIGN.RIGHT_MID, -150, 0)
|
||||
|
||||
image2 = lv.gif(lv.scr_act())
|
||||
image2 = lv.gif(lv.screen_active())
|
||||
# The File system is attached to letter 'S'
|
||||
|
||||
image2.set_src("S:bulb.gif")
|
||||
|
||||
@@ -10,7 +10,7 @@ void lv_example_libjpeg_turbo_1(void)
|
||||
{
|
||||
lv_obj_t * wp;
|
||||
|
||||
wp = lv_image_create(lv_scr_act());
|
||||
wp = lv_image_create(lv_screen_active());
|
||||
/* Assuming a File system is attached to letter 'A'
|
||||
* E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
|
||||
lv_image_set_src(wp, "A:lvgl/examples/libs/libjpeg_turbo/flower.jpg");
|
||||
@@ -21,7 +21,7 @@ void lv_example_libjpeg_turbo_1(void)
|
||||
|
||||
void lv_example_libjpeg_turbo_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, "LibJPEG-Turbo is not installed");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import fs_driver
|
||||
fs_drv = lv.fs_drv_t()
|
||||
fs_driver.fs_register(fs_drv, 'S')
|
||||
|
||||
wp = lv.image(lv.scr_act())
|
||||
wp = lv.image(lv.screen_active())
|
||||
# The File system is attached to letter 'S'
|
||||
|
||||
wp.set_src("S:flower.jpg")
|
||||
|
||||
@@ -10,7 +10,7 @@ void lv_example_libpng_1(void)
|
||||
{
|
||||
lv_obj_t * img;
|
||||
|
||||
img = lv_image_create(lv_scr_act());
|
||||
img = lv_image_create(lv_screen_active());
|
||||
/* Assuming a File system is attached to letter 'A'
|
||||
* E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
|
||||
lv_image_set_src(img, "A:lvgl/examples/libs/libpng/png_demo.png");
|
||||
@@ -21,7 +21,7 @@ void lv_example_libpng_1(void)
|
||||
|
||||
void lv_example_libpng_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, "LibPNG is not installed");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ import fs_driver
|
||||
fs_drv = lv.fs_drv_t()
|
||||
fs_driver.fs_register(fs_drv, 'S')
|
||||
|
||||
image = lv.image(lv.scr_act())
|
||||
image = lv.image(lv.screen_active())
|
||||
image.set_src("S:png_demo.png")
|
||||
image.center()
|
||||
|
||||
@@ -9,11 +9,11 @@ void lv_example_lodepng_1(void)
|
||||
LV_IMAGE_DECLARE(img_wink_png);
|
||||
lv_obj_t * img;
|
||||
|
||||
img = lv_image_create(lv_scr_act());
|
||||
img = lv_image_create(lv_screen_active());
|
||||
lv_image_set_src(img, &img_wink_png);
|
||||
lv_obj_align(img, LV_ALIGN_LEFT_MID, 20, 0);
|
||||
|
||||
img = lv_image_create(lv_scr_act());
|
||||
img = lv_image_create(lv_screen_active());
|
||||
/* Assuming a File system is attached to letter 'A'
|
||||
* E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
|
||||
lv_image_set_src(img, "A:lvgl/examples/libs/lodepng/wink.png");
|
||||
|
||||
@@ -10,7 +10,7 @@ image_wink_png = lv.image_dsc_t(
|
||||
"data": img_wink_png_map,
|
||||
}
|
||||
)
|
||||
image1 = lv.image(lv.scr_act())
|
||||
image1 = lv.image(lv.screen_active())
|
||||
image1.set_src(image_wink_png)
|
||||
image1.align(lv.ALIGN.RIGHT_MID, -250, 0)
|
||||
|
||||
@@ -27,6 +27,6 @@ wink_argb = lv.image_dsc_t({
|
||||
'data': png_data
|
||||
})
|
||||
|
||||
image2 = lv.image(lv.scr_act())
|
||||
image2 = lv.image(lv.screen_active())
|
||||
image2.set_src(wink_argb)
|
||||
image2.align(lv.ALIGN.RIGHT_MID, -150, 0)
|
||||
|
||||
@@ -9,7 +9,7 @@ void lv_example_qrcode_1(void)
|
||||
lv_color_t bg_color = lv_palette_lighten(LV_PALETTE_LIGHT_BLUE, 5);
|
||||
lv_color_t fg_color = lv_palette_darken(LV_PALETTE_BLUE, 4);
|
||||
|
||||
lv_obj_t * qr = lv_qrcode_create(lv_scr_act());
|
||||
lv_obj_t * qr = lv_qrcode_create(lv_screen_active());
|
||||
lv_qrcode_set_size(qr, 150);
|
||||
lv_qrcode_set_dark_color(qr, fg_color);
|
||||
lv_qrcode_set_light_color(qr, bg_color);
|
||||
|
||||
@@ -5,7 +5,7 @@ import display_driver
|
||||
bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
|
||||
fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
|
||||
|
||||
qr = lv.qrcode(lv.scr_act())
|
||||
qr = lv.qrcode(lv.screen_active())
|
||||
qr.set_size(150)
|
||||
qr.set_dark_color(fg_color)
|
||||
qr.set_light_color(bg_color)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
void lv_example_rlottie_1(void)
|
||||
{
|
||||
extern const uint8_t lv_example_rlottie_approve[];
|
||||
lv_obj_t * lottie = lv_rlottie_create_from_raw(lv_scr_act(), 100, 100, (const void *)lv_example_rlottie_approve);
|
||||
lv_obj_t * lottie = lv_rlottie_create_from_raw(lv_screen_active(), 100, 100, (const void *)lv_example_rlottie_approve);
|
||||
lv_obj_center(lottie);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ void lv_example_rlottie_1(void)
|
||||
/*TODO
|
||||
*fallback for online examples*/
|
||||
|
||||
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, "Rlottie is not installed");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ import display_driver
|
||||
#
|
||||
from lv_example_rlottie_approve import lv_example_rlottie_approve
|
||||
|
||||
lottie = lv.rlottie_create_from_raw(lv.scr_act(), 100, 100, lv_example_rlottie_approve)
|
||||
lottie = lv.rlottie_create_from_raw(lv.screen_active(), 100, 100, lv_example_rlottie_approve)
|
||||
lottie.center()
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
void lv_example_rlottie_2(void)
|
||||
{
|
||||
/*The rlottie library uses STDIO file API, so there is no driver letter for LVGL*/
|
||||
lv_obj_t * lottie = lv_rlottie_create_from_file(lv_scr_act(), 100, 100,
|
||||
lv_obj_t * lottie = lv_rlottie_create_from_file(lv_screen_active(), 100, 100,
|
||||
"lvgl/examples/libs/rlottie/lv_example_rlottie_approve.json");
|
||||
lv_obj_center(lottie);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ void lv_example_rlottie_2(void)
|
||||
/*TODO
|
||||
*fallback for online examples*/
|
||||
|
||||
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, "Rlottie is not installed");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
import lvgl as lv
|
||||
import display_driver
|
||||
|
||||
lottie = lv.rlottie_create_from_file(lv.scr_act(), 100, 100,"lv_example_rlottie_approve.json")
|
||||
lottie = lv.rlottie_create_from_file(lv.screen_active(), 100, 100,"lv_example_rlottie_approve.json")
|
||||
lottie.center()
|
||||
|
||||
@@ -17,7 +17,7 @@ void lv_example_tiny_ttf_1(void)
|
||||
lv_style_set_text_align(&style, LV_TEXT_ALIGN_CENTER);
|
||||
|
||||
/*Create a label with the new style*/
|
||||
lv_obj_t * label = lv_label_create(lv_scr_act());
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_obj_add_style(label, &style, 0);
|
||||
lv_label_set_text(label, "Hello world\nI'm a font\ncreated\nwith Tiny TTF");
|
||||
lv_obj_center(label);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from ubuntu_font import ubuntu_font
|
||||
#
|
||||
#
|
||||
# Load a font with Tiny_TTF
|
||||
#
|
||||
#Create style with the new font
|
||||
@@ -10,7 +10,7 @@ style.set_text_font(font)
|
||||
style.set_text_align(lv.TEXT_ALIGN.CENTER)
|
||||
|
||||
# Create a label with the new style
|
||||
label = lv.label(lv.scr_act())
|
||||
label = lv.label(lv.screen_active())
|
||||
label.add_style(style, 0)
|
||||
label.set_text("Hello world\nI'm a font created with Tiny TTF")
|
||||
label.center()
|
||||
|
||||
@@ -14,7 +14,7 @@ void lv_example_tiny_ttf_2(void)
|
||||
lv_style_set_text_align(&style, LV_TEXT_ALIGN_CENTER);
|
||||
|
||||
/*Create a label with the new style*/
|
||||
lv_obj_t * label = lv_label_create(lv_scr_act());
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_obj_add_style(label, &style, 0);
|
||||
lv_label_set_text(label, "Hello world\nI'm a font\ncreated\nwith Tiny TTF");
|
||||
lv_obj_center(label);
|
||||
|
||||
@@ -7,7 +7,7 @@ fs_driver.fs_register(fs_drv, 'S')
|
||||
# get the directory in which the script is running
|
||||
try:
|
||||
script_path = __file__[:__file__.rfind('/')] if __file__.find('/') >= 0 else '.'
|
||||
except NameError:
|
||||
except NameError:
|
||||
script_path = ''
|
||||
|
||||
#
|
||||
@@ -21,7 +21,7 @@ style.set_text_font(font)
|
||||
style.set_text_align(lv.TEXT_ALIGN.CENTER)
|
||||
|
||||
# Create a label with the new style
|
||||
label = lv.label(lv.scr_act())
|
||||
label = lv.label(lv.screen_active())
|
||||
label.add_style(style, 0)
|
||||
label.set_text("Hello world\nI'm a font created with Tiny TTF")
|
||||
label.center()
|
||||
|
||||
@@ -22,19 +22,19 @@ void lv_example_tiny_ttf_3(void)
|
||||
lv_style_set_text_font(&style, font);
|
||||
lv_style_set_text_align(&style, LV_TEXT_ALIGN_CENTER);
|
||||
|
||||
lv_obj_t * slider = lv_slider_create(lv_scr_act());
|
||||
lv_obj_t * slider = lv_slider_create(lv_screen_active());
|
||||
lv_obj_center(slider);
|
||||
lv_slider_set_range(slider, 5, 50);
|
||||
lv_obj_align(slider, LV_ALIGN_BOTTOM_MID, 0, -50);
|
||||
lv_slider_bind_value(slider, &subject_font);
|
||||
|
||||
lv_obj_t * slider_label = lv_label_create(lv_scr_act());
|
||||
lv_obj_t * slider_label = lv_label_create(lv_screen_active());
|
||||
lv_obj_align_to(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
lv_label_bind_text(slider_label, &subject_font, "%d");
|
||||
|
||||
|
||||
/*Create a label with the new style*/
|
||||
lv_obj_t * label = lv_label_create(lv_scr_act());
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_obj_add_style(label, &style, 0);
|
||||
lv_obj_set_size(label, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(label, "Hello world!");
|
||||
|
||||
@@ -8,7 +8,7 @@ void lv_example_tjpgd_1(void)
|
||||
{
|
||||
lv_obj_t * wp;
|
||||
|
||||
wp = lv_image_create(lv_scr_act());
|
||||
wp = lv_image_create(lv_screen_active());
|
||||
/* Assuming a File system is attached to letter 'A'
|
||||
* E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
|
||||
lv_image_set_src(wp, "A:lvgl/examples/libs/tjpgd/img_lvgl_logo.jpg");
|
||||
|
||||
@@ -6,7 +6,7 @@ import fs_driver
|
||||
fs_drv = lv.fs_drv_t()
|
||||
fs_driver.fs_register(fs_drv, 'S')
|
||||
|
||||
wp = lv.image(lv.scr_act())
|
||||
wp = lv.image(lv.screen_active())
|
||||
# The File system is attached to letter 'S'
|
||||
|
||||
wp.set_src("S:img_lvgl_logo.jpg")
|
||||
|
||||
@@ -31,7 +31,7 @@ static void file_explorer_event_handler(lv_event_t * e)
|
||||
|
||||
void lv_example_file_explorer_1(void)
|
||||
{
|
||||
lv_obj_t * file_explorer = lv_file_explorer_create(lv_scr_act());
|
||||
lv_obj_t * file_explorer = lv_file_explorer_create(lv_screen_active());
|
||||
lv_file_explorer_set_sort(file_explorer, LV_EXPLORER_SORT_KIND);
|
||||
|
||||
#if LV_USE_FS_WIN32
|
||||
|
||||
@@ -16,7 +16,7 @@ def file_explorer_event_handler(e) :
|
||||
# print("cur_path: " + str(cur_path), " sel_fn: " + str(sel_fn))
|
||||
print(str(cur_path) + str(sel_fn))
|
||||
|
||||
file_explorer = lv.file_explorer(lv.scr_act())
|
||||
file_explorer = lv.file_explorer(lv.screen_active())
|
||||
file_explorer.explorer_set_sort(lv.EXPLORER_SORT.KIND)
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ static void btn_event_handler(lv_event_t * e)
|
||||
if(lv_obj_has_state(btn, LV_STATE_CHECKED))
|
||||
lv_obj_add_flag(file_explorer, LV_OBJ_FLAG_HIDDEN);
|
||||
else
|
||||
lv_obj_clear_flag(file_explorer, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(file_explorer, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ static void dd_event_handler(lv_event_t * e)
|
||||
|
||||
void lv_example_file_explorer_2(void)
|
||||
{
|
||||
lv_obj_t * file_explorer = lv_file_explorer_create(lv_scr_act());
|
||||
lv_obj_t * file_explorer = lv_file_explorer_create(lv_screen_active());
|
||||
|
||||
#if LV_USE_FS_WIN32
|
||||
lv_file_explorer_open_dir(file_explorer, "D:");
|
||||
|
||||
@@ -24,7 +24,7 @@ def button_event_handler(e,fe_quick_access_obj):
|
||||
if button.has_state(lv.STATE.CHECKED) :
|
||||
fe_quick_access_obj.add_flag(lv.obj.FLAG.HIDDEN)
|
||||
else :
|
||||
fe_quick_access_obj.clear_flag(lv.obj.FLAG.HIDDEN)
|
||||
fe_quick_access_obj.remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
|
||||
def dd_event_handler(e, file_explorer):
|
||||
|
||||
@@ -43,7 +43,7 @@ def dd_event_handler(e, file_explorer):
|
||||
# print("set sort to KIND")
|
||||
file_explorer.explorer_set_sort(lv.EXPLORER_SORT.KIND)
|
||||
|
||||
file_explorer = lv.file_explorer(lv.scr_act())
|
||||
file_explorer = lv.file_explorer(lv.screen_active())
|
||||
|
||||
if LV_USE_FS_WIN32 :
|
||||
file_explorer.explorer_open_dir("D:")
|
||||
|
||||
@@ -75,7 +75,7 @@ static void file_explorer_event_handler(lv_event_t * e)
|
||||
|
||||
void lv_example_file_explorer_3(void)
|
||||
{
|
||||
lv_obj_t * file_explorer = lv_file_explorer_create(lv_scr_act());
|
||||
lv_obj_t * file_explorer = lv_file_explorer_create(lv_screen_active());
|
||||
/*Before custom sort, please set the default sorting to NONE. The default is NONE.*/
|
||||
lv_file_explorer_set_sort(file_explorer, LV_EXPLORER_SORT_NONE);
|
||||
|
||||
|
||||
@@ -57,11 +57,11 @@ def file_explorer_event_handler(e) :
|
||||
# print("sum: ",sum)
|
||||
sort_by_file_kind(tb, 0, (sum - 1));
|
||||
|
||||
file_explorer = lv.file_explorer(lv.scr_act())
|
||||
file_explorer = lv.file_explorer(lv.screen_active())
|
||||
# Before custom sort, please set the default sorting to NONE. The default is NONE.
|
||||
file_explorer.explorer_set_sort(lv.EXPLORER_SORT.NONE)
|
||||
|
||||
file_explorer = lv.file_explorer(lv.scr_act())
|
||||
file_explorer = lv.file_explorer(lv.screen_active())
|
||||
|
||||
if LV_USE_FS_WIN32 :
|
||||
file_explorer.explorer_open_dir("D:")
|
||||
|
||||
@@ -10,7 +10,7 @@ static void sample_fragment_ctor(lv_fragment_t * self, void * args);
|
||||
|
||||
static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * parent);
|
||||
|
||||
static void sample_container_del(lv_event_t * e);
|
||||
static void sample_container_delete(lv_event_t * e);
|
||||
|
||||
static lv_obj_t * root = NULL;
|
||||
|
||||
@@ -27,11 +27,11 @@ static const lv_fragment_class_t sample_cls = {
|
||||
|
||||
void lv_example_fragment_1(void)
|
||||
{
|
||||
root = lv_obj_create(lv_scr_act());
|
||||
root = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
|
||||
lv_fragment_manager_t * manager = lv_fragment_manager_create(NULL);
|
||||
/* Clean up the fragment manager before objects in containers got deleted */
|
||||
lv_obj_add_event(root, sample_container_del, LV_EVENT_DELETE, manager);
|
||||
lv_obj_add_event(root, sample_container_delete, LV_EVENT_DELETE, manager);
|
||||
|
||||
lv_fragment_t * fragment = lv_fragment_create(&sample_cls, "Fragment");
|
||||
lv_fragment_manager_replace(manager, fragment, &root);
|
||||
@@ -51,10 +51,10 @@ static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * pa
|
||||
return label;
|
||||
}
|
||||
|
||||
static void sample_container_del(lv_event_t * e)
|
||||
static void sample_container_delete(lv_event_t * e)
|
||||
{
|
||||
lv_fragment_manager_t * manager = (lv_fragment_manager_t *) lv_event_get_user_data(e);
|
||||
lv_fragment_manager_del(manager);
|
||||
lv_fragment_manager_delete(manager);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,7 @@ static void sample_push_click(lv_event_t * e);
|
||||
|
||||
static void sample_pop_click(lv_event_t * e);
|
||||
|
||||
static void sample_container_del(lv_event_t * e);
|
||||
static void sample_container_delete(lv_event_t * e);
|
||||
|
||||
static void sample_fragment_inc_click(lv_event_t * e);
|
||||
|
||||
@@ -35,7 +35,7 @@ static lv_obj_t * container = NULL;
|
||||
|
||||
void lv_example_fragment_2(void)
|
||||
{
|
||||
lv_obj_t * root = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * root = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_set_layout(root, LV_LAYOUT_GRID);
|
||||
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||
@@ -57,7 +57,7 @@ void lv_example_fragment_2(void)
|
||||
|
||||
lv_fragment_manager_t * manager = lv_fragment_manager_create(NULL);
|
||||
/* Clean up the fragment manager before objects in containers got deleted */
|
||||
lv_obj_add_event(root, sample_container_del, LV_EVENT_DELETE, manager);
|
||||
lv_obj_add_event(root, sample_container_delete, LV_EVENT_DELETE, manager);
|
||||
|
||||
int depth = 0;
|
||||
lv_fragment_t * fragment = lv_fragment_create(&sample_cls, &depth);
|
||||
@@ -111,10 +111,10 @@ static void sample_pop_click(lv_event_t * e)
|
||||
lv_fragment_manager_pop(manager);
|
||||
}
|
||||
|
||||
static void sample_container_del(lv_event_t * e)
|
||||
static void sample_container_delete(lv_event_t * e)
|
||||
{
|
||||
lv_fragment_manager_t * manager = (lv_fragment_manager_t *) lv_event_get_user_data(e);
|
||||
lv_fragment_manager_del(manager);
|
||||
lv_fragment_manager_delete(manager);
|
||||
}
|
||||
|
||||
static void sample_fragment_inc_click(lv_event_t * e)
|
||||
|
||||
@@ -9,7 +9,7 @@ void lv_example_gridnav_1(void)
|
||||
/*It's assumed that the default group is set and
|
||||
*there is a keyboard indev*/
|
||||
|
||||
lv_obj_t * cont1 = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont1 = lv_obj_create(lv_screen_active());
|
||||
lv_gridnav_add(cont1, LV_GRIDNAV_CTRL_NONE);
|
||||
|
||||
/*Use flex here, but works with grid or manually placed objects as well*/
|
||||
@@ -37,7 +37,7 @@ void lv_example_gridnav_1(void)
|
||||
|
||||
/* Create a second container with rollover grid nav mode.*/
|
||||
|
||||
lv_obj_t * cont2 = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont2 = lv_obj_create(lv_screen_active());
|
||||
lv_gridnav_add(cont2, LV_GRIDNAV_CTRL_ROLLOVER);
|
||||
lv_obj_set_style_bg_color(cont2, lv_palette_lighten(LV_PALETTE_BLUE, 5), LV_STATE_FOCUSED);
|
||||
lv_obj_set_size(cont2, lv_pct(50), lv_pct(100));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# It's assumed that the default group is set and
|
||||
# there is a keyboard indev
|
||||
|
||||
cont1 = lv.obj(lv.scr_act())
|
||||
cont1 = lv.obj(lv.screen_active())
|
||||
lv.gridnav_add(cont1, lv.GRIDNAV_CTRL.NONE)
|
||||
|
||||
# Use flex here, but works with grid or manually placed objects as well
|
||||
@@ -30,7 +30,7 @@ for i in range(10):
|
||||
|
||||
# Create a second container with rollover grid nav mode.
|
||||
|
||||
cont2 = lv.obj(lv.scr_act())
|
||||
cont2 = lv.obj(lv.screen_active())
|
||||
lv.gridnav_add(cont2,lv.GRIDNAV_CTRL.ROLLOVER)
|
||||
cont2.set_style_bg_color(lv.palette_lighten(lv.PALETTE.BLUE, 5), lv.STATE.FOCUSED)
|
||||
cont2.set_size(lv.pct(50), lv.pct(100))
|
||||
|
||||
@@ -9,7 +9,7 @@ void lv_example_gridnav_2(void)
|
||||
/*It's assumed that the default group is set and
|
||||
*there is a keyboard indev*/
|
||||
|
||||
lv_obj_t * list1 = lv_list_create(lv_scr_act());
|
||||
lv_obj_t * list1 = lv_list_create(lv_screen_active());
|
||||
lv_gridnav_add(list1, LV_GRIDNAV_CTRL_NONE);
|
||||
lv_obj_set_size(list1, lv_pct(45), lv_pct(80));
|
||||
lv_obj_align(list1, LV_ALIGN_LEFT_MID, 5, 0);
|
||||
@@ -26,7 +26,7 @@ void lv_example_gridnav_2(void)
|
||||
lv_group_remove_obj(item); /*Not needed, we use the gridnav instead*/
|
||||
}
|
||||
|
||||
lv_obj_t * list2 = lv_list_create(lv_scr_act());
|
||||
lv_obj_t * list2 = lv_list_create(lv_screen_active());
|
||||
lv_gridnav_add(list2, LV_GRIDNAV_CTRL_ROLLOVER);
|
||||
lv_obj_set_size(list2, lv_pct(45), lv_pct(80));
|
||||
lv_obj_align(list2, LV_ALIGN_RIGHT_MID, -5, 0);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# It's assumed that the default group is set and
|
||||
# there is a keyboard indev
|
||||
|
||||
list1 = lv.list(lv.scr_act())
|
||||
list1 = lv.list(lv.screen_active())
|
||||
lv.gridnav_add(list1, lv.GRIDNAV_CTRL.NONE)
|
||||
list1.set_size(lv.pct(45), lv.pct(80))
|
||||
list1.align(lv.ALIGN.LEFT_MID, 5, 0)
|
||||
@@ -17,7 +17,7 @@ for i in range(15):
|
||||
item.set_style_bg_opa(0, 0)
|
||||
lv.group_remove_obj(item) # Not needed, we use the gridnav instead
|
||||
|
||||
list2 = lv.list(lv.scr_act())
|
||||
list2 = lv.list(lv.screen_active())
|
||||
lv.gridnav_add(list2, lv.GRIDNAV_CTRL.ROLLOVER)
|
||||
list2.set_size(lv.pct(45), lv.pct(80))
|
||||
list2.align(lv.ALIGN.RIGHT_MID, -5, 0)
|
||||
|
||||
@@ -22,7 +22,7 @@ void lv_example_gridnav_3(void)
|
||||
/*It's assumed that the default group is set and
|
||||
*there is a keyboard indev*/
|
||||
|
||||
lv_obj_t * cont_main = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * cont_main = lv_obj_create(lv_screen_active());
|
||||
lv_gridnav_add(cont_main, LV_GRIDNAV_CTRL_ROLLOVER | LV_GRIDNAV_CTRL_SCROLL_FIRST);
|
||||
|
||||
/*Only the container needs to be in a group*/
|
||||
|
||||
@@ -13,7 +13,7 @@ def cont_sub_event_cb(e):
|
||||
# It's assumed that the default group is set and
|
||||
# there is a keyboard indev*/
|
||||
|
||||
cont_main = lv.obj(lv.scr_act())
|
||||
cont_main = lv.obj(lv.screen_active())
|
||||
lv.gridnav_add(cont_main,lv.GRIDNAV_CTRL.ROLLOVER | lv.GRIDNAV_CTRL.SCROLL_FIRST)
|
||||
|
||||
# Only the container needs to be in a group
|
||||
|
||||
@@ -17,7 +17,7 @@ void lv_example_gridnav_4(void)
|
||||
/*It's assumed that the default group is set and
|
||||
*there is a keyboard indev*/
|
||||
|
||||
lv_obj_t * list = lv_list_create(lv_scr_act());
|
||||
lv_obj_t * list = lv_list_create(lv_screen_active());
|
||||
lv_gridnav_add(list, LV_GRIDNAV_CTRL_ROLLOVER);
|
||||
lv_obj_align(list, LV_ALIGN_LEFT_MID, 10, 0);
|
||||
lv_group_add_obj(lv_group_get_default(), list);
|
||||
@@ -38,7 +38,7 @@ void lv_example_gridnav_4(void)
|
||||
lv_group_remove_obj(item); /*The default group adds it automatically*/
|
||||
}
|
||||
|
||||
lv_obj_t * btn = lv_button_create(lv_scr_act());
|
||||
lv_obj_t * btn = lv_button_create(lv_screen_active());
|
||||
lv_obj_align(btn, LV_ALIGN_RIGHT_MID, -10, 0);
|
||||
lv_obj_t * label = lv_label_create(btn);
|
||||
lv_label_set_text(label, "Button");
|
||||
|
||||
@@ -10,7 +10,7 @@ def event_handler(e):
|
||||
# It's assumed that the default group is set and
|
||||
# there is a keyboard indev
|
||||
|
||||
list = lv.list(lv.scr_act())
|
||||
list = lv.list(lv.screen_active())
|
||||
lv.gridnav_add(list, lv.GRIDNAV_CTRL.ROLLOVER)
|
||||
list.align(lv.ALIGN.LEFT_MID, 0, 10)
|
||||
lv.group_get_default().add_obj(list)
|
||||
@@ -29,7 +29,7 @@ for i in range(20):
|
||||
item.add_event(event_handler, lv.EVENT.CLICKED, None)
|
||||
lv.group_remove_obj(item) # The default group adds it automatically
|
||||
|
||||
button = lv.button(lv.scr_act())
|
||||
button = lv.button(lv.screen_active())
|
||||
button.align(lv.ALIGN.RIGHT_MID, 0, -10)
|
||||
label = lv.label(button)
|
||||
label.set_text("Button")
|
||||
|
||||
@@ -10,30 +10,30 @@ static void ta_event_cb(lv_event_t * e)
|
||||
if(code == LV_EVENT_FOCUSED) {
|
||||
if(lv_indev_get_type(lv_indev_get_act()) != LV_INDEV_TYPE_KEYPAD) {
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
else if(code == LV_EVENT_CANCEL) {
|
||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_state(ta, LV_STATE_FOCUSED);
|
||||
lv_obj_remove_state(ta, LV_STATE_FOCUSED);
|
||||
lv_indev_reset(NULL, ta); /*To forget the last clicked object to make it focusable again*/
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_ime_pinyin_1(void)
|
||||
{
|
||||
lv_obj_t * pinyin_ime = lv_ime_pinyin_create(lv_scr_act());
|
||||
lv_obj_t * pinyin_ime = lv_ime_pinyin_create(lv_screen_active());
|
||||
lv_obj_set_style_text_font(pinyin_ime, &lv_font_simsun_16_cjk, 0);
|
||||
//lv_ime_pinyin_set_dict(pinyin_ime, your_dict); // Use a custom dictionary. If it is not set, the built-in dictionary will be used.
|
||||
|
||||
/* ta1 */
|
||||
lv_obj_t * ta1 = lv_textarea_create(lv_scr_act());
|
||||
lv_obj_t * ta1 = lv_textarea_create(lv_screen_active());
|
||||
lv_textarea_set_one_line(ta1, true);
|
||||
lv_obj_set_style_text_font(ta1, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_align(ta1, LV_ALIGN_TOP_LEFT, 0, 0);
|
||||
|
||||
/*Create a keyboard and add it to ime_pinyin*/
|
||||
lv_obj_t * kb = lv_keyboard_create(lv_scr_act());
|
||||
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
|
||||
lv_ime_pinyin_set_keyboard(pinyin_ime, kb);
|
||||
lv_keyboard_set_textarea(kb, ta1);
|
||||
|
||||
@@ -45,7 +45,7 @@ void lv_example_ime_pinyin_1(void)
|
||||
lv_obj_align_to(cand_panel, kb, LV_ALIGN_OUT_TOP_MID, 0, 0);
|
||||
|
||||
/*Try using ime_pinyin to output the Chinese below in the ta1 above*/
|
||||
lv_obj_t * cz_label = lv_label_create(lv_scr_act());
|
||||
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(cz_label,
|
||||
"嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
|
||||
|
||||
@@ -7,10 +7,10 @@ def ta_event_cb(e,kb):
|
||||
if code == lv.EVENT.FOCUSED:
|
||||
if lv.indev_get_act() != None and lv.indev_get_act().get_type() != lv.INDEV_TYPE.KEYPAD :
|
||||
kb.set_textarea(ta)
|
||||
kb.clear_flag(lv.obj.FLAG.HIDDEN)
|
||||
kb.remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
elif code == lv.EVENT.CANCEL:
|
||||
kb.add_flag(lv.obj.FLAG.HIDDEN)
|
||||
ta.clear_state(ta, LV_STATE_FOCUSED);
|
||||
ta.remove_state(ta, LV_STATE_FOCUSED);
|
||||
lv.indev_reset(None, ta) # To forget the last clicked object to make it focusable again
|
||||
|
||||
fs_drv = lv.fs_drv_t()
|
||||
@@ -19,18 +19,18 @@ font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt
|
||||
if font_simsun_16_cjk == None:
|
||||
print("Error when loading chinese font")
|
||||
|
||||
pinyin_ime = lv.ime_pinyin(lv.scr_act())
|
||||
pinyin_ime = lv.ime_pinyin(lv.screen_active())
|
||||
pinyin_ime.set_style_text_font(font_simsun_16_cjk, 0)
|
||||
# pinyin_ime.pinyin_set_dict(your_dict) # Use a custom dictionary. If it is not set, the built-in dictionary will be used.
|
||||
|
||||
# ta1
|
||||
ta1 = lv.textarea(lv.scr_act())
|
||||
ta1 = lv.textarea(lv.screen_active())
|
||||
ta1.set_one_line(True)
|
||||
ta1.set_style_text_font(font_simsun_16_cjk, 0)
|
||||
ta1.align(lv.ALIGN.TOP_LEFT, 0, 0)
|
||||
|
||||
# Create a keyboard and add it to ime_pinyin
|
||||
kb = lv.keyboard(lv.scr_act())
|
||||
kb = lv.keyboard(lv.screen_active())
|
||||
pinyin_ime.pinyin_set_keyboard(kb)
|
||||
kb.set_textarea(ta1)
|
||||
|
||||
@@ -42,7 +42,7 @@ cand_panel.set_size(lv.pct(100), lv.pct(10))
|
||||
cand_panel.align_to(kb, lv.ALIGN.OUT_TOP_MID, 0, 0)
|
||||
|
||||
# Try using ime_pinyin to output the Chinese below in the ta1 above
|
||||
cz_label = lv.label(lv.scr_act())
|
||||
cz_label = lv.label(lv.screen_active())
|
||||
cz_label.set_text("嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
|
||||
cz_label.set_style_text_font(font_simsun_16_cjk, 0)
|
||||
cz_label.set_width(310)
|
||||
|
||||
@@ -10,30 +10,30 @@ static void ta_event_cb(lv_event_t * e)
|
||||
if(code == LV_EVENT_FOCUSED) {
|
||||
if(lv_indev_get_type(lv_indev_get_act()) != LV_INDEV_TYPE_KEYPAD) {
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
else if(code == LV_EVENT_READY) {
|
||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_state(ta, LV_STATE_FOCUSED);
|
||||
lv_obj_remove_state(ta, LV_STATE_FOCUSED);
|
||||
lv_indev_reset(NULL, ta); /*To forget the last clicked object to make it focusable again*/
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_ime_pinyin_2(void)
|
||||
{
|
||||
lv_obj_t * pinyin_ime = lv_ime_pinyin_create(lv_scr_act());
|
||||
lv_obj_t * pinyin_ime = lv_ime_pinyin_create(lv_screen_active());
|
||||
lv_obj_set_style_text_font(pinyin_ime, &lv_font_simsun_16_cjk, 0);
|
||||
//lv_ime_pinyin_set_dict(pinyin_ime, your_dict); // Use a custom dictionary. If it is not set, the built-in dictionary will be used.
|
||||
|
||||
/* ta1 */
|
||||
lv_obj_t * ta1 = lv_textarea_create(lv_scr_act());
|
||||
lv_obj_t * ta1 = lv_textarea_create(lv_screen_active());
|
||||
lv_textarea_set_one_line(ta1, true);
|
||||
lv_obj_set_style_text_font(ta1, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_align(ta1, LV_ALIGN_TOP_LEFT, 0, 0);
|
||||
|
||||
/*Create a keyboard and add it to ime_pinyin*/
|
||||
lv_obj_t * kb = lv_keyboard_create(lv_scr_act());
|
||||
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
|
||||
lv_keyboard_set_textarea(kb, ta1);
|
||||
|
||||
lv_ime_pinyin_set_keyboard(pinyin_ime, kb);
|
||||
@@ -47,7 +47,7 @@ void lv_example_ime_pinyin_2(void)
|
||||
lv_obj_align_to(cand_panel, kb, LV_ALIGN_OUT_TOP_MID, 0, 0);
|
||||
|
||||
/*Try using ime_pinyin to output the Chinese below in the ta1 above*/
|
||||
lv_obj_t * cz_label = lv_label_create(lv_scr_act());
|
||||
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(cz_label,
|
||||
"嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
|
||||
|
||||
@@ -7,10 +7,10 @@ def ta_event_cb(e,kb):
|
||||
if code == lv.EVENT.FOCUSED:
|
||||
if lv.indev_get_act() != None and lv.indev_get_act().get_type() != lv.INDEV_TYPE.KEYPAD :
|
||||
kb.set_textarea(ta)
|
||||
kb.clear_flag(lv.obj.FLAG.HIDDEN)
|
||||
kb.remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
elif code == lv.EVENT.READY:
|
||||
kb.add_flag(lv.obj.FLAG.HIDDEN)
|
||||
ta.clear_state(ta, LV_STATE_FOCUSED);
|
||||
ta.remove_state(ta, LV_STATE_FOCUSED);
|
||||
lv.indev_reset(None, ta) # To forget the last clicked object to make it focusable again
|
||||
|
||||
fs_drv = lv.fs_drv_t()
|
||||
@@ -19,18 +19,18 @@ font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt
|
||||
if font_simsun_16_cjk == None:
|
||||
print("Error when loading chinese font")
|
||||
|
||||
pinyin_ime = lv.ime_pinyin(lv.scr_act())
|
||||
pinyin_ime = lv.ime_pinyin(lv.screen_active())
|
||||
pinyin_ime.set_style_text_font(font_simsun_16_cjk, 0)
|
||||
# pinyin_ime.pinyin_set_dict(your_dict) # Use a custom dictionary. If it is not set, the built-in dictionary will be used.
|
||||
|
||||
# ta1
|
||||
ta1 = lv.textarea(lv.scr_act())
|
||||
ta1 = lv.textarea(lv.screen_active())
|
||||
ta1.set_one_line(True)
|
||||
ta1.set_style_text_font(font_simsun_16_cjk, 0)
|
||||
ta1.align(lv.ALIGN.TOP_LEFT, 0, 0)
|
||||
|
||||
# Create a keyboard and add it to ime_pinyin
|
||||
kb = lv.keyboard(lv.scr_act())
|
||||
kb = lv.keyboard(lv.screen_active())
|
||||
kb.set_textarea(ta1)
|
||||
|
||||
pinyin_ime.pinyin_set_keyboard(kb)
|
||||
@@ -44,7 +44,7 @@ cand_panel.set_size(lv.pct(100), lv.pct(10))
|
||||
cand_panel.align_to(kb, lv.ALIGN.OUT_TOP_MID, 0, 0)
|
||||
|
||||
# Try using ime_pinyin to output the Chinese below in the ta1 above
|
||||
cz_label = lv.label(lv.scr_act())
|
||||
cz_label = lv.label(lv.screen_active())
|
||||
cz_label.set_text("嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
|
||||
cz_label.set_style_text_font(font_simsun_16_cjk, 0)
|
||||
cz_label.set_width(310)
|
||||
|
||||
@@ -43,7 +43,7 @@ void lv_example_imgfont_1(void)
|
||||
|
||||
imgfont->fallback = LV_FONT_DEFAULT;
|
||||
|
||||
lv_obj_t * label1 = lv_label_create(lv_scr_act());
|
||||
lv_obj_t * label1 = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label1, "12\uF600\uF617AB");
|
||||
lv_obj_set_style_text_font(label1, imgfont, LV_PART_MAIN);
|
||||
lv_obj_center(label1);
|
||||
@@ -52,7 +52,7 @@ void lv_example_imgfont_1(void)
|
||||
|
||||
void lv_example_imgfont_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, "imgfont is not installed");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ void lv_example_observer_1(void)
|
||||
lv_subject_init_int(&temperature_subject, 28);
|
||||
|
||||
/*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_center(slider);
|
||||
lv_slider_bind_value(slider, &temperature_subject);
|
||||
|
||||
/*Create a label below the slider*/
|
||||
lv_obj_t * label = lv_label_create(lv_scr_act());
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_obj_align(label, LV_ALIGN_CENTER, 0, 30);
|
||||
lv_label_bind_text(label, &temperature_subject, "%d °C");
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user