# HG changeset patch # User Drew Perttula # Date 1496307789 0 # Node ID 6059de6659c3f712d0ad2e4e52a2e2802f384927 # Parent 7943daa149dadb27d56a9fd2ca63bdf16a462209 move effects/ page into web/. fix homepage list. rm old subserver code. Ignore-this: df247afa405eb7e3a80891c2806d5fed diff -r 7943daa149da -r 6059de6659c3 bin/effecteval --- a/bin/effecteval Thu Jun 01 08:39:20 2017 +0000 +++ b/bin/effecteval Thu Jun 01 09:03:09 2017 +0000 @@ -1,4 +1,5 @@ #!bin/python + from __future__ import division from run_local import log from twisted.internet import reactor diff -r 7943daa149da -r 6059de6659c3 bin/subserver --- a/bin/subserver Thu Jun 01 08:39:20 2017 +0000 +++ b/bin/subserver Thu Jun 01 09:03:09 2017 +0000 @@ -17,45 +17,6 @@ from lib.cycloneerr import PrettyErrorHandler -liveClients = set() -def sendToLiveClients(d=None, asJson=None): - j = asJson or json.dumps(d) - for c in liveClients: - c.sendMessage(j) - -class Live(cyclone.websocket.WebSocketHandler): - def connectionMade(self, *args, **kwargs): - log.info("websocket opened") - liveClients.add(self) - self.settings.onNewClient() - - def connectionLost(self, reason): - log.info("websocket closed") - liveClients.remove(self) - - def messageReceived(self, message): - log.info("got message %s" % message) - self.sendMessage(message) - -class EffectsUpdates(cyclone.websocket.WebSocketHandler): - def connectionMade(self, *args, **kwargs): - self.connected = True - self.settings.graph.addHandler(self.onGraphChange) - - def connectionLost(self, reason): - self.connected = False - - def onGraphChange(self): - if not self.connected: - return - graph = self.settings.graph - classes = [] - for e in graph.subjects(RDF.type, L9['Effect']): - classes.append({'uri': e, - 'label': graph.label(e), - 'code': graph.value(e, L9['code'])}) - self.sendMessage({'classes': classes}) - class Static(PrettyErrorHandler, cyclone.web.StaticFileHandler): def get(self, path, *args, **kw): if path in ['', 'effects']: @@ -116,39 +77,9 @@ graph = SyncedGraph(networking.rdfdb.url, "subServer") - d = {} - def updateSubs(): - subs = [] - for sub in sorted(graph.subjects(RDF.type, L9['Submaster'])): - rec = {'uri' : sub} - rec['isLocal'] = graph.contains((sub, RDF.type, - L9['LocalSubmaster'])) - rec['label'] = graph.label(sub) - rec['img'] = newestImage(sub) - subs.append(rec) - - d.clear() - d.update({'subs': subs}) - - d['chases'] = [] - for chase in sorted(graph.subjects(RDF.type, L9['Chase'])): - fakeLabel = chase.rsplit('/', 1)[-1] - d['chases'].append({ - 'uri': chase, - 'label': fakeLabel, - }) - - sendToLiveClients(d=d) - def onNewClient(): - sendToLiveClients(d=d) - - graph.addHandler(updateSubs) - port = networking.subServer.port reactor.listenTCP(port, cyclone.web.Application(handlers=[ - (r'/live', Live), - (r'/effectsUpdates', EffectsUpdates), (r'/snapshot', Snapshot), (r'/(.*)', Static, {"path" : "light9/subserver", diff -r 7943daa149da -r 6059de6659c3 light9/subserver/effects2.coffee --- a/light9/subserver/effects2.coffee Thu Jun 01 08:39:20 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -Polymer - is: "light9-effects" - properties: - graph: {type: Object} - effectClasses: { type: Array } - ready: -> - @graph.runHandler(@getClasses.bind(@)) - - getClasses: -> - U = (x) => @graph.Uri(x) - @effectClasses = _.sortBy(@graph.subjects(U('rdf:type'), U(':Effect'))) - -Polymer - is: "light9-effect-class" - properties: - graph: {type: Object} - uri: {type: String} - - onAdd: -> - @$.songEffects.body = {drop: @uri} - @$.songEffects.generateRequest() - - onMomentaryPress: -> - @$.songEffects.body = {drop: @uri, event: 'start'} - @lastPress = @$.songEffects.generateRequest() - @lastPress.completes.then (request) => - @lastMomentaryNote = request.response.note - - onMomentaryRelease: -> - return unless @lastMomentaryNote - @$.songEffects.body = {drop: @uri, note: @lastMomentaryNote} - @lastMomentaryNote = null - @$.songEffects.generateRequest() - \ No newline at end of file diff -r 7943daa149da -r 6059de6659c3 light9/subserver/effects2.html --- a/light9/subserver/effects2.html Thu Jun 01 08:39:20 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ - - - - subserver effects2 - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 7943daa149da -r 6059de6659c3 light9/web/effects/effects.coffee --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/light9/web/effects/effects.coffee Thu Jun 01 09:03:09 2017 +0000 @@ -0,0 +1,34 @@ +Polymer + is: "light9-effects" + properties: + graph: {type: Object} + effectClasses: { type: Array } + ready: -> + @graph.runHandler(@getClasses.bind(@)) + + getClasses: -> + U = (x) => @graph.Uri(x) + @effectClasses = _.sortBy(@graph.subjects(U('rdf:type'), U(':Effect'))) + +Polymer + is: "light9-effect-class" + properties: + graph: {type: Object} + uri: {type: String} + + onAdd: -> + @$.songEffects.body = {drop: @uri} + @$.songEffects.generateRequest() + + onMomentaryPress: -> + @$.songEffects.body = {drop: @uri, event: 'start'} + @lastPress = @$.songEffects.generateRequest() + @lastPress.completes.then (request) => + @lastMomentaryNote = request.response.note + + onMomentaryRelease: -> + return unless @lastMomentaryNote + @$.songEffects.body = {drop: @uri, note: @lastMomentaryNote} + @lastMomentaryNote = null + @$.songEffects.generateRequest() + \ No newline at end of file diff -r 7943daa149da -r 6059de6659c3 light9/web/effects/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/light9/web/effects/index.html Thu Jun 01 09:03:09 2017 +0000 @@ -0,0 +1,62 @@ + + + + subserver effects2 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7943daa149da -r 6059de6659c3 light9/web/index.html --- a/light9/web/index.html Thu Jun 01 08:39:20 2017 +0000 +++ b/light9/web/index.html Thu Jun 01 09:03:09 2017 +0000 @@ -1,11 +1,10 @@ - + light9 home - @@ -23,11 +22,14 @@ .left { display: inline-block; margin-right: 3px; + flex-grow: 1; + } + .window { }
{{name}} - + stats
@@ -52,14 +54,21 @@
+
+ +
+ + +
- + + + + + +
- - - -
diff -r 7943daa149da -r 6059de6659c3 makefile --- a/makefile Thu Jun 01 08:39:20 2017 +0000 +++ b/makefile Thu Jun 01 09:03:09 2017 +0000 @@ -107,7 +107,7 @@ effect_node_setup: create_virtualenv packages binexec install_python_deps coffee: - zsh -c 'coffee -cw light9/web/{.,live,timeline,paint}/*.coffee' + zsh -c 'coffee -cw light9/web/{.,live,timeline,paint,effects}/*.coffee' env-mypy/bin/mypy: mkdir -p env-mypy