-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
82 lines (70 loc) · 2.14 KB
/
main.py
File metadata and controls
82 lines (70 loc) · 2.14 KB
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
import time
from core.screen import Screen
from core.slider import Slider, Slide
from core.plugins.retroclock import RetroClock
from core.plugins.randomremoteicon import RandomRemoteIcon
from core.plugins.snake import Snake
from core.plugins.matrix import Matrix
from core.plugins.rainbow import Rainbow
from core.plugins.nyancat import NyanCat
screen = Screen()
screen.clear()
screen.drawText(" starting... ", (0, 0, 0), (255, 255, 255), True)
screen.showBuffer()
time.sleep(3)
screen.clear()
import random
while True:
screen.addPlugin(RandomRemoteIcon(screen=screen, firstColumn=0))
screen.addPlugin(RetroClock(screen=screen, firstColumn=16))
screen.runPlugins()
running = True
while running:
for plugin in screen.plugin_threads:
if isinstance(plugin, RandomRemoteIcon):
if plugin.running:
time.sleep(1)
running = True
else:
running = False
screen.stopPlugins()
screen.cleanPlugins()
time.sleep(1)
# now get a random int to select one plugin
element = random.randint(0, 3)
if element == 0:
screen.addPlugin(Rainbow(screen))
screen.runPlugins()
time.sleep(10)
screen.stopPlugins()
screen.cleanPlugins()
time.sleep(1)
elif element == 1:
screen.addPlugin(Matrix(screen))
screen.runPlugins()
time.sleep(10)
screen.stopPlugins()
screen.cleanPlugins()
time.sleep(1)
elif element == 2:
screen.addPlugin(NyanCat(screen))
screen.runPlugins()
time.sleep(10)
screen.stopPlugins()
screen.cleanPlugins()
time.sleep(1)
elif element == 3:
screen.addPlugin(Snake(screen))
screen.runPlugins()
time.sleep(1) #running
running = True
while running:
for plugin in screen.plugin_threads:
if plugin.running:
time.sleep(1)
running = True
else:
running = False
screen.stopPlugins()
screen.cleanPlugins()
screen.clear()