[pitivi/ges: 104/287] ui: cleanup preview playback reimplementation
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges: 104/287] ui: cleanup preview playback reimplementation
- Date: Thu, 15 Mar 2012 16:34:34 +0000 (UTC)
commit 0b964491dd78b4929aae63832fdc8312bcbc5e77
Author: Thibault Saunier <thibault saunier collabora com>
Date: Sat Dec 24 10:51:55 2011 +0100
ui: cleanup preview playback reimplementation
pitivi/ui/filechooserpreview.py | 13 ++++++++++---
pitivi/ui/mainwindow.py | 17 +++++++----------
2 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/pitivi/ui/filechooserpreview.py b/pitivi/ui/filechooserpreview.py
index 3ded9a2..d1039ae 100644
--- a/pitivi/ui/filechooserpreview.py
+++ b/pitivi/ui/filechooserpreview.py
@@ -134,7 +134,7 @@ class PreviewWidget(gtk.VBox, Loggable):
vbox.show()
self.pack_start(vbox, expand=False, fill=False)
- def hide_unnecessary_widgets(self):
+ def setMinimal(self):
self.remove(self.l_tags)
self.set_child_packing(self.preview_video, True, True, 0, gtk.PACK_START)
@@ -143,9 +143,9 @@ class PreviewWidget(gtk.VBox, Loggable):
uri = dialogbox.get_preview_uri()
if uri is None or not uri_is_valid(uri):
return
- self.preview_uri(uri)
+ self.previewUri(uri)
- def preview_uri(self, uri):
+ def previewUri(self, uri):
self.log("Preview request for " + uri)
self.clear_preview()
self.current_selected_uri = uri
@@ -251,6 +251,13 @@ class PreviewWidget(gtk.VBox, Loggable):
self.l_error.show()
self.b_details.show()
+ def play(self):
+ self.player.set_state(gst.STATE_PLAYING)
+ self.is_playing = True
+ self.play_button.set_stock_id(gtk.STOCK_MEDIA_PAUSE)
+ #Make sure position is updated regularly
+ gobject.timeout_add(1000, self._update_position)
+
def clear_preview(self):
self.log("Reset PreviewWidget ")
self.seeker.set_value(0)
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 19e412a..bdacf78 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -524,8 +524,8 @@ class PitiviMainWindow(gtk.Window, Loggable):
self.settings.mainWindowShowMainToolbar = mtb.props.active
self.settings.mainWindowShowTimelineToolbar = ttb.props.active
- def _sourceListPlayCb(self, sourcelist, factory):
- self._viewFactory(factory)
+ def _sourceListPlayCb(self, sourcelist, uri):
+ self._viewUri(uri)
## Toolbar/Menu actions callback
@@ -1070,13 +1070,13 @@ class PitiviMainWindow(gtk.Window, Loggable):
except SourceListError:
from pitivi.factories.file import FileSourceFactory
fact = FileSourceFactory(uri)
- self._viewFactory(fact)
+ self._viewUri(fact)
context.finish(True, False, ctime)
def _leavePreviewCb(self, window, unused):
window.destroy()
- def _viewFactory(self, path):
+ def _viewUri(self, path):
preview_window = gtk.Window()
preview_window.set_transient_for(self)
preview_window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
@@ -1084,12 +1084,9 @@ class PitiviMainWindow(gtk.Window, Loggable):
previewer = PreviewWidget(self)
preview_window.add(previewer)
preview_window.show_all()
- previewer.hide_unnecessary_widgets()
- previewer.preview_uri(path)
- previewer.player.set_state(gst.STATE_PLAYING)
- previewer.is_playing = True
- previewer.play_button.set_stock_id(gtk.STOCK_MEDIA_PAUSE)
- gobject.timeout_add(1000, previewer._update_position)
+ previewer.setMinimal()
+ previewer.previewUri(path)
+ previewer.play()
def _timelineSeekRelativeCb(self, unused_seeker, time):
try:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]