blob: c5f832d5ca73504fa13ad9637c7527a903c402b0 (
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
46
47
|
#!/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 = BRIDGE_WIDTH
HEIGHT = BRIDGE_HEIGHT
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():
"""Just for testing. Use ShowRunner when running the show for real."""
import Queue
bridge = Bridge()
show = FishShow(bridge, send_queue=Queue.Queue(), recv_queue=Queue.Queue())
#show = SunriseShow(bridge)
show.run(framerate=FRAME_RATE)
if __name__ == '__main__':
main()
|