#!/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()