-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrun.py
65 lines (48 loc) · 1.57 KB
/
run.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
import threading
import Menu_Page_Router
from GPIO_Init import checkKeyInterrupt
from OP_1_Connection import autoMountUnmontThread
from file_util import createImportantFolders
__author__ = "Hsuan Han Lai (Edward Lai)"
__date__ = "2019-04-02"
workDir = os.path.dirname(os.path.realpath(__file__))
def start():
# create important missing folders
createImportantFolders()
threading.Thread(target=autoMountUnmontThread).start()
currentCursor = 1
# Initialize Menu System
pg = Menu_Page_Router.PageRouter()
# Start First Page
pg.renderPage(0, currentCursor)
while 1:
key = checkKeyInterrupt()
if key == "UP":
if currentCursor - 1 >= 1:
currentCursor -= 1
pg.renderPage(0, currentCursor)
elif key == "DOWN":
if currentCursor + 1 < pg.getListSize():
currentCursor += 1
pg.renderPage(0, currentCursor)
elif key == "LEFT":
# currentCursor = 1
currentCursor = pg.renderPage(-1, 1)
pg.renderPage(0, currentCursor)
elif key == "RIGHT":
pg.renderPage(1, currentCursor)
currentCursor = 1
elif key == "CENTER":
pg.renderPage(1, currentCursor)
currentCursor = 1
elif key == "B":
pg.renderPage(1, currentCursor)
currentCursor = 1
pass
elif key == "A":
currentCursor = pg.renderPage(-1, 1)
pg.renderPage(0, currentCursor)
pass
if __name__ == "__main__":
start()