aboutsummaryrefslogtreecommitdiff
path: root/pixelcore/PixelStrip.py
diff options
context:
space:
mode:
Diffstat (limited to 'pixelcore/PixelStrip.py')
-rw-r--r--pixelcore/PixelStrip.py24
1 files changed, 4 insertions, 20 deletions
diff --git a/pixelcore/PixelStrip.py b/pixelcore/PixelStrip.py
index 647991d..29d3b31 100644
--- a/pixelcore/PixelStrip.py
+++ b/pixelcore/PixelStrip.py
@@ -4,33 +4,17 @@ import util.Geo as Geo
from pixelevents.StepEvent import *
import math
import pdb
-#Python class representing a single Pixel strip (usually 50 Pixels)
class PixelStrip:
+ """Python class representing a single Pixel strip (usually 50 Pixels)"""
+
def __init__(self, layoutEngine):
self.initStrip(layoutEngine)
self.argDict = layoutEngine.getStripArgs()
+
def initStrip(self, layoutEngine):
pixelLocations = layoutEngine.getPixelLocations()
self.pixels = [Pixel(l) for l in pixelLocations]
+
def __iter__(self):
return self.pixels.__iter__()
- def allOn(self, time):
- [l.turnOnFor(time) for l in self.pixels] #TODO: add test-on method to
- #pixels
- def respond(self, responseInfo):
- location = responseInfo[Strings.LOCATION]
- if not 'PixelEvent' in responseInfo:
- if 'Color' in responseInfo:
- color = responseInfo['Color']
- else:
- raise Exception('Need Color. Probably')
- responseInfo['PixelEvent'] = StepEvent.generate(300, color)
- (dist, pixel) = self.getPixelNearest(location)
- pixel.processInput(responseInfo['PixelEvent'], 0) #TODO: z-index
-
- def getPixelNearest(self, location):
- dists = [(Geo.dist(location, pixel.location), pixel) for pixel in self.pixels]
- dists.sort()
- return dists[0]
- #just for now.