diff --git a/ChangeLog b/ChangeLog index c3bab6f74..879df8a88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-11-03 Tim Waugh + + * src/plugins/gedcomexport.glade, src/plugins/WriteGedcom.py: Added + support for external image references. + 2003-11-02 Tim Waugh * src/ArgHandler.py, src/DbPrompter,py: clear_database takes no diff --git a/src/plugins/WriteGedcom.py b/src/plugins/WriteGedcom.py index 17bfb313b..333c929dd 100644 --- a/src/plugins/WriteGedcom.py +++ b/src/plugins/WriteGedcom.py @@ -420,7 +420,7 @@ class GedcomWriter: filetgt = self.topDialog.get_widget('fileentry1') filetgt.set_filename(pathname) - + self.topDialog.get_widget("gedcomExport").show() def gnu_free(self,obj): @@ -454,6 +454,10 @@ class GedcomWriter: act_tgt = self.target_menu.get_active() self.target_ged = act_tgt.get_data("data") + self.images = self.topDialog.get_widget ("images").get_active () + if self.images: + images_path = self.topDialog.get_widget ("images_path") + self.images_path = images_path.get_text () self.dest = self.target_ged.get_dest() self.adopt = self.target_ged.get_adopt() @@ -561,6 +565,7 @@ class GedcomWriter: self.g.write('%s%s' % (text,self.nl)) def export_data(self,filename): + self.dirname = os.path.dirname (filename) try: self.g = open(filename,"w") except IOError,msg: @@ -935,6 +940,32 @@ class GedcomWriter: for srcref in addr.getSourceRefList(): self.write_source_ref(2,srcref) + if self.images: + photos = person.getPhotoList () + else: + photos = [] + + for photo in photos: + if photo.ref.getMimeType() == "image/jpeg": + self.writeln('1 OBJE') + self.writeln('2 FORM jpg') + path = photo.ref.getPath () + dirname = os.path.join (self.dirname, self.images_path) + basename = os.path.basename (path) + self.writeln('2 FILE %s' % os.path.join(self.images_path, + basename)) + try: + os.mkdir (dirname) + except: + pass + dest = os.path.join (dirname, basename) + try: + os.link (path, dest) + except OSError, e: + file (dest, + "wb").writelines (file (path, + "rb").xreadlines ()) + for family in person.getParentList(): if self.flist.has_key(family[0].getId()): self.writeln("1 FAMC @%s@" % self.fid(family[0].getId())) diff --git a/src/plugins/gedcomexport.glade b/src/plugins/gedcomexport.glade index aa5471d74..b5b37a618 100644 --- a/src/plugins/gedcomexport.glade +++ b/src/plugins/gedcomexport.glade @@ -51,7 +51,6 @@ - 0 @@ -92,7 +91,7 @@ 12 True - 13 + 14 3 False 6 @@ -593,6 +592,59 @@ fill + + + + True + False + 0 + + + + True + True + Reference images from path: + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + + True + True + True + True + 0 + media + True + * + False + + + 0 + True + True + + + + + 1 + 3 + 13 + 14 + 2 + fill + + 0