[pitivi] previewers: Remove unneeded AudioPreviewer.discovered
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] previewers: Remove unneeded AudioPreviewer.discovered
- Date: Sat, 29 Sep 2018 20:23:06 +0000 (UTC)
commit d5632a5e2bb72f2c3c1de7affb47c82aa3a9a7ce
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Wed Sep 19 01:01:39 2018 +0200
previewers: Remove unneeded AudioPreviewer.discovered
The `discovered` field was set to `True` only when the data was
available, so instead check directly `self.samples`.
pitivi/timeline/previewers.py | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index a8a532b3..a73e673a 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -965,7 +965,6 @@ class AudioPreviewer(Previewer, Zoomable, Loggable):
self.pipeline = None
self._wavebin = None
- self.discovered = False
self.ges_elem = ges_elem
self.samples = None
@@ -998,7 +997,7 @@ class AudioPreviewer(Previewer, Zoomable, Loggable):
if os.path.exists(filename):
with open(filename, "rb") as samples:
self.samples = list(numpy.load(samples))
- self._startRendering()
+ self.queue_draw()
else:
self.wavefile = filename
self._launchPipeline()
@@ -1035,14 +1034,10 @@ class AudioPreviewer(Previewer, Zoomable, Loggable):
self._wavebin.finalize(proxy=proxy)
self.samples = self._wavebin.samples
- def _startRendering(self):
- self.discovered = True
- self.queue_draw()
-
def _busMessageCb(self, bus, message):
if message.type == Gst.MessageType.EOS:
self._prepareSamples()
- self._startRendering()
+ self.queue_draw()
self.stop_generation()
elif message.type == Gst.MessageType.ERROR:
@@ -1081,7 +1076,8 @@ class AudioPreviewer(Previewer, Zoomable, Loggable):
# pylint: disable=arguments-differ
def do_draw(self, context):
- if not self.discovered:
+ if not self.samples:
+ # Nothing to draw.
return
clipped_rect = Gdk.cairo_get_clip_rectangle(context)[1]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]