forked from MicroPythonOS/MicroPythonOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.py
More file actions
31 lines (26 loc) · 739 Bytes
/
util.py
File metadata and controls
31 lines (26 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# lib/mpos/ui/util.py
import lvgl as lv
import sys
_foreground_app_name = None
def set_foreground_app(name):
global _foreground_app_name
_foreground_app_name = name
print(f"Foreground app: {name}")
def get_foreground_app():
global _foreground_app_name
return _foreground_app_name
def shutdown():
print("Shutting down...")
lv.deinit()
sys.exit(0)
def close_top_layer_msgboxes():
top = lv.layer_top()
if not top:
return
i = 0
while i < top.get_child_count_by_type(lv.msgbox_backdrop_class):
child = top.get_child_by_type(i, lv.msgbox_backdrop_class)
msgbox = child.get_child_by_type(0, lv.msgbox_class)
if msgbox:
msgbox.close()
i += 1