aboutsummaryrefslogtreecommitdiff
path: root/LightInstallation.py
diff options
context:
space:
mode:
authorGravatar Russell Cohen <rcoh@mit.edu>2010-11-24 01:09:12 -0500
committerGravatar Russell Cohen <rcoh@mit.edu>2010-11-24 01:09:12 -0500
commitb042647b68abdc82490ca6e059993b8eba28904c (patch)
treea9ee95a38e98b377c251b7b2e9af9cbd8056cf7c /LightInstallation.py
parent407ac922fc4178021cf3a16dfb1bd875b6083ac4 (diff)
Refactoring complete! Made modules/packages as appropriate. Finally.
Diffstat (limited to 'LightInstallation.py')
-rw-r--r--LightInstallation.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/LightInstallation.py b/LightInstallation.py
index 0c24981..3fcdcd5 100644
--- a/LightInstallation.py
+++ b/LightInstallation.py
@@ -1,6 +1,6 @@
from xml.etree.ElementTree import ElementTree
-from Screen import Screen
-from PixelStrip import PixelStrip
+from pixelcore.Screen import *
+from pixelcore.PixelStrip import *
import pdb, sys, time, Util
from pygame.locals import *
#Python class to instantiate and drive a Screen through different patterns,
@@ -9,9 +9,8 @@ class LightInstallation:
def __init__(self, configFileName):
self.inputs = {} #dict of inputs and their bound behaviors, keyed by InputId
self.behaviors = {}
- config = ElementTree()
- config.parse(configFileName)
self.screen = Screen()
+ config = Util.loadConfigFile(configFileName)
rendererConfig = config.find('RendererConfiguration')
layoutConfig = config.find('LayoutConfiguration')
inputConfig = config.find('InputConfiguration')
@@ -40,8 +39,8 @@ class LightInstallation:
components = []
if config != None:
for configItem in config.getchildren():
- className = configItem.find('Class').text
- exec('from ' + className + ' import ' + className)
+ [module,className] = configItem.find('Class').text.split('.')
+ exec('from ' + module+'.'+className + ' import *')
args = Util.generateArgDict(configItem.find('Args'))
args['parentScope'] = self
components.append(eval(className+'(args)')) #TODO: doesn't error