diff --git a/src/AbiWordDoc.py b/src/AbiWordDoc.py index e904b1f4e..2c1234e04 100644 --- a/src/AbiWordDoc.py +++ b/src/AbiWordDoc.py @@ -19,12 +19,12 @@ # import os -import tempfile +import base64 from TextDoc import * from latin_utf8 import latin_to_utf8 import const - +import string class AbiWordDoc(TextDoc): @@ -44,10 +44,7 @@ class AbiWordDoc(TextDoc): self.f.write('\n') self.f.write('\n') self.f.write('\n') + if len(self.photo_list) > 0: + self.f.write('\n') + for file_tuple in self.photo_list: + file = file_tuple[0] + width = file_tuple[1] + height = file_tuple[2] + base = os.path.basename(file) + tag = string.replace(base,'.','_') + cmd = "%s -size %dx%d %s %s" % (const.convert,width,height,file,base) + os.system(cmd) + self.f.write('\n') + f = open(base,"rb") + base64.encode(f,self.f) + f.close() + os.unlink(base) + self.f.write('\n') + self.f.write('\n') + self.f.write('\n') self.f.close() + def add_photo(self,name,x,y): + import GdkImlib + + image = GdkImlib.Image(name) + scale = float(y)/float(image.rgb_height) + act_width = int(image.rgb_width * scale) + act_height = int(image.rgb_height * scale) + + self.photo_list.append((name,act_width,act_height)) + + base = os.path.basename(name) + tag = string.replace(base,'.','_') + + self.f.write('\n' % ((float(act_height)/72.0)/2.54)) + def start_paragraph(self,style_name): style = self.style_list[style_name] self.f.write('