Files
@ 1aa91a31c0e2
Branch filter:
Location: light9/bin/inputdemo - annotation
1aa91a31c0e2
2.1 KiB
text/plain
reformat some missed files
Ignore-this: f13152975437adeb48ed619ab676365e
Ignore-this: f13152975437adeb48ed619ab676365e
0f51a1a5785e 0f51a1a5785e 7772cc48e016 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e f066d6e874db 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e f140153c087c 6fa4288da8a6 0f51a1a5785e c756638275d6 0f51a1a5785e 7772cc48e016 0f51a1a5785e 7772cc48e016 0f51a1a5785e 0f51a1a5785e c33158b367a5 7772cc48e016 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e a38955ba6f40 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 7772cc48e016 7772cc48e016 7772cc48e016 f066d6e874db 7772cc48e016 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 7772cc48e016 7772cc48e016 7772cc48e016 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e 0f51a1a5785e c756638275d6 c756638275d6 7772cc48e016 c756638275d6 c756638275d6 f066d6e874db 0f51a1a5785e 7772cc48e016 0f51a1a5785e | #!bin/python
import sys
sys.path.append('/usr/lib/python2.7/dist-packages') # For gtk
from twisted.internet import gtk3reactor
gtk3reactor.install()
from twisted.internet import reactor
from rdflib import URIRef
import optparse, logging, urllib.request, urllib.parse, urllib.error, time
from gi.repository import Gtk
from run_local import log
from light9 import showconfig, networking
from light9 import clientsession
from rdfdb.syncedgraph import SyncedGraph
import cyclone.httpclient
from light9.curvecalc.client import sendLiveInputPoint
class App(object):
def __init__(self):
parser = optparse.OptionParser()
parser.set_usage("%prog [opts] [curve uri]")
parser.add_option("--debug", action="store_true", help="log at DEBUG")
clientsession.add_option(parser)
opts, args = parser.parse_args()
log.setLevel(logging.DEBUG if opts.debug else logging.INFO)
self.session = clientsession.getUri('inputdemo', opts)
self.graph = SyncedGraph(networking.rdfdb.url, "inputdemo")
self.graph.initiallySynced.addCallback(lambda _: self.launch())
self.curve = args[0] if args else URIRef(
'http://light9.bigasterisk.com/show/dance2014/song1/curve/c-1401259747.675542'
)
print("sending points on curve %s" % self.curve)
reactor.run()
def launch(self):
win = Gtk.Window()
slider = Gtk.Scale.new_with_range(orientation=Gtk.Orientation.VERTICAL,
min=0,
max=1,
step=.001)
slider.props.inverted = True
slider.connect('value-changed', self.onChanged)
win.add(slider)
win.parse_geometry('50x250')
win.connect("delete-event", lambda *a: reactor.crash())
win.connect("destroy", lambda *a: reactor.crash())
win.show_all()
def onChanged(self, scale):
t1 = time.time()
d = sendLiveInputPoint(self.curve, scale.get_value())
@d.addCallback
def done(result):
print("posted in %.1f ms" % (1000 * (time.time() - t1)))
App()
|