-
Notifications
You must be signed in to change notification settings - Fork 18
/
app_cube.py
131 lines (115 loc) · 3.05 KB
/
app_cube.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# This file is part of MaixUI
# Copyright (c) sipeed.com
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
import time, gc, math
try:
from core import agent, system
from dialog import draw_dialog_alpha
from ui_canvas import ui, print_mem_free
from ui_container import container
from ui_3d_launcher import launcher
from wdt import protect
from button import sipeed_button, button_io
except ImportError as e:
sys.print_exception(e)
print(e)
from lib.core import agent, system
from lib.dialog import draw_dialog_alpha
from ui.ui_canvas import ui, print_mem_free
from ui.ui_container import container
from ui.ui_3d_launcher import launcher
from driver.wdt import protect
from driver.button import sipeed_button, button_io
class launcher:
def load():
self = __class__
self.h, self.w = 0, 0
self.value = 0
self.ctrl = agent()
self.ctrl.event(10, self.draw)
def test_once(self):
container.latest()
self.remove(test_once)
self.ctrl.event(5000, test_once)
button_io.config(10, 11, 16)
def free():
self = __class__
self.ctrl = None
@ui.warp_template(ui.blank_draw)
@ui.warp_template(ui.grey_draw)
#@ui.warp_template(ui.bg_in_draw)
#@ui.warp_template(ui.anime_in_draw)
@ui.warp_template(launcher.draw)
#@ui.warp_template(taskbar.time_draw)
#@ui.warp_template(taskbar.mem_draw)
#@catch # need sipeed_button
def draw():
ui.display()
def event():
self = __class__
if self.h < 240:
self.h += 20
if self.w < 240:
self.w += 10
ui.height, ui.weight = self.h, self.w
self.ctrl.parallel_cycle()
class loading:
def load():
self = __class__
self.h, self.w = 0, 0
self.ctrl = agent()
self.ctrl.event(5, self.draw)
def into_launcher(self):
container.reload(launcher)
self.remove(into_launcher)
self.ctrl.event(2000, into_launcher)
#loading.draw()
def free():
self = __class__
self.ctrl = None
ui.height, ui.weight = 240, 240
@ui.warp_template(ui.blank_draw)
@ui.warp_template(ui.bg_in_draw)
@ui.warp_template(ui.help_in_draw)
def draw():
ui.display()
def event():
self = __class__
if self.h < 240:
self.h += 10
if self.w < 240:
self.w += 10
ui.height, ui.weight = self.h, self.w
self.ctrl.parallel_cycle()
if __name__ == "__main__":
system = agent()
container.reload(loading)
last = time.ticks_ms()
while True:
while True:
last = time.ticks_ms() - 1
while True:
try:
#time.sleep(0.1)
#print(1000 // (time.ticks_ms() - last), 'fps')
last = time.ticks_ms()
gc.collect()
container.forever()
system.parallel_cycle()
protect.keep()
#gc.collect()
#print_mem_free()
except KeyboardInterrupt:
protect.stop()
raise KeyboardInterrupt
#except Exception as e:
#gc.collect()
#print(e)
finally:
try:
ui.display()
except:
pass