Files
@ f066d6e874db
Branch filter:
Location: light9/bin/inputdemo - annotation
f066d6e874db
2.1 KiB
text/plain
2to3 with these fixers: all idioms set_literal
Ignore-this: cbd28518218c2f0ddce8c4f92d3b8b33
Ignore-this: cbd28518218c2f0ddce8c4f92d3b8b33
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()
|