diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 34f324f30..bb00d099c 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2006-04-04 Brian Matherly + * 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 * src/RelLib/_LdsOrd.py: lds status changes * src/Editors/_EditLdsOrd.py: lds status changes diff --git a/gramps2/src/ImgManip.py b/gramps2/src/ImgManip.py index 0534955b8..bf59fa0f4 100644 --- a/gramps2/src/ImgManip.py +++ b/gramps2/src/ImgManip.py @@ -76,20 +76,26 @@ class ImgManip: def fmt_data(self, cnv): fd, dest = tempfile.mkstemp() self.img.save(dest,cnv) - fh = open(dest) + fh = open(dest,mode='rb') data = fh.read() fh.close() - os.unlink(dest) + try: + os.unlink(dest) + except: + pass return data def fmt_scale_data(self, x, y, cnv): fd, dest = tempfile.mkstemp() scaled = self.img.scale_simple(x, y, gtk.gdk.INTERP_BILINEAR) - self.img.save(dest,cnv) - fh = open(dest) + scaled.save(dest,cnv) + fh = open(dest,mode='rb') data = fh.read() fh.close() - os.unlink(dest) + try: + os.unlink(dest) + except: + pass return data def jpg_thumbnail(self, dest, width, height): diff --git a/gramps2/src/docgen/ODFDoc.py b/gramps2/src/docgen/ODFDoc.py index eccb9f292..7add67729 100644 --- a/gramps2/src/docgen/ODFDoc.py +++ b/gramps2/src/docgen/ODFDoc.py @@ -450,23 +450,24 @@ class ODFDoc(BaseDoc.BaseDoc): if self.new_cell: self.cntnt.write('') if pos == "left": - self.cntnt.write('') + self.cntnt.write('\n') + self.cntnt.write('\n') if self.new_cell: self.cntnt.write('\n') @@ -534,7 +535,7 @@ class ODFDoc(BaseDoc.BaseDoc): for image in self.media_list: try: - ifile = open(image[0]) + ifile = open(image[0],mode='rb') base = os.path.basename(image[0]) self._add_zip(zfile,"Pictures/%s" % base, ifile.read(),t) ifile.close() diff --git a/gramps2/src/docgen/OpenOfficeDoc.py b/gramps2/src/docgen/OpenOfficeDoc.py index efbea5a75..dcb0aba04 100644 --- a/gramps2/src/docgen/OpenOfficeDoc.py +++ b/gramps2/src/docgen/OpenOfficeDoc.py @@ -495,7 +495,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): for image in self.media_list: try: - ifile = open(image[0]) + ifile = open(image[0],mode='rb') base = os.path.basename(image[0]) self._add_zip(zfile,"Pictures/%s" % base, ifile.read(),t) ifile.close()