aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Profile.py2
-rw-r--r--behaviors/Accelerate.xml2
-rw-r--r--behaviors/RunningBehavior.py1
-rw-r--r--config/6thFloor.xml208
-rw-r--r--layouts/60StripLayout.xml182
-rw-r--r--operationscore/PixelMapper.py6
-rw-r--r--pixelcore/Pixel.py8
-rw-r--r--pixelcore/Screen.py4
-rw-r--r--pixelevents/DecayEvent.py6
-rw-r--r--renderers/60StripSeq.xml130
-rw-r--r--renderers/IndoorRenderer.py6
-rw-r--r--renderers/PygameRenderer.py2
-rw-r--r--util/Config.py14
13 files changed, 551 insertions, 20 deletions
diff --git a/Profile.py b/Profile.py
index 45ccc35..2f180c9 100644
--- a/Profile.py
+++ b/Profile.py
@@ -1,4 +1,4 @@
import cProfile
from LightInstallation import main
-command = """main(['', 'config/Outdoor.xml'])"""
+command = """main(['', 'config/6thFloor.xml'])"""
cProfile.runctx(command, globals(), locals(), filename="smootlight.profile")
diff --git a/behaviors/Accelerate.xml b/behaviors/Accelerate.xml
index c78195b..f9de077 100644
--- a/behaviors/Accelerate.xml
+++ b/behaviors/Accelerate.xml
@@ -3,6 +3,6 @@
<Args>
<ParamType>Sensor</ParamType>
<ParamName>StepSize</ParamName>
- <ParamOp>{val}*1.01</ParamOp>
+ <ParamOp>{val}*1.1</ParamOp>
</Args>
</Behavior>
diff --git a/behaviors/RunningBehavior.py b/behaviors/RunningBehavior.py
index 92db69b..5eb33f7 100644
--- a/behaviors/RunningBehavior.py
+++ b/behaviors/RunningBehavior.py
@@ -15,6 +15,7 @@ class RunningBehavior(Behavior):
outDict['StepSize'] = self['StepSize']
outDict['Location']= Geo.addLocations(outDict['Location'],
(outDict['StepSize']*outDict['Dir'],0))
+
if not Geo.pointWithinBoundingBox(outDict['Location'], \
compReg.getComponent('Screen').getSize()):
outDict['Dir'] *= -1
diff --git a/config/6thFloor.xml b/config/6thFloor.xml
new file mode 100644
index 0000000..9c5f77e
--- /dev/null
+++ b/config/6thFloor.xml
@@ -0,0 +1,208 @@
+<!---All configuration items contain a "Class" tag specifying the python class they represent, and an "Args" tag specifying the args to be passed in.-->
+<LightInstallation>
+ <InstallationConfiguration>
+ <Defaults>
+ <PixelMapper>simplemap</PixelMapper>
+ </Defaults>
+ </InstallationConfiguration>
+ <PixelConfiguration>
+ <InheritsFrom>layouts/60StripLayout.xml</InheritsFrom>
+ </PixelConfiguration>
+ <PixelMapperConfiguration>
+ <PixelMapper>
+ <Class>pixelmappers.SimpleMapper</Class>
+ <Args>
+ <Id>simplemap</Id>
+ <CutoffDist>20</CutoffDist>
+ </Args>
+ </PixelMapper>
+ <PixelMapper>
+ <Class>pixelmappers.GaussianMapper</Class>
+ <Args>
+ <Id>gaussmap</Id>
+ <CutoffDist>30</CutoffDist>
+ <MinWeight>0.1</MinWeight>
+ <Width>10</Width>
+ <Height>1</Height>
+ </Args>
+ </PixelMapper>
+ </PixelMapperConfiguration>
+ <RendererConfiguration>
+ <Renderer>
+ <InheritsFrom>renderers/60StripSeq.xml</InheritsFrom>
+ </Renderer>
+ <Renderer>
+ <InheritsFrom>renderers/Pygame.xml</InheritsFrom>
+ </Renderer>
+ </RendererConfiguration>
+ <InputConfiguration>
+ <InputElement>
+ <Class>inputs.PygameInput</Class>
+ <Args><!--Passed as a dictionary-->
+ <Id>pygame</Id>
+ <RefreshInterval>10</RefreshInterval>
+ </Args>
+ </InputElement>
+ <!--<InputElement>
+ <Class>inputs.TCPInput</Class>
+ <Args>
+ <Id>tcp</Id>
+ <Port>20120</Port>
+ <RefreshInterval>10</RefreshInterval>
+ </Args>
+ </InputElement>-->
+ <InputElement Id="followmouse">
+ <InheritsFrom>inputs/MouseFollower.xml</InheritsFrom>
+ </InputElement>
+ <InputElement>
+ <Class>inputs.RandomLocs</Class>
+ <Args>
+ <Id>randomLoc</Id>
+ </Args>
+ </InputElement>
+ </InputConfiguration>
+ <BehaviorConfiguration>
+ <Behavior>
+ <Class>behaviors.EchoBehavior</Class>
+ <Args>
+ <Id>echo</Id>
+ <z-index>0</z-index>
+ <RenderToScreen>False</RenderToScreen>
+ </Args>
+ </Behavior>
+ <Behavior Id="redshift">
+ <InheritsFrom>behaviors/RedShift.xml</InheritsFrom>
+ </Behavior>
+ <Behavior Id="colorchange">
+ <InheritsFrom>behaviors/RandomColor.xml</InheritsFrom>
+ </Behavior>
+ <Behavior Id="decay">
+ <InheritsFrom>behaviors/PixelDecay.xml</InheritsFrom>
+ </Behavior>
+ <Behavior Id="slowdecay">
+ <InheritsFrom>behaviors/PixelDecay.xml</InheritsFrom>
+ <Args>
+ <Coefficient>.01</Coefficient>
+ </Args>
+ </Behavior>
+ <Behavior>
+ <Class>behaviors.DebugBehavior</Class>
+ <Args>
+ <Id>debug</Id>
+ <z-index>0</z-index>
+ <Inputs>
+ <Id>pygame</Id>
+ </Inputs>
+ </Args>
+ </Behavior>
+ <Behavior>
+ <Class>behaviors.AllPixelsLeft</Class>
+ <Args>
+ <Id>pixelsleft</Id>
+ </Args>
+ </Behavior>
+ <Behavior>
+ <Class>behaviors.Square</Class>
+ <Args>
+ <Id>square</Id>
+ <Width>20</Width>
+ </Args>
+ </Behavior>
+ <Behavior Id="recursivedecay">
+ <InheritsFrom>behaviors/LoopAndDie.xml</InheritsFrom>
+ <Args>
+ <InitialResponseCount>50</InitialResponseCount>
+ </Args>
+ </Behavior>
+ <Behavior>
+ <Class>behaviors.BehaviorChain</Class>
+ <Args>
+ <Id>runcolordecay</Id>
+ <Inputs>
+ <Id>pygame</Id>
+ </Inputs>
+ <ChainedBehaviors>
+ <Id>colorchange</Id>
+ <Id>running</Id>
+ <Id>decay</Id>
+ </ChainedBehaviors>
+ <RecursiveHooks>{'running':'acceleratedie'}</RecursiveHooks>
+ <RenderToScreen>True</RenderToScreen>
+ <Mapper>gaussmap</Mapper>
+ </Args>
+ </Behavior>
+ <Behavior>
+ <Class>behaviors.BehaviorChain</Class>
+ <Args>
+ <Id>randomwalk</Id>
+ <Inputs>
+ <Id>pygame</Id>
+ </Inputs>
+ <ChainedBehaviors>
+ <Id>colorchange</Id>
+ <Id>mover</Id>
+ <Id>decay</Id>
+ </ChainedBehaviors>
+ <RecursiveHooks>{'mover':'redwalk'}</RecursiveHooks>
+ <RenderToScreen>True</RenderToScreen>
+ <Mapper>gaussmap</Mapper>
+ </Args>
+ </Behavior>
+ <Behavior>
+ <Class>behaviors.ResponseMover</Class>
+ <Args>
+ <Id>mover</Id>
+ </Args>
+ </Behavior>
+ <Behavior>
+ <Class>behaviors.BehaviorChain</Class>
+ <Args>
+ <Id>redwalk</Id>
+ <ChainedBehaviors>
+ <Id>randmovement</Id>
+ <Id>redshift</Id>
+ </ChainedBehaviors>
+ </Args>
+ </Behavior>
+ <Behavior>
+ <Class>behaviors.RandomWalk</Class>
+ <Args>
+ <Id>randmovement</Id>
+ <StepSize>2</StepSize>
+ </Args>
+ </Behavior>
+ <Behavior Id="accelerate">
+ <InheritsFrom>behaviors/Accelerate.xml</InheritsFrom>
+ </Behavior>
+ <Behavior>
+ <Class>behaviors.BehaviorChain</Class>
+ <Args>
+ <Id>acceleratedie</Id>
+ <ChainedBehaviors>
+ <Id>accelerate</Id>
+ <Id>recursivedecay</Id>
+ </ChainedBehaviors>
+ </Args>
+ </Behavior>
+ <Behavior>
+ <Class>behaviors.BehaviorChain</Class>
+ <Args>
+ <Id>mousechaser</Id>
+ <Inputs>
+ <Id>followmouse</Id>
+ <Id>tcp</Id>
+ </Inputs>
+ <ChainedBehaviors>
+ <Id>echo</Id>
+ <Id>redshift</Id>
+ <Id>square</Id>
+ <Id>slowdecay</Id>
+ </ChainedBehaviors>
+ <RenderToScreen>True</RenderToScreen>
+ </Args>
+ </Behavior>
+ <Behavior Id="running">
+ <InheritsFrom>behaviors/RunningBehavior.xml</InheritsFrom>
+ </Behavior>
+ </BehaviorConfiguration>
+</LightInstallation>
diff --git a/layouts/60StripLayout.xml b/layouts/60StripLayout.xml
new file mode 100644
index 0000000..30f51c5
--- /dev/null
+++ b/layouts/60StripLayout.xml
@@ -0,0 +1,182 @@
+<PixelConfiguration>
+ <PixelStrip Id="strip1.1" originLocation="(0,0)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip1.2" originLocation="(200,0)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip2.1" originLocation="(0,15)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip2.2" originLocation="(200,15)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip3.1" originLocation="(0,30)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip3.2" originLocation="(200,30)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip4.1" originLocation="(0,45)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip4.2" originLocation="(200,45)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip5.1" originLocation="(0,60)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip5.2" originLocation="(200,60)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip6.1" originLocation="(0,75)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip6.2" originLocation="(200,75)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip7.1" originLocation="(0,90)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip7.2" originLocation="(200,90)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip8.1" originLocation="(0,105)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip8.2" originLocation="(200,105)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip9.1" originLocation="(0,120)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip9.2" originLocation="(200,120)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip10.1" originLocation="(0,135)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip10.2" originLocation="(200,135)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip11.1" originLocation="(0,150)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip11.2" originLocation="(200,150)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip12.1" originLocation="(0,165)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip12.2" originLocation="(200,165)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip13.1" originLocation="(0,180)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip13.2" originLocation="(200,180)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip14.1" originLocation="(0,195)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip14.2" originLocation="(200,195)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip15.1" originLocation="(0,210)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip15.2" originLocation="(200,210)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip16.1" originLocation="(400,0)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip16.2" originLocation="(600,0)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip17.1" originLocation="(400,15)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip17.2" originLocation="(600,15)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip18.1" originLocation="(400,30)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip18.2" originLocation="(600,30)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip19.1" originLocation="(400,45)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip19.2" originLocation="(600,45)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip20.1" originLocation="(400,60)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip20.2" originLocation="(600,60)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip21.1" originLocation="(400,75)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip21.2" originLocation="(600,75)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip22.1" originLocation="(400,90)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip22.2" originLocation="(600,90)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip23.1" originLocation="(400,105)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip23.2" originLocation="(600,105)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip24.1" originLocation="(400,120)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip24.2" originLocation="(600,120)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip25.1" originLocation="(400,135)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip25.2" originLocation="(600,135)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip26.1" originLocation="(400,150)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip26.2" originLocation="(600,150)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip27.1" originLocation="(400,165)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip27.2" originLocation="(600,165)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip28.1" originLocation="(400,180)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip28.2" originLocation="(600,180)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip29.1" originLocation="(400,195)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip29.2" originLocation="(600,195)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip30.1" originLocation="(400,210)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+ <PixelStrip Id="strip30.2" originLocation="(600,210)">
+ <InheritsFrom>layouts/50PixelStrip.xml</InheritsFrom>
+ </PixelStrip>
+</PixelConfiguration>
diff --git a/operationscore/PixelMapper.py b/operationscore/PixelMapper.py
index e3f2515..1f94fa5 100644
--- a/operationscore/PixelMapper.py
+++ b/operationscore/PixelMapper.py
@@ -3,8 +3,14 @@ import pdb
class PixelMapper(SmootCoreObject):
def init(self):
self.mem = {} #Dictionary of all seen events
+ self.totalCalls = 0
+ self.cachehits = 0
def mapEvent(self, eventLocation, screen):
+ self.totalCalls += 1
+ if self.totalCalls % 100 == 0:
+ print self['Id'], self.cachehits / float(self.totalCalls)
if eventLocation in self.mem:
+ self.cachehits += 1
return self.mem[eventLocation]
else:
self.mem[eventLocation] = self.mappingFunction(eventLocation, screen)
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/Screen.py b/pixelcore/Screen.py
index 6666235..cfadee8 100644
--- a/pixelcore/Screen.py
+++ b/pixelcore/Screen.py
@@ -73,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
@@ -88,8 +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
diff --git a/pixelevents/DecayEvent.py b/pixelevents/DecayEvent.py
index 3767729..f8d5ef0 100644
--- a/pixelevents/DecayEvent.py
+++ b/pixelevents/DecayEvent.py
@@ -4,12 +4,12 @@ from util.ColorOps import *
import util.Geo as Geo
class DecayEvent(PixelEvent):
def initEvent(self):
- self.coefficient = float(abs(self['Coefficient']))
- if self['DecayType'] == 'Exponential':
+ self.coefficient = float(abs(self.Coefficient))
+ if self.DecayType == 'Exponential':
self.decayType = 1
else:
self.decayType = 2
- self.color = self['Color']
+ self.color = self.Color
#SUBVERTING DESIGN FOR THE SAKE OF EFFICIENCY -- RUSSELL COHEN (2011-01-03-23:18)
def state(self,timeDelay):
diff --git a/renderers/60StripSeq.xml b/renderers/60StripSeq.xml
new file mode 100644
index 0000000..3f5255f
--- /dev/null
+++ b/renderers/60StripSeq.xml
@@ -0,0 +1,130 @@
+<Renderer>
+ <Class>renderers.IndoorRenderer</Class>
+ <Args>
+ <Id>indoorRenderer</Id>
+ <PowerSupply>
+ <IP>10.32.0.0</IP>
+ <PortMapping>{'strip0.1':1, 'strip0.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.1</IP>
+ <PortMapping>{'strip1.1':1, 'strip1.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.2</IP>
+ <PortMapping>{'strip2.1':1, 'strip2.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.3</IP>
+ <PortMapping>{'strip3.1':1, 'strip3.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.4</IP>
+ <PortMapping>{'strip4.1':1, 'strip4.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.5</IP>
+ <PortMapping>{'strip5.1':1, 'strip5.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.6</IP>
+ <PortMapping>{'strip6.1':1, 'strip6.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.7</IP>
+ <PortMapping>{'strip7.1':1, 'strip7.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.8</IP>
+ <PortMapping>{'strip8.1':1, 'strip8.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.9</IP>
+ <PortMapping>{'strip9.1':1, 'strip9.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.10</IP>
+ <PortMapping>{'strip10.1':1, 'strip10.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.11</IP>
+ <PortMapping>{'strip11.1':1, 'strip11.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.12</IP>
+ <PortMapping>{'strip12.1':1, 'strip12.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.13</IP>
+ <PortMapping>{'strip13.1':1, 'strip13.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.14</IP>
+ <PortMapping>{'strip14.1':1, 'strip14.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.15</IP>
+ <PortMapping>{'strip15.1':1, 'strip15.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.16</IP>
+ <PortMapping>{'strip16.1':1, 'strip16.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.17</IP>
+ <PortMapping>{'strip17.1':1, 'strip17.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.18</IP>
+ <PortMapping>{'strip18.1':1, 'strip18.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.19</IP>
+ <PortMapping>{'strip19.1':1, 'strip19.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.20</IP>
+ <PortMapping>{'strip20.1':1, 'strip20.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.21</IP>
+ <PortMapping>{'strip21.1':1, 'strip21.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.22</IP>
+ <PortMapping>{'strip22.1':1, 'strip22.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.23</IP>
+ <PortMapping>{'strip23.1':1, 'strip23.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.24</IP>
+ <PortMapping>{'strip24.1':1, 'strip24.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.25</IP>
+ <PortMapping>{'strip25.1':1, 'strip25.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.26</IP>
+ <PortMapping>{'strip26.1':1, 'strip26.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.27</IP>
+ <PortMapping>{'strip27.1':1, 'strip27.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.28</IP>
+ <PortMapping>{'strip28.1':1, 'strip28.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.29</IP>
+ <PortMapping>{'strip29.1':1, 'strip29.2':2}</PortMapping>
+ </PowerSupply>
+ <PowerSupply>
+ <IP>10.32.0.30</IP>
+ <PortMapping>{'strip30.1':1, 'strip30.2':2}</PortMapping>
+ </PowerSupply>
+ </Args>
+</Renderer>
diff --git a/renderers/IndoorRenderer.py b/renderers/IndoorRenderer.py
index 5f8546a..76ec172 100644
--- a/renderers/IndoorRenderer.py
+++ b/renderers/IndoorRenderer.py
@@ -21,7 +21,7 @@ class IndoorRenderer(Renderer):
self.stripLocations[stripId] = (ip, \
stripsInPowerSupply[stripId])
def render(self, lightSystem, currentTime=timeops.time()):
- try:
+ #try:
for pixelStrip in lightSystem.pixelStrips:
stripId = pixelStrip.argDict['Id']
(ip, port) = self.stripLocations[stripId]
@@ -30,6 +30,6 @@ class IndoorRenderer(Renderer):
self.sockets[ip] = network.getConnectedSocket(ip,sock_port)
packet = composer.composePixelStripPacket(pixelStrip, port, currentTime)
self.sockets[ip].send(packet, 0x00)
- except Exception as inst:
- print inst
+ #except Exception as inst:
+ # print inst
diff --git a/renderers/PygameRenderer.py b/renderers/PygameRenderer.py
index 24b2d08..9582a03 100644
--- a/renderers/PygameRenderer.py
+++ b/renderers/PygameRenderer.py
@@ -6,7 +6,7 @@ import pdb
class PygameRenderer(Renderer):
def initRenderer(self):
pygame.init()
- self.screen = pygame.display.set_mode((1300,50))
+ self.screen = pygame.display.set_mode((1300,500))
self.background = pygame.Surface(self.screen.get_size())
self.background = self.background.convert()
self.background.fill(Color('Black'))
diff --git a/util/Config.py b/util/Config.py
index 1e20cde..c2d8806 100644
--- a/util/Config.py
+++ b/util/Config.py
@@ -99,12 +99,19 @@ def fileToDict(fileName):
def pullArgsFromItem(parentNode):
attribArgs = {}
for arg in parentNode.attrib: #automatically pull attributes into the argdict
- attribArgs[arg] = parentNode.attrib[arg]
+ attribArgs[arg] = attemptEval(parentNode.attrib[arg])
argNode = parentNode.find('Args')
args = generateArgDict(argNode)
for key in attribArgs:
args[key] = attribArgs[key]
return args
+
+def attemptEval(val):
+ try:
+ val = eval(val)
+ except (NameError, SyntaxError):
+ val = str(val)
+ return val
def generateArgDict(parentNode, recurse=False):
args = {}
for arg in parentNode.getchildren():
@@ -113,10 +120,7 @@ def generateArgDict(parentNode, recurse=False):
value = generateArgDict(arg, True)
else:
#convert into python if possible, otherwise don't
- try:
- value = eval(arg.text)
- except (NameError,SyntaxError):
- value = str(arg.text)
+ value = attemptEval(arg.text)
if key in args: #build of lists of like-elements
if type(args[key]) != type([]):
args[key] = [args[key]]