From 04ae65d941e69456afda5f7e610cc930953366de Mon Sep 17 00:00:00 2001 From: "Rob G. Healey" Date: Fri, 1 Apr 2011 05:22:23 +0000 Subject: [PATCH] Nick Hall and I were working on the same thing, and his version is much better. I am reverting rev17002, so that there will be room to his copy once he is ready to commit it. svn: r17011 --- po/POTFILES.in | 1 - src/plugins/gramplet/Makefile.am | 1 - src/plugins/gramplet/MediaReferences.py | 140 ------------------------ src/plugins/gramplet/bottombar.gpr.py | 15 --- src/plugins/view/mediaview.py | 3 +- 5 files changed, 1 insertion(+), 159 deletions(-) delete mode 100644 src/plugins/gramplet/MediaReferences.py diff --git a/po/POTFILES.in b/po/POTFILES.in index ec6ab2128..9b3db0fed 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -265,7 +265,6 @@ src/plugins/gramplet/CalendarGramplet.py src/plugins/gramplet/Children.py src/plugins/gramplet/DescendGramplet.py src/plugins/gramplet/Exif.py -src/plugins/gramplet/MediaReferences.py src/plugins/gramplet/FanChartGramplet.py src/plugins/gramplet/FaqGramplet.py src/plugins/gramplet/GivenNameGramplet.py diff --git a/src/plugins/gramplet/Makefile.am b/src/plugins/gramplet/Makefile.am index 5d7572d7d..e9661f9f6 100644 --- a/src/plugins/gramplet/Makefile.am +++ b/src/plugins/gramplet/Makefile.am @@ -21,7 +21,6 @@ pkgdata_PYTHON = \ GivenNameGramplet.py \ gramplet.gpr.py \ MediaPreview.py \ - MediaReferences.py \ Notes.py \ PedigreeGramplet.py \ PersonDetails.py \ diff --git a/src/plugins/gramplet/MediaReferences.py b/src/plugins/gramplet/MediaReferences.py deleted file mode 100644 index e77d75f4c..000000000 --- a/src/plugins/gramplet/MediaReferences.py +++ /dev/null @@ -1,140 +0,0 @@ -# Gramps - a GTK+/GNOME based genealogy program -# -# Copyright (C) 2011 Rob G. Healey -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# $Id$ -# - -from gen.plug import Gramplet -from ListModel import ListModel, NOSORT -from gen.ggettext import gettext as _ - -import Utils -import gtk -from gen.display.name import displayer as _nd -from DateHandler import displayer as _dd - -class MediaReferences(Gramplet): - """ - Displays the Media Back References for this media object... - """ - def init(self): - - self.gui.WIDGET = self.build_gui() - self.gui.get_container_widget().remove(self.gui.textview) - self.gui.get_container_widget().add_with_viewport(self.gui.WIDGET) - self.gui.WIDGET.show() - - self.connect_signal('Media', self.update) - - def build_gui(self): - """ - Build the GUI interface. - """ - top = gtk.TreeView() - titles = [(_('Object'), 1, 100), - (_('Title'), 2, 250), - (_("Gramps ID"), 3, 90)] - self.model = ListModel(top, titles) - return top - - def db_changed(self): - self.dbstate.db.connect('media-update', self.update) - self.dbstate.db.connect("media-rebuild", self.update) - self.update() - - def main(self): - - active_handle = self.get_active('Media') - if not active_handle: - return - - media = self.dbstate.db.get_object_from_handle(active_handle) - if not media: - return - - self.model.clear() - self.__display_media_references(media) - - def __display_media_references(self, media): - """ - Load the primary image if it exists. - """ - db = self.dbstate.db - - handles = db.find_backlink_handles(media.get_handle(), - include_classes = ["Person", "Family", "Event", "Place", "Source"]) - - for (classname, handle) in handles: - obj_ = False - title = False - - # Person link - if classname == "Person": - person = db.get_person_from_handle(handle) - if person: - person_name = _nd.display(person) - gid = person.get_gramps_id() - self.model.add((classname, person_name, gid)) - - # Family link - elif classname == "Family": - husband = False - spouse = False - family = db.get_family_from_handle(handle) - if family: - gid = family.get_gramps_id() - - husband_handle = family.get_father_handle() - spouse_handle = family.get_mother_handle() - husband = db.get_person_from_handle(husband_handle) - spouse = db.get_person_from_handle(spouse_handle) - if husband: - husband_name = _nd.display(husband) - if spouse: - spouse_name = _nd.display(spouse) - - if husband and spouse: - self.model.add((classname, husband_name + " + ", gid)) - self.model.add(("", spouse_name, "", "")) - - elif husband: - self.model.add((classname, husband_name, gid)) - - elif spouse: - self.model.add((classname, spouse_name, gid)) - - # Event link - elif classname == "Event": - event = db.get_event_from_handle(handle) - if event: - gid = event.get_gramps_id() - self.model.add((classname, str(event.get_type()), gid)) - - # Place link - elif classname == "Place": - place = db.get_place_from_handle(handle) - if place: - gid = place.get_gramps_id() - self.model.add((classname, place.get_title(), gid)) - - # Source link - elif classname == "Source": - source = db.get_source_from_handle(handle) - if source: - gid = source.get_gramps_id() - self.model.add((classname, source.get_title(), gid)) diff --git a/src/plugins/gramplet/bottombar.gpr.py b/src/plugins/gramplet/bottombar.gpr.py index 3c285125a..33eacc5c2 100644 --- a/src/plugins/gramplet/bottombar.gpr.py +++ b/src/plugins/gramplet/bottombar.gpr.py @@ -92,21 +92,6 @@ register(GRAMPLET, authors_email = ["robhealey1@gmail.com"], ) -register(GRAMPLET, - id = "Media References Gramplet", - name = _("Media References Gramplet"), - description = _("Gramplet showing all of the references to this media object"), - version = "1.0.0", - gramps_target_version = "3.3.0", - status = STABLE, - fname = "MediaReferences.py", - height = 200, - gramplet = "MediaReferences", - gramplet_title = _("References"), - authors = ["Rob G. Healey"], - authors_email = ["robhealey1@gmail.com"], - ) - register(GRAMPLET, id="Person Residence Gramplet", name=_("Person Residence Gramplet"), diff --git a/src/plugins/view/mediaview.py b/src/plugins/view/mediaview.py index 3d8d8775e..56ebb7221 100644 --- a/src/plugins/view/mediaview.py +++ b/src/plugins/view/mediaview.py @@ -440,5 +440,4 @@ class MediaView(ListView): "Exif Viewer Gramplet", "Media Sources Gramplet", "Media Notes Gramplet", - "Media Attributes Gramplet", - "Media References Gramplet")) + "Media Attributes Gramplet"))