From 216a5d6e0a703e50923cc51db5519811365da161 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Tue, 1 Dec 2009 02:56:03 +0000 Subject: [PATCH] 3376: RFE: please add 'Open directory' to context menu of media objects svn: r13693 --- src/DisplayTabs/_GalleryTab.py | 10 +++++++++- src/plugins/view/mediaview.py | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/DisplayTabs/_GalleryTab.py b/src/DisplayTabs/_GalleryTab.py index c6d7e2b0c..dcf106110 100644 --- a/src/DisplayTabs/_GalleryTab.py +++ b/src/DisplayTabs/_GalleryTab.py @@ -128,10 +128,18 @@ class GalleryTab(ButtonTab, DbGUIElement): ref_obj = self.dbstate.db.get_object_from_handle(obj.ref) media_path = Utils.media_path_full(self.dbstate.db, ref_obj.get_path()) if media_path: - item = gtk.MenuItem(_('View')) + item = gtk.ImageMenuItem(_('View')) + img = gtk.Image() + img.set_from_stock("gramps-viewmedia", gtk.ICON_SIZE_MENU) + item.set_image(img) item.connect('activate', make_launcher(media_path)) item.show() menu.append(item) + mfolder, mfile = os.path.split(media_path) + item = gtk.MenuItem(_('Open Containing _Folder')) + item.connect('activate', make_launcher(mfolder)) + item.show() + menu.append(item) item = gtk.SeparatorMenuItem() item.show() menu.append(item) diff --git a/src/plugins/view/mediaview.py b/src/plugins/view/mediaview.py index cef7bcac1..b1e21cc4e 100644 --- a/src/plugins/view/mediaview.py +++ b/src/plugins/view/mediaview.py @@ -221,6 +221,10 @@ class MediaView(ListView): self._add_action('OpenMedia', 'gramps-viewmedia', _('View'), tip=_("View in the default viewer"), callback=self.view_media) + self._add_action('OpenContainingFolder', None, + _('Open Containing _Folder'), + tip=_("Open the folder containing the media file"), + callback=self.open_containing_folder) def view_media(self, obj): """ @@ -231,6 +235,17 @@ class MediaView(ListView): mpath = Utils.media_path_full(self.dbstate.db, ref_obj.get_path()) open_file_with_default_application(mpath) + def open_containing_folder(self, obj): + """ + Launch external viewers for the selected objects. + """ + for handle in self.selected_handles(): + ref_obj = self.dbstate.db.get_object_from_handle(handle) + mpath = Utils.media_path_full(self.dbstate.db, ref_obj.get_path()) + if mpath: + mfolder, mfile = os.path.split(mpath) + open_file_with_default_application(mfolder) + def _column_editor(self, obj): """ Start the column editor dialog @@ -351,9 +366,11 @@ class MediaView(ListView): + + + - '''