|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
from micropython import const # NOQA
|
|
|
|
|
import display_driver_framework
|
|
|
|
|
# from font import get_font
|
|
|
|
|
|
|
|
|
|
# inter_font_20 = get_font("inter_20.bin")
|
|
|
|
|
|
|
|
|
|
_WIDTH = const(480)
|
|
|
|
|
_HEIGHT = const(320)
|
|
|
|
@ -47,7 +50,7 @@ tab_buttons = tabview.get_tab_bar()
|
|
|
|
|
tab_buttons.set_style_text_color(lv.color_hex(0xFFFFFF), 0)
|
|
|
|
|
#f58700 dark orange
|
|
|
|
|
tab_buttons.set_style_border_side(lv.BORDER_SIDE.RIGHT, lv.PART.ITEMS | lv.STATE.CHECKED)
|
|
|
|
|
tab_buttons.set_style_text_font(lv.font_montserrat_16,0)
|
|
|
|
|
tab_buttons.set_style_text_font(lv.font_montserrat_20,0)
|
|
|
|
|
home_tab = tabview.add_tab(lv.SYMBOL.HOME)
|
|
|
|
|
target_tab = tabview.add_tab(lv.SYMBOL.LIST)
|
|
|
|
|
settings_tab = tabview.add_tab(lv.SYMBOL.SETTINGS)
|
|
|
|
@ -59,7 +62,7 @@ btn.align(lv.ALIGN.CENTER, 0, 0)
|
|
|
|
|
btn.set_size(150, 100)
|
|
|
|
|
btn_label = lv.label(btn)
|
|
|
|
|
btn_label.align(lv.ALIGN.CENTER, 0, 0)
|
|
|
|
|
btn_label.set_style_text_font(lv.font_montserrat_14, 0)
|
|
|
|
|
btn_label.set_style_text_font(lv.font_montserrat_20, 0)
|
|
|
|
|
btn_label.set_style_text_align(lv.STATE.DEFAULT, lv.TEXT_ALIGN.CENTER)
|
|
|
|
|
btn_label.set_text("Button")
|
|
|
|
|
g_btn_count = 0
|
|
|
|
@ -73,53 +76,3 @@ def btn_event_cb(e: lv.event_t):
|
|
|
|
|
label.set_text(f"Button: {g_btn_count}")
|
|
|
|
|
|
|
|
|
|
btn.add_event_cb(btn_event_cb, lv.EVENT.ALL, None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# lv_obj_set_style_border_side(tab_buttons, LV_BORDER_SIDE_RIGHT, LV_PART_ITEMS | LV_STATE_CHECKED);
|
|
|
|
|
|
|
|
|
|
# /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/
|
|
|
|
|
# lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
|
|
|
|
|
# lv_obj_t * tab2 = lv_tabview_add_tab(tabview, "Tab 2");
|
|
|
|
|
# lv_obj_t * tab3 = lv_tabview_add_tab(tabview, "Tab 3");
|
|
|
|
|
# lv_obj_t * tab4 = lv_tabview_add_tab(tabview, "Tab 4");
|
|
|
|
|
# lv_obj_t * tab5 = lv_tabview_add_tab(tabview, "Tab 5");
|
|
|
|
|
|
|
|
|
|
# lv_obj_set_style_bg_color(tab2, lv_palette_lighten(LV_PALETTE_AMBER, 3), 0);
|
|
|
|
|
# lv_obj_set_style_bg_opa(tab2, LV_OPA_COVER, 0);
|
|
|
|
|
|
|
|
|
|
# /*Add content to the tabs*/
|
|
|
|
|
# lv_obj_t * label = lv_label_create(tab1);
|
|
|
|
|
# lv_label_set_text(label, "First tab");
|
|
|
|
|
|
|
|
|
|
# label = lv_label_create(tab2);
|
|
|
|
|
# lv_label_set_text(label, "Second tab");
|
|
|
|
|
|
|
|
|
|
# label = lv_label_create(tab3);
|
|
|
|
|
# lv_label_set_text(label, "Third tab");
|
|
|
|
|
|
|
|
|
|
# label = lv_label_create(tab4);
|
|
|
|
|
# lv_label_set_text(label, "Forth tab");
|
|
|
|
|
|
|
|
|
|
# label = lv_label_create(tab5);
|
|
|
|
|
# lv_label_set_text(label, "Fifth tab");
|
|
|
|
|
|
|
|
|
|
# lv_obj_remove_flag(lv_tabview_get_content(tabview), LV_OBJ_FLAG_SCROLLABLE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# # Button
|
|
|
|
|
# btn = lv.button(scrn)
|
|
|
|
|
# btn.set_pos(10, 10)
|
|
|
|
|
# btn.set_size(120, 50)
|
|
|
|
|
# btn_label = lv.label(btn)
|
|
|
|
|
# btn_label.set_text("Button")
|
|
|
|
|
# g_btn_count = 0
|
|
|
|
|
|
|
|
|
|
# def btn_event_cb(e: lv.event_t):
|
|
|
|
|
# btn = e.get_target_obj()
|
|
|
|
|
# label = btn.get_child(0)
|
|
|
|
|
# if e.get_code() == lv.EVENT.CLICKED:
|
|
|
|
|
# global g_btn_count
|
|
|
|
|
# g_btn_count += 1
|
|
|
|
|
# label.set_text(f"Button: {g_btn_count}")
|
|
|
|
|
|
|
|
|
|
# btn.add_event_cb(btn_event_cb, lv.EVENT.ALL, None)
|
|
|
|
|