diff --git a/bin/vidref b/bin/vidref --- a/bin/vidref +++ b/bin/vidref @@ -18,7 +18,9 @@ parser.add_option("-v", "--verbose", act logging.basicConfig() log = logging.getLogger() -log.setLevel(logging.DEBUG if options.verbose else logging.INFO) +log.setLevel(logging.DEBUG) +# limit the stdout one, but leave debug messages for the gtk logger +log.handlers[0].setLevel(logging.DEBUG if options.verbose else logging.WARN) logging.getLogger("restkit.client").setLevel(logging.WARN) diff --git a/light9/vidref/main.py b/light9/vidref/main.py --- a/light9/vidref/main.py +++ b/light9/vidref/main.py @@ -139,7 +139,7 @@ class VideoRecordSink(gst.Element): img.save(outFilename) now = time.time() - log.debug("wrote %s delay of %.2fms, took %.2fms", + log.info("wrote %s delay of %.2fms, took %.2fms", outFilename, (now - self.lastTime) * 1000, (now - t1) * 1000) @@ -159,8 +159,9 @@ class Main(object): self.recordingTo = wtree.get_object('recordingTo') self.musicScale = wtree.get_object("musicScale") - self.musicScale.connect("value-changed", - lambda r: self.musicTime.sendTime(r.get_value())) + self.musicScale.connect("value-changed", self.onMusicScaleValue) + self.ignoreScaleChanges = False + self.attachLog(wtree.get_object("lastLog")) # wtree.get_object("replayPanel").show() # demo only rp = wtree.get_object("replayVbox") @@ -173,6 +174,16 @@ class Main(object): gobject.timeout_add(1000 // framerate, self.updateLoop) + def attachLog(self, textBuffer): + """write log lines to this gtk buffer""" + class ToBuffer(logging.Handler): + def emit(self, record): + textBuffer.set_text(record.getMessage()) + + h = ToBuffer() + h.setLevel(logging.INFO) + log.addHandler(h) + def updateLoop(self): position = self.musicTime.getLatest() try: @@ -241,5 +252,15 @@ class Main(object): print widget.get_value() def onMusicTimeChange(self, position): - self.musicScale.set_range(0, position['duration']) - self.musicScale.set_value(position['t']) + self.ignoreScaleChanges = True + try: + self.musicScale.set_range(0, position['duration']) + self.musicScale.set_value(position['t']) + finally: + self.ignoreScaleChanges = False + + def onMusicScaleValue(self, scaleRange): + """the scale position has changed. if it was by the user, send + it back to music player""" + if not self.ignoreScaleChanges: + self.musicTime.sendTime(scaleRange.get_value()) diff --git a/light9/vidref/vidref.glade b/light9/vidref/vidref.glade --- a/light9/vidref/vidref.glade +++ b/light9/vidref/vidref.glade @@ -164,7 +164,29 @@ to: - + + True + 0 + none + + + True + True + char + lastLog + + + + + True + <b>Last log</b> + True + + + + + 4 + @@ -385,4 +407,5 @@ to: /home/drewp/light9-vidref/play-light9.bigasterisk.com_show_dance2010_song6/1276582699 +