0001055: Pictures of the gallery are not used in the detailed ancestor's report when output format is PDF

svn: r8623
This commit is contained in:
Brian Matherly 2007-06-22 12:18:50 +00:00
parent a226819f70
commit 605d6a20ea
2 changed files with 27 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2007-06-22 Brian Matherly <brian@gramps-project.org>
* src/docgen/Pdfdoc.py: 0001055: Pictures of the gallery are not used in the
detailed ancestor's report when output format is PDF
2007-06-21 Alex Roitman <shura@gramps-project.org> 2007-06-21 Alex Roitman <shura@gramps-project.org>
* src/Editors/_EditFamily.py (EditFamily.__do_save): Disconnect * src/Editors/_EditFamily.py (EditFamily.__do_save): Disconnect
all signal handlers before committing data. all signal handlers before committing data.

View File

@ -35,6 +35,7 @@ from gettext import gettext as _
import BaseDoc import BaseDoc
from PluginUtils import register_text_doc, register_draw_doc, register_book_doc from PluginUtils import register_text_doc, register_draw_doc, register_book_doc
import Errors import Errors
from QuestionDialog import ErrorDialog
import ImgManip import ImgManip
import Mime import Mime
@ -99,6 +100,9 @@ if version_tuple < (2,0):
else: else:
enc = pass_through enc = pass_through
# Only announce PIL warning once per use of Gramps
_pil_warn = True
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# GrampsDocTemplate # GrampsDocTemplate
@ -336,14 +340,11 @@ class PdfDoc(BaseDoc.BaseDoc):
def add_media_object(self,name,pos,x_cm,y_cm): def add_media_object(self,name,pos,x_cm,y_cm):
try: try:
img = ImgManip.ImgManip(nname) img = ImgManip.ImgManip(name)
except: except:
return return
x,y = img.size() x,y = img.size()
if (x,y) == (0,0):
return
if (x,y) == (0,0): if (x,y) == (0,0):
return return
@ -357,7 +358,24 @@ class PdfDoc(BaseDoc.BaseDoc):
act_height = y_cm act_height = y_cm
act_width = x_cm/ratio act_width = x_cm/ratio
im = Image(str(name),act_width*cm,act_height*cm) try:
# Reportlab uses PIL to layout images. Make sure it is installed.
import PIL
except:
global _pil_warn
if _pil_warn:
ErrorDialog(
_("You do not have the Python Imaging Library installed "
"Images will not be added to this report"))
_pil_warn = False
return
try:
im = Image(str(name),act_width*cm,act_height*cm)
except:
ErrorDialog( _("Reportlab is unable to add this image: %s") % name )
return
if pos in ['left','right','center']: if pos in ['left','right','center']:
im.hAlign = pos.upper() im.hAlign = pos.upper()
else: else: