diff bin/inputdemo @ 1069:c756638275d6

quneo input demo. optimize curve display a little. Ignore-this: 4cf5b4b5853a94842c9fa8e2916bc6f4
author Drew Perttula <drewp@bigasterisk.com>
date Mon, 02 Jun 2014 07:04:40 +0000
parents c33158b367a5
children a38955ba6f40
line wrap: on
line diff
--- a/bin/inputdemo	Mon Jun 02 06:04:54 2014 +0000
+++ b/bin/inputdemo	Mon Jun 02 07:04:40 2014 +0000
@@ -12,6 +12,7 @@
 from light9.rdfdb import clientsession
 from light9.rdfdb.syncedgraph import SyncedGraph
 import cyclone.httpclient
+from light9.curvecalc.client import sendLiveInputPoint
 
 class App(object):
     def __init__(self):
@@ -49,20 +50,10 @@
         win.show_all()
 
     def onChanged(self, scale):
-        f = cyclone.httpclient.fetch(
-            networking.curveCalc.path('liveInputPoint'),
-            method='POST', timeout=1,
-            postdata=urllib.urlencode({
-                'curve': self.curve,
-                'value': str(scale.get_value()),
-            }))
-        @f.addCallback
-        def cb(result):
-            if result.code // 100 != 2:
-                log.error("curveCalc said %s: %s", result.code, result.body)
+        t1 = time.time()
+        d = sendLiveInputPoint(self.curve, scale.get_value())
+        @d.addCallback
+        def done(result):
             print "posted in %.1f ms" % (1000 * (time.time() - t1))
-        @f.addErrback
-        def eb(err):
-            print "err", err
 
 App()