blob: 20186110a2994b46a850b55e8c08401ce7ebed83 (
plain) (
blame)
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
|
#!/usr/bin/python2
from fish_show import FishShow
from sunrise import SunriseShow
from constants import *
try:
import lumiversepython
except ImportError:
have_lumiversepython = False
from DummyRig import DummyRig
else:
have_lumiversepython = True
class Bridge(object):
WIDTH = 200
HEIGHT = 2
def __init__(self):
if have_lumiversepython:
self.rig = lumiversepython.Rig('/home/teacher/Lumiverse/PBridge.rig.json')
else:
self.rig = DummyRig(self.WIDTH, self.HEIGHT)
self.rig.init()
self.lights = self.get_lights()
def update(self):
self.rig.updateOnce()
def get_light(self, x, y):
return self.lights[x][y]
def get_lights(self):
return [ [ self.rig.select('$side={y}[$sequence={x}]'.format(y=y, x=x))
for y in ('bot', 'top') ]
for x in xrange(1, self.WIDTH+1)]
def main():
bridge = Bridge()
show = FishShow(bridge)
#show = SunriseShow(bridge)
show.run(framerate=FRAME_RATE)
main()
|