* src/ReportUtils.py (insert_images): Warn about non existing files

svn: r5153
This commit is contained in:
Martin Hawlisch 2005-08-31 08:57:49 +00:00
parent 8c2906ef6e
commit f8f6f500ef
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,6 @@
2005-08-31 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/ReportUtils.py (insert_images): Warn about non existing files
2005-08-30 Alex Roitman <shura@gramps-project.org>
* src/po/ru.po: Translation update for 2.0.7.

View File

@ -30,7 +30,9 @@ import Date
import DateHandler
import RelLib
from NameDisplay import displayer as _nd
from QuestionDialog import WarningDialog
import time
import os
from gettext import gettext as _
#-------------------------------------------------------------------------
@ -486,7 +488,11 @@ def insert_images(database, doc, person, w_cm=4.0, h_cm=4.0):
mime_type = media_object.get_mime_type()
if mime_type and mime_type.startswith("image"):
filename = media_object.get_path()
doc.add_media_object(filename,"row",w_cm,h_cm)
if os.path.exists(filename):
doc.add_media_object(filename,"row",w_cm,h_cm)
else:
WarningDialog(_("Could not add photo to page"),
"%s: %s" % (filename, _('File does not exist')))
#-------------------------------------------------------------------------
#