From 7386cbc7ce48e3996d92d84cff3d1a4dab8f538d Mon Sep 17 00:00:00 2001 From: rcoh Date: Mon, 20 Dec 2010 14:19:09 -0500 Subject: A little bit more util stuff. Migrated the component registry to the ComponentRegistry module. Almost done. --- behaviors/BehaviorChain.py | 5 +++-- behaviors/RunningBehavior.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'behaviors') diff --git a/behaviors/BehaviorChain.py b/behaviors/BehaviorChain.py index fe50573..65f5c9d 100644 --- a/behaviors/BehaviorChain.py +++ b/behaviors/BehaviorChain.py @@ -1,4 +1,5 @@ from operationscore.Behavior import * +import util.ComponentRegistry as compReg import Util import pdb class BehaviorChain(Behavior): @@ -10,7 +11,7 @@ class BehaviorChain(Behavior): def processResponse(self, sensorInputs, recursiveInputs): response = sensorInputs for behaviorId in self['ChainedBehaviors']: - behavior = Util.getComponentById(behaviorId) + behavior = compReg.getComponent(behaviorId) if behaviorId in self.feedback: recurrence = self.feedback[behaviorId] else: @@ -19,7 +20,7 @@ class BehaviorChain(Behavior): recurrence) if behaviorId in self.hooks: #process recursive hook if there is one - hookBehavior = Util.getComponentById(self.hooks[behaviorId]) + hookBehavior = compReg.getComponent(self.hooks[behaviorId]) #we feed its recurrence in as input to the behavior. (recurrence, hookRecurrence) = \ hookBehavior.immediateProcessInput(recurrence, \ diff --git a/behaviors/RunningBehavior.py b/behaviors/RunningBehavior.py index 3d82d29..4f51898 100644 --- a/behaviors/RunningBehavior.py +++ b/behaviors/RunningBehavior.py @@ -1,4 +1,5 @@ from operationscore.Behavior import * +import util.ComponentRegistry as compReg import pdb import Util class RunningBehavior(Behavior): @@ -15,7 +16,7 @@ class RunningBehavior(Behavior): outDict['Location']= Util.addLocations(outDict['Location'], (outDict['StepSize']*outDict['Dir'],0)) if not Util.pointWithinBoundingBox(outDict['Location'], \ - Util.getScreen().getSize()): + compReg.getComponent('Screen').getSize()): outDict['Dir'] *= -1 ret.append(outDict) ret += newResponses -- cgit v1.2.3