From 11b833f7191c5221768abbc1080c233fac3bd8f2 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Wed, 11 Oct 2006 19:40:08 +0000 Subject: [PATCH] * src/plugins/IndivComplete.py (write_person): Catch missing image files. svn: r7397 --- ChangeLog | 4 ++++ src/plugins/IndivComplete.py | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index dec4ac284..d4c80d5f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-10-11 Martin Hawlisch + * src/plugins/IndivComplete.py (write_person): Catch missing image + files. + 2006-10-11 Alex Roitman * src/GrampsDisplay.py (help): Rename gramps-manual to gramps. diff --git a/src/plugins/IndivComplete.py b/src/plugins/IndivComplete.py index 1ce3db1b7..1b5ee8b4b 100644 --- a/src/plugins/IndivComplete.py +++ b/src/plugins/IndivComplete.py @@ -50,6 +50,7 @@ from PluginUtils import register_report from ReportBase import Report, ReportUtils, ReportOptions, \ CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI from NameDisplay import displayer as _nd +from QuestionDialog import WarningDialog #------------------------------------------------------------------------ # @@ -428,10 +429,14 @@ class IndivCompleteReport(Report): object = self.database.get_object_from_handle(object_handle) mime_type = object.get_mime_type() if mime_type and mime_type.startswith("image"): - file = object.get_path() - self.doc.start_paragraph("IDS-Normal") - self.doc.add_media_object(file,"row",4.0,4.0) - self.doc.end_paragraph() + filename = object.get_path() + if os.path.exists(filename): + self.doc.start_paragraph("IDS-Normal") + self.doc.add_media_object(filename,"row",4.0,4.0) + self.doc.end_paragraph() + else: + WarningDialog(_("Could not add photo to page"), + "%s: %s" % (filename, _('File does not exist'))) self.doc.start_table("one","IDS-IndTable")