From 5870c5b1c2c3c216fa330d7f13f7249168d7527c Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 20 Oct 2001 15:14:47 +0000 Subject: [PATCH] Fixed several reports due to the changes in media objects svn: r502 --- gramps/src/plugins/IndivSummary.py | 10 ++++++---- gramps/src/plugins/Summary.py | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/gramps/src/plugins/IndivSummary.py b/gramps/src/plugins/IndivSummary.py index dcfc52f84..0289c99b6 100644 --- a/gramps/src/plugins/IndivSummary.py +++ b/gramps/src/plugins/IndivSummary.py @@ -218,10 +218,12 @@ class IndivSummary: self.d.end_paragraph() if len(photo_list) > 0: - file = photo_list[0].getPath() - self.d.start_paragraph("Normal") - self.d.add_photo(file,4.0,4.0) - self.d.end_paragraph() + object = photo_list[0].getReference() + if object.getMimeType()[0:5] == "image": + file = object.getPath() + self.d.start_paragraph("Normal") + self.d.add_photo(file,4.0,4.0) + self.d.end_paragraph() self.d.start_table("one","IndTable") diff --git a/gramps/src/plugins/Summary.py b/gramps/src/plugins/Summary.py index 67f736f08..29cbc1964 100644 --- a/gramps/src/plugins/Summary.py +++ b/gramps/src/plugins/Summary.py @@ -63,13 +63,15 @@ def report(database,person): bytes = 0 namelist = [] + pobjects = len(database.getObjectMap().values()) + for photo in database.getObjectMap().values(): + bytes = bytes + posixpath.getsize(photo.getPath()) + for person in personList: length = len(person.getPhotoList()) if length > 0: with_photos = with_photos + 1 total_photos = total_photos + length - for file in person.getPhotoList(): - bytes = bytes + posixpath.getsize(file.getPath()) name = person.getPrimaryName() if name.getFirstName() == "" or name.getSurname() == "": @@ -93,16 +95,17 @@ def report(database,person): text = text + "%s : %d\n" % (_("Individuals with incomplete names"),incomp_names) text = text + "%s : %d\n" % (_("Individuals missing birth dates"),missing_bday) text = text + "%s : %d\n" % (_("Disconnected individuals"),disconnected) - text = text + "\n%s\n" % _("Images and files") - text = text + "----------------------------\n" - text = text + "%s : %d\n" % (_("Individuals with images"),with_photos) - text = text + "%s : %d\n" % (_("Total number of images"),total_photos) - text = text + "%s : %d %s\n" % (_("Total size of images"),bytes,\ - _("bytes")) text = text + "\n%s\n" % _("Family Information") text = text + "----------------------------\n" text = text + "%s : %d\n" % (_("Number of families"),len(familyList)) text = text + "%s : %d\n" % (_("Unique surnames"),len(namelist)) + text = text + "\n%s\n" % _("Media Objects") + text = text + "----------------------------\n" + text = text + "%s : %d\n" % (_("Individuals with media objects"),with_photos) + text = text + "%s : %d\n" % (_("Total number of media object references"),total_photos) + text = text + "%s : %d\n" % (_("Number of unique media objects"),pobjects) + text = text + "%s : %d %s\n" % (_("Total size of images"),bytes,\ + _("bytes")) top = topDialog.get_widget("summary")