[pitivi/ges: 102/287] Reimplementation of the previewing from the sourcelist.
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges: 102/287] Reimplementation of the previewing from the sourcelist.
- Date: Thu, 15 Mar 2012 16:34:24 +0000 (UTC)
commit c7d0b3f7476115379aa346c553f2e43c9b349372
Author: Mathieu Duponchelle <seeed laposte net>
Date: Fri Dec 23 01:46:08 2011 +0100
Reimplementation of the previewing from the sourcelist.
pitivi/ui/filechooserpreview.py | 11 +++++++++--
pitivi/ui/mainwindow.py | 21 ++++++++++++++++++---
pitivi/ui/sourcelist.py | 12 ++++++------
3 files changed, 33 insertions(+), 11 deletions(-)
---
diff --git a/pitivi/ui/filechooserpreview.py b/pitivi/ui/filechooserpreview.py
index e84dcec..3ded9a2 100644
--- a/pitivi/ui/filechooserpreview.py
+++ b/pitivi/ui/filechooserpreview.py
@@ -114,14 +114,14 @@ class PreviewWidget(gtk.VBox, Loggable):
self.bbox.pack_start(self.b_zoom_in, expand=False)
self.bbox.pack_start(self.b_zoom_out, expand=False)
self.bbox.show_all()
- self.pack_start(self.bbox, expand=False)
+ self.pack_start(self.bbox, expand=False, fill=False)
# Label for metadata tags
self.l_tags = gtk.Label()
self.l_tags.set_justify(gtk.JUSTIFY_LEFT)
self.l_tags.set_ellipsize(pango.ELLIPSIZE_END)
self.l_tags.show()
- self.pack_start(self.l_tags, expand=False)
+ self.pack_start(self.l_tags, expand=False, fill=False)
# Error handling
vbox = gtk.VBox()
@@ -134,11 +134,18 @@ class PreviewWidget(gtk.VBox, Loggable):
vbox.show()
self.pack_start(vbox, expand=False, fill=False)
+ def hide_unnecessary_widgets(self):
+ self.remove(self.l_tags)
+ self.set_child_packing(self.preview_video, True, True, 0, gtk.PACK_START)
+
def add_preview_request(self, dialogbox):
"""add a preview request """
uri = dialogbox.get_preview_uri()
if uri is None or not uri_is_valid(uri):
return
+ self.preview_uri(uri)
+
+ def preview_uri(self, uri):
self.log("Preview request for " + uri)
self.clear_preview()
self.current_selected_uri = uri
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 0111f68..19e412a 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -28,6 +28,7 @@ import os
import gtk
import gst
import ges
+import gobject
import webbrowser
from urllib import unquote
@@ -1072,9 +1073,23 @@ class PitiviMainWindow(gtk.Window, Loggable):
self._viewFactory(fact)
context.finish(True, False, ctime)
- def _viewFactory(self, factory):
- #GES crazyness... Implement
- pass
+ def _leavePreviewCb(self, window, unused):
+ window.destroy()
+
+ def _viewFactory(self, path):
+ preview_window = gtk.Window()
+ preview_window.set_transient_for(self)
+ preview_window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
+ preview_window.connect("focus-out-event", self._leavePreviewCb)
+ 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)
def _timelineSeekRelativeCb(self, unused_seeker, time):
try:
diff --git a/pitivi/ui/sourcelist.py b/pitivi/ui/sourcelist.py
index 60bce29..33f9d3c 100644
--- a/pitivi/ui/sourcelist.py
+++ b/pitivi/ui/sourcelist.py
@@ -120,6 +120,7 @@ class SourceList(gtk.VBox, Loggable):
self._errors = []
self._project = None
self._sources_to_add = []
+ self.dummy_selected = []
# Store
# icon, infotext, objectfactory, uri, length
@@ -784,10 +785,9 @@ class SourceList(gtk.VBox, Loggable):
model = self.storemodel
if len(paths) < 1:
return
- path = paths[0]
- factory = model[path][COL_FACTORY]
- self.debug("Let's play %s", factory.uri)
- self.emit('play', factory)
+ paths = paths[0]
+ self.debug("Let's play %s", model[paths][COL_URI])
+ self.emit('play', model[paths][COL_URI])
def _hideInfoBarClickedCb(self, unused_button):
self._resetErrorList()
@@ -967,8 +967,8 @@ class SourceList(gtk.VBox, Loggable):
self.selection_actions.set_sensitive(False)
def _rowActivatedCb(self, unused_treeview, path, unused_column):
- factory = self.storemodel[path][COL_FACTORY]
- self.emit('play', factory)
+ path = self.storemodel[path][COL_URI]
+ self.emit('play', path)
def _iconViewMotionNotifyEventCb(self, iconview, event):
if not self._dragButton:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]