Mercurial > code > home > repos > light9
changeset 1369:6b5e079b3dbe
timeline hover goes to vidref
Ignore-this: 2ef2fa1b7bdff1bd2755689889385ea2
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Tue, 07 Jun 2016 08:16:22 +0000 |
parents | e32eee849766 |
children | b246e25b0f25 |
files | bin/vidref light9/vidref/main.py light9/vidref/musictime.py light9/web/timeline-elements.html light9/web/timeline.coffee |
diffstat | 5 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/vidref Mon Jun 06 08:09:46 2016 +0000 +++ b/bin/vidref Tue Jun 07 08:16:22 2016 +0000 @@ -50,6 +50,16 @@ class SnapshotPic(cyclone.web.StaticFileHandler): pass + +class Time(cyclone.web.RequestHandler): + def put(self): + body = json.loads(self.request.body) + t = body['t'] + source = body['source'] + self.settings.gui.incomingTime(t, source) + self.set_status(202) + + graph = SyncedGraph(networking.rdfdb.url, "vidref") gui = Gui(graph) @@ -60,6 +70,7 @@ {'path': 'light9/vidref', 'default_filename': 'vidref.html'}), (r'/snapshot', Snapshot), (r'/snapshot/(.*)', SnapshotPic, {"path": snapshotDir()}), + (r'/time', Time), ], debug=True, gui=gui)) log.info("serving on %s" % port)
--- a/light9/vidref/main.py Mon Jun 06 08:09:46 2016 +0000 +++ b/light9/vidref/main.py Tue Jun 07 08:16:22 2016 +0000 @@ -106,3 +106,6 @@ it back to music player""" if not self.ignoreScaleChanges: self.musicTime.sendTime(scaleRange.get_value()) + + def incomingTime(self, t, source): + self.musicTime.lastHoverTime = t
--- a/light9/vidref/musictime.py Mon Jun 06 08:09:46 2016 +0000 +++ b/light9/vidref/musictime.py Tue Jun 07 08:16:22 2016 +0000 @@ -27,6 +27,7 @@ self.musicResource = restkit.Resource(networking.musicPlayer.url) self.position = {} + # driven by our pollCurvecalcTime and also by Gui.incomingTime self.lastHoverTime = None # None means "no recent value" self.pollMusicTime() self.pollCurvecalcTime() @@ -106,7 +107,8 @@ reactor.callLater(self.hoverPeriod, self.pollCurvecalcTime) def eb(err): - log.warn("talking to curveCalc: %s", err.getErrorMessage()) + if self.lastHoverTime: + log.warn("talking to curveCalc: %s", err.getErrorMessage()) self.lastHoverTime = None reactor.callLater(2, self.pollCurvecalcTime)
--- a/light9/web/timeline-elements.html Mon Jun 06 08:09:46 2016 +0000 +++ b/light9/web/timeline-elements.html Tue Jun 07 08:16:22 2016 +0000 @@ -1,6 +1,7 @@ <link rel="import" href="/lib/polymer/polymer.html"> <link rel="import" href="light9-timeline-audio.html"> <link rel="import" href="/lib/iron-resizable-behavior/iron-resizable-behavior.html"> +<link rel="import" href="/lib/iron-ajax/iron-ajax.html"> <link rel="import" href="rdfdb-synced-graph.html"> <link rel="import" href="light9-music.html"> @@ -42,6 +43,7 @@ <label><input type="checkbox"> follow player song choice</label> </div> <div>[[debug]]</div> + <iron-ajax id="vidrefTime" url="/vidref/time" method="PUT" content-type="application/json"></iron-ajax> <light9-timeline-audio id="audio" graph="{{graph}}" show="{{show}}"
--- a/light9/web/timeline.coffee Mon Jun 06 08:09:46 2016 +0000 +++ b/light9/web/timeline.coffee Tue Jun 07 08:16:22 2016 +0000 @@ -77,6 +77,12 @@ @$.dia.setMouse(@viewState.mouse.pos()) + now = Date.now() + if (!@$.vidrefLastSent? || @$.vidrefLastSent < now - 200) && !@songPlaying + @$.vidrefTime.body = {t: @latestMouseTime(), source: 'timeline'} + @$.vidrefTime.generateRequest() + @$.vidrefLastSent = now + latestMouseTime: -> @zoomInX.invert(@viewState.mouse.pos().e(1))