From 792dd4d7139f9080bf6d3d760efe763b8b3f60cc Mon Sep 17 00:00:00 2001 From: dxiao Date: Sun, 20 Feb 2011 16:18:43 -0500 Subject: Added LocationMask, which limits affected pixels to a specified region of the screen --- behaviors/LocationMask.py | 19 +++++++++++++++++++ config/C5Sign.xml | 8 ++++++++ pixelmappers/C5SignMapper.py | 11 +++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 behaviors/LocationMask.py diff --git a/behaviors/LocationMask.py b/behaviors/LocationMask.py new file mode 100644 index 0000000..51eafeb --- /dev/null +++ b/behaviors/LocationMask.py @@ -0,0 +1,19 @@ +from operationscore.Behavior import * + +class LocationMask (Behavior): + """Modifies Pixels such that only ones in the pixels specified by the "location" + argument will show""" + + def processResponse(self, inputs, state): + + ret = [] + inputs = list(inputs) + + for inputset in inputs: + inputset = dict(inputset) + + inputset['Location'] += '@' + self['Location'] + + ret.append(inputset) + + return (ret, []) diff --git a/config/C5Sign.xml b/config/C5Sign.xml index 8039c07..6d7de20 100644 --- a/config/C5Sign.xml +++ b/config/C5Sign.xml @@ -124,6 +124,7 @@ colorchange mover slowdecay + wordsonly {'mover':'bar_move'} False @@ -179,6 +180,13 @@ {y}<2 or {y}>24 + + behaviors.LocationMask + + wordsonly + wt.all cl.all c5.all + + behaviors.BehaviorChain diff --git a/pixelmappers/C5SignMapper.py b/pixelmappers/C5SignMapper.py index 24631c4..6d5163d 100644 --- a/pixelmappers/C5SignMapper.py +++ b/pixelmappers/C5SignMapper.py @@ -98,8 +98,15 @@ class C5SignMapper(PixelMapper): eventLocSplit = eventLocation.split('@') if len(eventLocSplit) == 2: [eventLocation, signPart] = eventLocSplit - signParts = signPart.split('.') - pixelLocs = signPosition[signParts[0]][signParts[1]] + signParts = signPart.split(' ') + #print "*******************" + #print signParts + pixelLocs = [] + for part in signParts: + if len(part) > 0: + parts = part.split('.') + pixelLocs.extend(self.signPosition[parts[0]][parts[1]]) + #print pixelLocs screenPixels = [p for p in screen if (p.location in pixelLocs)] else: screenPixels = [p for p in screen] -- cgit v1.2.3