Changeset - 3074f635ee23
[Not reviewed]
default
0 2 0
Drew Perttula - 11 years ago 2014-06-09 03:56:25
drewp@bigasterisk.com
effect page can write code edits back
Ignore-this: 756a3e3a40e4a6c823629e146d6c2799
2 files changed with 19 insertions and 3 deletions:
0 comments (0 inline, 0 general)
bin/effecteval
Show inline comments
 
@@ -97,7 +97,19 @@ class EffectUpdates(cyclone.websocket.We
 
    def messageReceived(self, message):
 
        log.info("got message %s" % message)
 
        # write a patch back to the graph
 
        
 

	
 
class Code(PrettyErrorHandler, cyclone.web.RequestHandler):
 
    def put(self):
 
        effect = URIRef(self.get_argument('uri'))
 
        code = Literal(self.get_argument('code'))
 
        with self.settings.graph.currentState(tripleFilter=(None, L9['effect'], effect)) as g:
 
            song = g.subjects(L9['effect'], effect).next()
 
        self.settings.graph.patchObject(
 
            context=song,
 
            subject=effect,
 
            predicate=L9['code'],
 
            newObject=code)
 
        self.send_error(202)
 
        
 
class EffectEval(PrettyErrorHandler, cyclone.web.RequestHandler):
 
    @inlineCallbacks
 
@@ -148,6 +160,7 @@ class App(object):
 
            (r'/effect\.js', StaticCoffee, {'src': 'light9/effecteval/effect.coffee'}),
 
            (r'/index\.js', StaticCoffee, {'src': 'light9/effecteval/index.coffee'}),
 
            (r'/effectUpdates', EffectUpdates),
 
            (r'/code', Code),
 
            (r'/songEffectsUpdates', SongEffectsUpdates),
 
            (r'/static/(.*)', SFH, {'path': 'static/'}),
 
            (r'/effect/eval', EffectEval),
light9/effecteval/effect.coffee
Show inline comments
 
@@ -3,14 +3,17 @@ model =
 
  uri: ko.observable(qs.value('uri'))
 
  code: ko.observable()
 
  
 
reconnectingWebSocket "ws://localhost:8070/effectUpdates" + window.location.search, (msg) ->
 
socket = reconnectingWebSocket "ws://localhost:8070/effectUpdates" + window.location.search, (msg) ->
 
  console.log('effectData ' + JSON.stringify(msg))
 
  # there's a shorter unpack thing
 
    
 
  model.code(msg.code)
 
  
 
writeBack = ko.computed ->
 
  console.log('sendback' ,{code: model.code()})
 
  $.ajax
 
    type: 'PUT'
 
    url: 'code'
 
    data: {uri: model.uri(), code: model.code()}
 
  
 
ko.applyBindings(model)
 
  
 
\ No newline at end of file
0 comments (0 inline, 0 general)