aboutsummaryrefslogtreecommitdiff
path: root/LightInstallation.py
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2010-12-15 00:18:24 -0500
committerGravatar rcoh <rcoh@mit.edu>2010-12-15 00:18:24 -0500
commita89c772cd64c6790906734f7128947e0f453c7e3 (patch)
tree250e0b0d235e1215fa7b40fcfd24b74028ccf643 /LightInstallation.py
parent8cecf83f16fcdec5b3ee68cc40c2b360e0f845d0 (diff)
About halfway done with the Util cleanup. Some stuff left to do with scoping etc.
Diffstat (limited to 'LightInstallation.py')
-rw-r--r--LightInstallation.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/LightInstallation.py b/LightInstallation.py
index e4adab7..5f12abf 100644
--- a/LightInstallation.py
+++ b/LightInstallation.py
@@ -3,11 +3,13 @@ from pixelcore.Screen import *
from pixelcore.PixelStrip import *
import pdb, sys, time, Util, thread
from pygame.locals import *
+import util.TimeOps as clock
+import util.Config as configGetter
#Python class to instantiate and drive a Screen through different patterns,
#and effects.
class LightInstallation:
def __init__(self, configFileName):
- self.timer = Util.Stopwatch()
+ self.timer = clock.Stopwatch()
self.timer.start()
self.inputs = {} #dict of inputs and their bound behaviors, keyed by InputId
self.behaviors = {}
@@ -22,7 +24,7 @@ class LightInstallation:
Util.setComponentDict(self.componentDict)
self.screen = Screen()
Util.setScreen(self.screen)
- config = Util.loadConfigFile(configFileName)
+ config = configGetter.loadConfigFile(configFileName)
#read configs from xml
rendererConfig = config.find('RendererConfiguration')
pixelConfig = config.find('PixelConfiguration')
@@ -75,7 +77,7 @@ class LightInstallation:
for configItem in config.getchildren():
[module,className] = configItem.find('Class').text.split('.')
exec('from ' + module+'.'+className + ' import *')
- args = Util.generateArgDict(configItem.find('Args'))
+ args = configGetter.generateArgDict(configItem.find('Args'))
args['parentScope'] = self #TODO: we shouldn't give away scope
#like this, find another way.
components.append(eval(className+'(args)')) #TODO: doesn't error
@@ -85,12 +87,12 @@ class LightInstallation:
return True
def mainLoop(self):
#self.screen.allOn()
- lastLoopTime = Util.time()
+ lastLoopTime = clock.time()
refreshInterval = 30
runCount = 10000
while runCount > 0:
runCount -= 1
- loopStart = Util.time()
+ loopStart = clock.time()
responses = self.evaluateBehaviors() #inputs are all queued when they
#happen, so we only need to run the behaviors
self.timer.start()
@@ -98,7 +100,7 @@ class LightInstallation:
response != []]
self.screen.timeStep()
[r.render(self.screen) for r in self.renderers]
- loopElapsed = Util.time()-loopStart
+ loopElapsed = clock.time()-loopStart
sleepTime = max(0,refreshInterval-loopElapsed)
self.timer.stop()
#print self.timer.elapsed()