[pitivi] Use the system's default image viewer to preview images from the media library
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Use the system's default image viewer to preview images from the media library
- Date: Thu, 31 Jan 2013 20:26:26 +0000 (UTC)
commit 1fcbbe6068e8d879f8c31b9981d14ff9a7c3ba62
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Thu Jan 31 15:01:25 2013 -0500
Use the system's default image viewer to preview images from the media library
The UX provided by dedicated image viewing apps will be better anyway.
pitivi/mainwindow.py | 14 ++++++++++++--
pitivi/medialibrary.py | 4 ++--
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 2133da0..5bbbfe4 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -605,8 +605,18 @@ class PitiviMainWindow(Gtk.Window, Loggable):
self.settings.mainWindowMainHPanePosition = self.mainhpaned.get_position()
self.settings.mainWindowVPanePosition = self.vpaned.get_position()
- def _mediaLibraryPlayCb(self, medialibrary, uri):
- self._viewUri(uri)
+ def _mediaLibraryPlayCb(self, medialibrary, asset):
+ """
+ If the media library item to preview is an image, show it in the user's
+ favorite image viewer. Else, preview the video/sound in Pitivi.
+ """
+ # Technically, our preview widget can show images, but it's never going
+ # to do a better job (sizing, zooming, metadata, editing, etc.)
+ # than the user's favorite image viewer.
+ if asset.is_image():
+ os.system('xdg-open "%s"' % path_from_uri(asset.get_id()))
+ else:
+ self._viewUri(asset.get_id())
def _projectChangedCb(self, project):
self.main_actions.get_action("SaveProject").set_sensitive(True)
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 803c621..4339666 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -880,8 +880,8 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
Space, Shift+Space, Return or Enter is pressed, preview the clip.
This method is the same for both iconview and treeview.
"""
- path = self.modelFilter[path][COL_URI]
- self.emit('play', path)
+ asset = self.modelFilter[path][COL_ASSET]
+ self.emit('play', asset)
def _iconViewButtonPressEventCb(self, iconview, event):
chain_up = True
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]