You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Hide bar animation works
This commit is contained in:
@@ -56,6 +56,8 @@ def open_drawer():
|
||||
global drawer_open
|
||||
if not drawer_open:
|
||||
drawer_open=True
|
||||
notification_bar.set_pos(0,0)
|
||||
notification_bar.remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
drawer.remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
|
||||
def close_drawer():
|
||||
@@ -63,6 +65,7 @@ def close_drawer():
|
||||
if drawer_open:
|
||||
drawer_open=False
|
||||
drawer.add_flag(lv.obj.FLAG.HIDDEN)
|
||||
animation.start()
|
||||
|
||||
def toggle_drawer(event):
|
||||
global drawer_open
|
||||
@@ -77,6 +80,7 @@ notification_bar = lv.obj(lv.layer_top())
|
||||
notification_bar.set_style_bg_color(COLOR_NOTIF_BAR_BG, 0)
|
||||
notification_bar.set_size(TFT_HOR_RES, NOTIFICATION_BAR_HEIGHT)
|
||||
notification_bar.set_pos(0, 0)
|
||||
notification_bar.add_flag(lv.obj.FLAG.HIDDEN)
|
||||
notification_bar.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
|
||||
notification_bar.set_scroll_dir(lv.DIR.VER)
|
||||
notification_bar.set_style_border_width(0, 0)
|
||||
@@ -150,6 +154,13 @@ timer3 = lv.timer_create(update_memfree, MEMFREE_UPDATE_INTERVAL, None)
|
||||
timer4 = lv.timer_create(update_wifi_icon, WIFI_ICON_UPDATE_INTERVAL, None)
|
||||
#notification_bar.add_event_cb(toggle_drawer, lv.EVENT.CLICKED, None)
|
||||
|
||||
# hide bar animation
|
||||
animation = lv.anim_t()
|
||||
animation.init()
|
||||
animation.set_var(notification_bar)
|
||||
animation.set_values(0, -NOTIFICATION_BAR_HEIGHT)
|
||||
animation.set_time(2000)
|
||||
animation.set_custom_exec_cb(lambda not_used, value : notification_bar.set_y(value))
|
||||
|
||||
|
||||
drawer=lv.obj(lv.layer_top())
|
||||
@@ -346,7 +357,10 @@ def start_app(app_dir, is_launcher=False):
|
||||
app_name, start_script = parse_manifest(manifest_path)
|
||||
start_script_fullpath = f"{app_dir}/{start_script}"
|
||||
execute_script_new_thread(start_script_fullpath, True, is_launcher, True)
|
||||
|
||||
# Show notification bar, then start animation to hide it
|
||||
notification_bar.set_pos(0,0)
|
||||
notification_bar.remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
animation.start()
|
||||
|
||||
def restart_launcher():
|
||||
# The launcher might have been updated from the builtin one, so check that:
|
||||
|
||||
Reference in New Issue
Block a user