[pitivi: 5/10] viewer: add new method togglePlayback(), which also properly sets the play button icon
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Subject: [pitivi: 5/10] viewer: add new method togglePlayback(), which also properly sets the play button icon
- Date: Tue, 7 Apr 2009 16:27:56 -0400 (EDT)
commit 88c28577d096b343f28058edb2f86da753ec4978
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date: Mon Mar 30 13:24:08 2009 -0700
viewer: add new method togglePlayback(), which also properly sets the play button icon
---
pitivi/ui/viewer.py | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/pitivi/ui/viewer.py b/pitivi/ui/viewer.py
index 70743e0..9fdbdb6 100644
--- a/pitivi/ui/viewer.py
+++ b/pitivi/ui/viewer.py
@@ -99,6 +99,8 @@ class PitiviViewer(gtk.VBox, Loggable):
self._setUiActive(False)
# finally remove previous pipeline
self.pipeline = None
+ self.currentState = gst.STATE_PAUSED
+ self.playpause_button.setPause()
self._connectToPipeline(pipeline)
self.pipeline = pipeline
if self.pipeline is not None:
@@ -400,13 +402,7 @@ class PitiviViewer(gtk.VBox, Loggable):
self.back()
def _playButtonCb(self, unused_button, isplaying):
- if self.pipeline is None:
- return
-
- if isplaying:
- self.pause()
- else:
- self.play()
+ self.togglePlayback()
def _nextCb(self, unused_button):
self.next()
@@ -419,10 +415,21 @@ class PitiviViewer(gtk.VBox, Loggable):
def play(self):
if not self.pipeline.play() == gst.STATE_CHANGE_FAILURE:
self.currentState = gst.STATE_PLAYING
+ self.playpause_button.setPause()
def pause(self):
if not self.pipeline.pause() == gst.STATE_CHANGE_FAILURE:
self.currentState = gst.STATE_PAUSED
+ self.playpause_button.setPlay()
+
+ def togglePlayback(self):
+ if self.pipeline is None:
+ return
+
+ if self.currentState == gst.STATE_PLAYING:
+ self.pause()
+ else:
+ self.play()
def rewind(self):
raise NotImplementedError
@@ -500,10 +507,6 @@ class PlayPauseButton(gtk.Button, Loggable):
gtk.Button.set_sensitive(self, value)
def _clickedCb(self, unused):
- if not self.playing:
- self.setPause()
- else:
- self.setPlay()
self.emit("play", self.playing)
def setPlay(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]