Fix image handling problems for reports.
svn: r6269
This commit is contained in:
parent
050c4e3f08
commit
ed211a6aab
@ -1,3 +1,8 @@
|
|||||||
|
2006-04-04 Brian Matherly <pez4brian@users.sourceforge.net>
|
||||||
|
* src/_ImgManip.py: open images as binary
|
||||||
|
* src/docgen/ODFDoc.py: open images as binary, fix image embedding
|
||||||
|
* src/docgen/OpenOfficeDoc.py: open images as binary
|
||||||
|
|
||||||
2006-04-04 Don Allingham <don@gramps-project.org>
|
2006-04-04 Don Allingham <don@gramps-project.org>
|
||||||
* src/RelLib/_LdsOrd.py: lds status changes
|
* src/RelLib/_LdsOrd.py: lds status changes
|
||||||
* src/Editors/_EditLdsOrd.py: lds status changes
|
* src/Editors/_EditLdsOrd.py: lds status changes
|
||||||
|
@ -76,20 +76,26 @@ class ImgManip:
|
|||||||
def fmt_data(self, cnv):
|
def fmt_data(self, cnv):
|
||||||
fd, dest = tempfile.mkstemp()
|
fd, dest = tempfile.mkstemp()
|
||||||
self.img.save(dest,cnv)
|
self.img.save(dest,cnv)
|
||||||
fh = open(dest)
|
fh = open(dest,mode='rb')
|
||||||
data = fh.read()
|
data = fh.read()
|
||||||
fh.close()
|
fh.close()
|
||||||
os.unlink(dest)
|
try:
|
||||||
|
os.unlink(dest)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def fmt_scale_data(self, x, y, cnv):
|
def fmt_scale_data(self, x, y, cnv):
|
||||||
fd, dest = tempfile.mkstemp()
|
fd, dest = tempfile.mkstemp()
|
||||||
scaled = self.img.scale_simple(x, y, gtk.gdk.INTERP_BILINEAR)
|
scaled = self.img.scale_simple(x, y, gtk.gdk.INTERP_BILINEAR)
|
||||||
self.img.save(dest,cnv)
|
scaled.save(dest,cnv)
|
||||||
fh = open(dest)
|
fh = open(dest,mode='rb')
|
||||||
data = fh.read()
|
data = fh.read()
|
||||||
fh.close()
|
fh.close()
|
||||||
os.unlink(dest)
|
try:
|
||||||
|
os.unlink(dest)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def jpg_thumbnail(self, dest, width, height):
|
def jpg_thumbnail(self, dest, width, height):
|
||||||
|
@ -450,23 +450,24 @@ class ODFDoc(BaseDoc.BaseDoc):
|
|||||||
if self.new_cell:
|
if self.new_cell:
|
||||||
self.cntnt.write('<text:p>')
|
self.cntnt.write('<text:p>')
|
||||||
if pos == "left":
|
if pos == "left":
|
||||||
self.cntnt.write('<draw:image draw:style-name="Left" ')
|
self.cntnt.write('<draw:frame draw:style-name="Left" ')
|
||||||
elif pos == "right":
|
elif pos == "right":
|
||||||
self.cntnt.write('<draw:image draw:style-name="Right" ')
|
self.cntnt.write('<draw:frame draw:style-name="Right" ')
|
||||||
elif pos == "single":
|
elif pos == "single":
|
||||||
self.cntnt.write('<draw:image draw:style-name="Single" ')
|
self.cntnt.write('<draw:frame draw:style-name="Single" ')
|
||||||
else:
|
else:
|
||||||
self.cntnt.write('<draw:image draw:style-name="Row" ')
|
self.cntnt.write('<draw:frame draw:style-name="Row" ')
|
||||||
|
|
||||||
self.cntnt.write('draw:name="%s" ' % tag)
|
self.cntnt.write('draw:name="%s" ' % tag)
|
||||||
self.cntnt.write('text:anchor-type="paragraph" ')
|
self.cntnt.write('text:anchor-type="paragraph" ')
|
||||||
self.cntnt.write('svg:width="%.2fcm" ' % act_width)
|
self.cntnt.write('svg:width="%.2fcm" ' % act_width)
|
||||||
self.cntnt.write('svg:height="%.2fcm" ' % act_height)
|
self.cntnt.write('svg:height="%.2fcm" ' % act_height)
|
||||||
self.cntnt.write('draw:z-index="0" ')
|
self.cntnt.write('draw:z-index="0" >')
|
||||||
self.cntnt.write('xlink:href="#Pictures/')
|
self.cntnt.write('<draw:image xlink:href="Pictures/')
|
||||||
self.cntnt.write(base)
|
self.cntnt.write(base)
|
||||||
self.cntnt.write('" xlink:type="simple" xlink:show="embed" ')
|
self.cntnt.write('" xlink:type="simple" xlink:show="embed" ')
|
||||||
self.cntnt.write('xlink:actuate="onLoad"/>\n')
|
self.cntnt.write('xlink:actuate="onLoad"/>\n')
|
||||||
|
self.cntnt.write('</draw:frame>\n')
|
||||||
if self.new_cell:
|
if self.new_cell:
|
||||||
self.cntnt.write('</text:p>\n')
|
self.cntnt.write('</text:p>\n')
|
||||||
|
|
||||||
@ -534,7 +535,7 @@ class ODFDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
for image in self.media_list:
|
for image in self.media_list:
|
||||||
try:
|
try:
|
||||||
ifile = open(image[0])
|
ifile = open(image[0],mode='rb')
|
||||||
base = os.path.basename(image[0])
|
base = os.path.basename(image[0])
|
||||||
self._add_zip(zfile,"Pictures/%s" % base, ifile.read(),t)
|
self._add_zip(zfile,"Pictures/%s" % base, ifile.read(),t)
|
||||||
ifile.close()
|
ifile.close()
|
||||||
|
@ -495,7 +495,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
for image in self.media_list:
|
for image in self.media_list:
|
||||||
try:
|
try:
|
||||||
ifile = open(image[0])
|
ifile = open(image[0],mode='rb')
|
||||||
base = os.path.basename(image[0])
|
base = os.path.basename(image[0])
|
||||||
self._add_zip(zfile,"Pictures/%s" % base, ifile.read(),t)
|
self._add_zip(zfile,"Pictures/%s" % base, ifile.read(),t)
|
||||||
ifile.close()
|
ifile.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user