Skip to content

Commit cc2d470

Browse files
Merge pull request #13 from Mark19000/main
TopMenu Fix
2 parents ede5675 + 02a35e6 commit cc2d470

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

.DS_Store

8 KB
Binary file not shown.

internal_filesystem/lib/mpos/ui/gesture_navigation.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from lvgl import LvReferenceError
33
from .anim import smooth_show, smooth_hide
44
from .view import back_screen
5-
from .topmenu import open_drawer, drawer_open, NOTIFICATION_BAR_HEIGHT
5+
from mpos.ui import topmenu as topmenu
6+
#from .topmenu import open_drawer, drawer_open, NOTIFICATION_BAR_HEIGHT
67
from .display import get_display_width, get_display_height
78

89
downbutton = None
@@ -31,10 +32,6 @@ def _passthrough_click(x, y, indev):
3132
print(f"Object to click is gone: {e}")
3233

3334
def _back_swipe_cb(event):
34-
if drawer_open:
35-
print("ignoring back gesture because drawer is open")
36-
return
37-
3835
global backbutton, back_start_y, back_start_x, backbutton_visible
3936
event_code = event.get_code()
4037
indev = lv.indev_active()
@@ -61,13 +58,16 @@ def _back_swipe_cb(event):
6158
backbutton_visible = False
6259
smooth_hide(backbutton)
6360
if x > get_display_width() / 5:
64-
back_screen()
61+
if topmenu.drawer_open :
62+
topmenu.close_drawer()
63+
else :
64+
back_screen()
6565
elif is_short_movement(dx, dy):
6666
# print("Short movement - treating as tap")
6767
_passthrough_click(x, y, indev)
6868

6969
def _top_swipe_cb(event):
70-
if drawer_open:
70+
if topmenu.drawer_open:
7171
print("ignoring top swipe gesture because drawer is open")
7272
return
7373

@@ -99,18 +99,18 @@ def _top_swipe_cb(event):
9999
dx = abs(x - down_start_x)
100100
dy = abs(y - down_start_y)
101101
if y > get_display_height() / 5:
102-
open_drawer()
102+
topmenu.open_drawer()
103103
elif is_short_movement(dx, dy):
104104
# print("Short movement - treating as tap")
105105
_passthrough_click(x, y, indev)
106106

107107
def handle_back_swipe():
108108
global backbutton
109109
rect = lv.obj(lv.layer_top())
110-
rect.set_size(NOTIFICATION_BAR_HEIGHT, lv.layer_top().get_height()-NOTIFICATION_BAR_HEIGHT) # narrow because it overlaps buttons
110+
rect.set_size(topmenu.NOTIFICATION_BAR_HEIGHT, lv.layer_top().get_height()-topmenu.NOTIFICATION_BAR_HEIGHT) # narrow because it overlaps buttons
111111
rect.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
112112
rect.set_scroll_dir(lv.DIR.NONE)
113-
rect.set_pos(0, NOTIFICATION_BAR_HEIGHT)
113+
rect.set_pos(0, topmenu.NOTIFICATION_BAR_HEIGHT)
114114
style = lv.style_t()
115115
style.init()
116116
style.set_bg_opa(lv.OPA.TRANSP)
@@ -138,7 +138,7 @@ def handle_back_swipe():
138138
def handle_top_swipe():
139139
global downbutton
140140
rect = lv.obj(lv.layer_top())
141-
rect.set_size(lv.pct(100), NOTIFICATION_BAR_HEIGHT)
141+
rect.set_size(lv.pct(100), topmenu.NOTIFICATION_BAR_HEIGHT)
142142
rect.set_pos(0, 0)
143143
rect.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
144144
style = lv.style_t()

0 commit comments

Comments
 (0)