changeset 1672:3b339c468702

sequencer needs to resolve values from multiple notes Ignore-this: 28ed09979fe787b6ea5bc507c1ee7183
author drewp@bigasterisk.com
date Sun, 11 Jun 2017 18:34:56 +0000
parents e0d50994c6e5
children 1626e3b6f181
files light9/collector/device.py light9/effect/settings.py
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/light9/collector/device.py	Sun Jun 11 07:14:05 2017 +0000
+++ b/light9/collector/device.py	Sun Jun 11 18:34:56 2017 +0000
@@ -43,6 +43,8 @@
     """
     return one value to use for this attr, given a set of them that
     have come in simultaneously. len(values) >= 1.
+
+    bug: some callers are passing a device instance for 1st arg
     """
     if len(values) == 1:
         return values[0]
--- a/light9/effect/settings.py	Sun Jun 11 07:14:05 2017 +0000
+++ b/light9/effect/settings.py	Sun Jun 11 18:34:56 2017 +0000
@@ -11,6 +11,7 @@
 from light9.rdfdb.patch import Patch
 import logging
 log = logging.getLogger('settings')
+from light9.collector.device import resolve
 
 def parseHex(h):
     if h[0] != '#': raise ValueError(h)
@@ -76,6 +77,7 @@
 
     @classmethod
     def fromList(cls, graph, others):
+        """note that others may have multiple values for an attr"""
         out = cls(graph, [])
         for s in others:
             if not isinstance(s, cls):
@@ -83,7 +85,11 @@
             for row in s.asList(): # could work straight from s._compiled
                 if row[0] is None:
                     raise TypeError('bad row %r' % (row,))
-                out._compiled.setdefault(row[0], {})[row[1]] = row[2]
+                dev, devAttr, value = row
+                devDict = out._compiled.setdefault(dev, {})
+                if devAttr in devDict:
+                    value = resolve(dev, devAttr, [devDict[devAttr], value])
+                devDict[devAttr] = value
         out._delZeros()
         return out