You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Simple non-animated works!
This commit is contained in:
+4
-22
@@ -341,10 +341,10 @@ def handle_gesture(pin):
|
||||
y_l=indev._rx_buf[0]
|
||||
y=((y_h&0x0F)<<8)|y_l
|
||||
print(f"GestureID={gesture_id},FingerNum={finger_num},X={x},Y={y}")
|
||||
if gesture_id==0x01:
|
||||
if gesture_id==0x04:
|
||||
print("Swipe Up Detected")
|
||||
close_drawer()
|
||||
elif gesture_id==0x02:
|
||||
elif gesture_id==0x03:
|
||||
print("Swipe Down Detected")
|
||||
open_drawer()
|
||||
|
||||
@@ -415,35 +415,17 @@ def add_later():
|
||||
drawer_open=False
|
||||
settings_btn.add_event_cb(settings_event,lv.EVENT.CLICKED,None)
|
||||
|
||||
|
||||
def open_drawer():
|
||||
global drawer_open
|
||||
if not drawer_open:
|
||||
print('opening')
|
||||
a=lv.anim_t()
|
||||
a.init()
|
||||
a.set_var(drawer)
|
||||
a.set_values(-TFT_VER_RES+NOTIFICATION_BAR_HEIGHT,NOTIFICATION_BAR_HEIGHT)
|
||||
a.set_time(DRAWER_ANIM_DURATION)
|
||||
#a.set_path_cb(lv.anim_path_ease_in_out)
|
||||
a.set_exec_cb(lambda a,value:drawer.set_y(value))
|
||||
a.start()
|
||||
drawer.set_y(NOTIFICATION_BAR_HEIGHT)
|
||||
drawer_open=True
|
||||
|
||||
|
||||
def close_drawer():
|
||||
global drawer_open
|
||||
if drawer_open:
|
||||
print('closing')
|
||||
#a=lv.anim_t()
|
||||
#a.init()
|
||||
#a.set_var(drawer)
|
||||
#a.set_values(NOTIFICATION_BAR_HEIGHT,-TFT_VER_RES+NOTIFICATION_BAR_HEIGHT)
|
||||
#a.set_time(DRAWER_ANIM_DURATION)
|
||||
#a.set_path_cb(lv.anim_path_ease_in_out)
|
||||
#a.set_exec_cb(lambda a,value:drawer.set_y(value))
|
||||
#a.set_completed_cb(lambda a:drawer.set_y(-TFT_VER_RES+NOTIFICATION_BAR_HEIGHT))
|
||||
#a.start()
|
||||
drawer.set_y(-TFT_VER_RES+NOTIFICATION_BAR_HEIGHT)
|
||||
drawer_open=False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user