diff --git a/bin/collector b/bin/collector
--- a/bin/collector
+++ b/bin/collector
@@ -32,7 +32,11 @@ def parseJsonMessage(msg):
body = json.loads(msg)
settings = []
for device, attr, value in body['settings']:
- settings.append((URIRef(device), URIRef(attr), Literal(value)))
+ if isinstance(value, basestring) and value.startswith('http'):
+ value = URIRef(value)
+ else:
+ value = Literal(value)
+ settings.append((URIRef(device), URIRef(attr), value))
return body['client'], body['clientSession'], settings, body['sendTime']
def startZmq(port, collector):
diff --git a/light9/collector/device.py b/light9/collector/device.py
--- a/light9/collector/device.py
+++ b/light9/collector/device.py
@@ -104,6 +104,7 @@ def toOutputAttrs(deviceType, deviceAttr
return 3
if deviceAttrSettings.get(attr) == L9['g2']:
return 10
+ return 0
if deviceType == L9['ChauvetColorStrip']:
r, g, b = rgbAttr(L9['color'])
diff --git a/light9/web/graph.coffee b/light9/web/graph.coffee
--- a/light9/web/graph.coffee
+++ b/light9/web/graph.coffee
@@ -253,6 +253,13 @@ class window.SyncedGraph
uriValue: (s, p) ->
@_singleValue(s, p)
+ labelOrTail: (uri) ->
+ try
+ @graph.stringValue(uri, @graph.Uri('rdfs:label'))
+ catch
+ words = uri.split('/')
+ words[words.length-1]
+
objects: (s, p) ->
@_autoDeps.askedFor(s, p, null, null)
quads = @graph.findByIRI(s, p)
diff --git a/light9/web/live/index.html b/light9/web/live/index.html
--- a/light9/web/live/index.html
+++ b/light9/web/live/index.html
@@ -43,9 +43,10 @@
-
diff --git a/light9/web/live/live.coffee b/light9/web/live/live.coffee
--- a/light9/web/live/live.coffee
+++ b/light9/web/live/live.coffee
@@ -10,6 +10,7 @@ Polymer
immediateSlider: { notify: true, observer: 'onSlider' }
pickedColor: { observer: 'onPickedColor' }
+ pickedChoice: { observer: 'onChange' }
observers: [
'onChange(value)'
]
@@ -19,9 +20,6 @@ Polymer
onSlider: -> @value = @immediateSlider
goWhite: -> @value = "#ffffff"
goBlack: -> @value = "#000000"
- onChoice: (ev) ->
- console.log('ch', ev)
-
onChange: (value) ->
@lastSent = [[@device, @deviceAttr.uri, value]]
@resend()
@@ -38,7 +36,6 @@ Polymer
properties:
graph: { type: Object, notify: true }
uri: { type: String, notify: true }
- label: { type: String, notify: true }
deviceClass: { type: String, notify: true }
deviceAttrs: { type: Array, notify: true }
observers: [
@@ -48,13 +45,7 @@ Polymer
@graph.runHandler(@update.bind(@), "#{@uri} update")
update: ->
U = (x) => @graph.Uri(x)
-
- @zlabel = (try
- @graph.stringValue(@uri, U('rdfs:label'))
- catch
- words = @uri.split('/')
- words[words.length-1]
- )
+
@deviceClass = @graph.uriValue(@uri, U('rdf:type'))
@deviceAttrs = []
@@ -70,9 +61,10 @@ Polymer
else if dataType == U(':choice')
daRow.useChoice = true
- daRow.choices = @graph.objects(da, U(':choice'))
+ choiceUris = _.sortBy(@graph.objects(da, U(':choice')))
+ daRow.choices = ({uri: x, label: @graph.labelOrTail(x)} for x in choiceUris)
+ daRow.choiceSize = Math.min(choiceUris.length + 1, 10)
else
-
daRow.useSlider = true
daRow.max = 1
if dataType == U(':angle')
diff --git a/light9/web/resource-display.html b/light9/web/resource-display.html
--- a/light9/web/resource-display.html
+++ b/light9/web/resource-display.html
@@ -38,8 +38,8 @@
Polymer({
is: "resource-display",
properties: {
- graph: { type: Object },
- uri: { type: String },
+ graph: { type: Object, notify: true },
+ uri: { type: String, notify: true },
label: { type: String },
rename: { type: Boolean },
renameTo: { type: String, notify: true },
@@ -48,10 +48,14 @@
this.graph.runHandler(this.setLabel.bind(this), `label ${this.uri}`);
},
setLabel: function() {
- this.label = this.graph.stringValue(this.uri,
- this.graph.Uri('rdfs:label'));
+ try {
+ this.label = this.graph.stringValue(this.uri,
+ this.graph.Uri('rdfs:label'));
+ } catch(e) {
+ this.label = null;
+ }
if (!this.label) {
- this.label = this.uri;
+ this.label = this.uri || "";
}
},
onRename: function() {