From 00e836cfa4e2652d724972585d661143142af002 Mon Sep 17 00:00:00 2001 From: eugue Date: Mon, 24 Jan 2011 14:41:38 -0500 Subject: merge with biginstall --- pixelcore/Pixel.py | 8 ++++---- pixelcore/PixelEventManager.py | 2 ++ pixelcore/Screen.py | 10 ++++------ 3 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 pixelcore/PixelEventManager.py (limited to 'pixelcore') diff --git a/pixelcore/Pixel.py b/pixelcore/Pixel.py index b9fc07f..7260e56 100644 --- a/pixelcore/Pixel.py +++ b/pixelcore/Pixel.py @@ -29,10 +29,10 @@ class Pixel: #arg #Add a pixelEvent to the list of active events - def processInput(self,pixelEvent,zindex, currentTime=None): #consider migrating arg to dict + def processInput(self,pixelEvent,zindex, scale=1,currentTime=None): #consider migrating arg to dict if currentTime == None: currentTime = timeops.time() - self.events[currentTime] = (zindex, pixelEvent) + self.events[currentTime] = (zindex,scale, pixelEvent) def clearAllEvents(self): self.events = {} @@ -49,10 +49,10 @@ class Pixel: resultingColor = (0,0,0) colors = [] for eventTime in self.events: #TODO: right color weighting code - (zindex,event) = self.events[eventTime] + (zindex,scale,event) = self.events[eventTime] eventResult = event.state(currentTime-eventTime) if eventResult != None: - colors.append(eventResult) + colors.append(color.multiplyColor(eventResult,scale)) else: deadEvents.append(eventTime) diff --git a/pixelcore/PixelEventManager.py b/pixelcore/PixelEventManager.py new file mode 100644 index 0000000..779a0ce --- /dev/null +++ b/pixelcore/PixelEventManager.py @@ -0,0 +1,2 @@ +class PixelEventManager(object): + def init(self) diff --git a/pixelcore/Screen.py b/pixelcore/Screen.py index 22cfdb0..cfadee8 100644 --- a/pixelcore/Screen.py +++ b/pixelcore/Screen.py @@ -8,6 +8,7 @@ import util.Strings as Strings import util.TimeOps as timeops import itertools import sys +import pdb from logger import main_log #Class representing a collection of Pixels grouped into PixelStrips. Needs a #PixelMapper, currently set via setMapper by may be migrated into the argDict. @@ -37,9 +38,7 @@ class Screen: self.xSortedPixels.sort() self.xPixelLocs = [p[0] for p in self.xSortedPixels] - def render(self, surface): - [lS.render(surface) for lS in self.pixelStrips] - + #For debug only def allOn(self): [lS.allOn(-1) for lS in self.pixelStrips] @@ -74,6 +73,7 @@ class Screen: maxY = max(y, maxY) self.size = (0,0, maxX, maxY) self.sizeValid = True + print self.size return (0, 0, maxX+100, maxY+100) #TODO: cleaner #private @@ -89,9 +89,7 @@ class Screen: #if type(mapper) != type(PixelMapper): # raise Exception('No default mapper specified.') pixelWeightList = mapper.mapEvent(responseInfo['Location'], self) - PixelEvent.addPixelEventIfMissing(responseInfo) currentTime = timeops.time() for (pixel, weight) in pixelWeightList: - pixel.processInput(responseInfo['PixelEvent'].scale(weight), 0, currentTime) #TODO: z-index - + pixel.processInput(responseInfo['PixelEvent'], 0,weight, currentTime) #TODO: z-index -- cgit v1.2.3