Changeset - fe4dd7e7c4ba
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 7 years ago 2018-06-08 23:12:04
drewp@bigasterisk.com
fix corruption of choice uris to strings when KC saves them
Ignore-this: 2de843511fc7e8ad8b030406d47707fb
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light9/effect/settings.py
Show inline comments
 
@@ -206,28 +206,30 @@ class _Settings(object):
 
        # ported from live.coffee
 
        add = []
 
        for i, (dev, attr, val) in enumerate(self.asList()):
 
            # hopefully a unique number for the setting so repeated settings converge
 
            settingHash = hash((dev, attr, val)) % 9999999
 
            setting = URIRef('%sset%s' % (settingRoot, settingHash))
 
            add.append((subj, L9['setting'], setting, ctx))
 
            if setting in settingsSubgraphCache:              
 
                continue
 
                
 
            scaledAttributeTypes = [L9['color'], L9['brightness'], L9['uv']]
 
            settingType = L9['scaledValue'] if attr in scaledAttributeTypes else L9['value']
 
            if not isinstance(val, URIRef):
 
                val = Literal(val)
 
            add.extend([
 
                (setting, L9['device'], dev, ctx),
 
                (setting, L9['deviceAttr'], attr, ctx),
 
                (setting, settingType, Literal(val), ctx),
 
                (setting, settingType, val, ctx),
 
                ])
 
            settingsSubgraphCache.add(setting)
 
            
 
        return add
 

	
 

	
 
class DeviceSettings(_Settings):
 
    def _vectorKeys(self, deviceAttrFilter=None):
 
        with self.graph.currentState() as g:
 
            devs = set() # devclass, dev
 
            for dc in g.subjects(RDF.type, L9['DeviceClass']):
 
                for dev in g.subjects(RDF.type, dc):
0 comments (0 inline, 0 general)