From 83242972c09032eb89dd547f3ff3c4dcc2693555 Mon Sep 17 00:00:00 2001 From: rcoh Date: Mon, 14 Feb 2011 01:51:43 -0500 Subject: Fixed some threading bugs. Modified LightInstallation.py so that Behaviors are *Only* run if they are marked to be rendered. Fixed a threading issue tied to the component registry. --- inputs/ContinuousCenterInput.py | 3 ++- inputs/ContinuousLocationInput.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'inputs') diff --git a/inputs/ContinuousCenterInput.py b/inputs/ContinuousCenterInput.py index a7635b2..88534f0 100644 --- a/inputs/ContinuousCenterInput.py +++ b/inputs/ContinuousCenterInput.py @@ -4,9 +4,10 @@ import util.Strings as Strings from operationscore.Input import * class ContinuousCenterInput(Input): def inputInit(self): + compReg.getLock().acquire() minX,minY,maxX,maxY = compReg.getComponent('Screen').getSize() + compReg.getLock().release() self.center = ((minX+maxX) / 2, (minY+maxY) / 2) - print self.center def sensingLoop(self): self.respond({Strings.LOCATION: self.center}) diff --git a/inputs/ContinuousLocationInput.py b/inputs/ContinuousLocationInput.py index 52a36ad..72ca8f0 100644 --- a/inputs/ContinuousLocationInput.py +++ b/inputs/ContinuousLocationInput.py @@ -8,7 +8,9 @@ class ContinuousLocationInput(Input): def inputInit(self): xvals = {} yvals = {} + compReg.getLock().acquire() xvals['left'], yvals['bottom'], xvals['right'], yvals['top'] = compReg.getComponent('Screen').getSize() + compReg.getLock().release() (xvals['center'], yvals['center']) = ((xvals['left']+xvals['right']) / 2, (yvals['top']+yvals['bottom']) / 2) self.location = (xvals[self['xloc']], yvals[self['yloc']]) -- cgit v1.2.3