[pitivi/ges: 250/287] Simplify changing the timeline UI's state
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges: 250/287] Simplify changing the timeline UI's state
- Date: Thu, 15 Mar 2012 16:46:51 +0000 (UTC)
commit 1b6007a133f38d860b78e749e6faf30a026f2a57
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Thu Feb 9 16:15:27 2012 -0500
Simplify changing the timeline UI's state
This removes some redundant methods.
pitivi/mainwindow.py | 15 ++++++++-------
pitivi/timeline/timeline.py | 7 ++-----
2 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 6ebd5ab..0bead75 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -1023,9 +1023,6 @@ class PitiviMainWindow(gtk.Window, Loggable):
project_pipeline = property(getProjectPipeline, setProjectPipeline, None, "The Gst.Pipeline of the project")
- def _timelinePipelineStateChanged(self, unused_pipeline, state):
- self.timeline_ui.stateChanged(state)
-
## Project Timeline (not to be confused with UI timeline)
def _timelineDurationChangedCb(self, timeline, unused_duration):
@@ -1042,19 +1039,23 @@ class PitiviMainWindow(gtk.Window, Loggable):
self.render_button.set_sensitive(sensitive)
#Pipeline messages
+
def _busMessageCb(self, unused_bus, message):
+ """
+ The pipeline has sent us a message. It could be that it reached the end
+ of the stream or that the pipeline state changed (ex: playback started
+ or stopped). In that case, tell the timeline UI about the new state.
+ """
if message.type == gst.MESSAGE_EOS:
self.warning("eos")
elif message.type == gst.MESSAGE_STATE_CHANGED:
prev, new, pending = message.parse_state_changed()
-
if message.src == self._project_pipeline:
self.debug("Pipeline change state prev:%r, new:%r, pending:%r", prev, new, pending)
-
state_change = pending == gst.STATE_VOID_PENDING
-
if state_change:
- self._timelinePipelineStateChanged(self, new)
+ self.timeline_ui.pipeline_state = new
+
## other
def _showSaveAsDialog(self, project):
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 0ea11f2..6e48389 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -561,7 +561,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
self._factories = None
self._finish_drag = False
self._position = 0
- self._state = gst.STATE_NULL
+ self.pipeline_state = gst.STATE_NULL
self._createUI()
self.rate = gst.Fraction(1, 1)
self._project = None
@@ -1062,12 +1062,9 @@ class Timeline(gtk.Table, Loggable, Zoomable):
self._position = position
self.ruler.timelinePositionChanged(position)
self._canvas.timelinePositionChanged(position)
- if self._state == gst.STATE_PLAYING:
+ if self.pipeline_state == gst.STATE_PLAYING:
self.scrollToPlayhead()
- def stateChanged(self, state):
- self._state = state
-
def scrollToPlayhead(self):
"""
If the current position is out of the view bouds, then scroll
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]