2003-11-03 Tim Waugh <twaugh@redhat.com>

* src/plugins/gedcomexport.glade, src/plugins/WriteGedcom.py: Added
        support for external image references.


svn: r2314
This commit is contained in:
Tim Waugh 2003-11-03 11:58:15 +00:00
parent c909903fd5
commit bb2d6dbaab
3 changed files with 91 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2003-11-03 Tim Waugh <twaugh@redhat.com>
* src/plugins/gedcomexport.glade, src/plugins/WriteGedcom.py: Added
support for external image references.
2003-11-02 Tim Waugh <twaugh@redhat.com>
* src/ArgHandler.py, src/DbPrompter,py: clear_database takes no

View File

@ -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()))

View File

@ -51,7 +51,6 @@
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -92,7 +91,7 @@
<widget class="GtkTable" id="table3">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">13</property>
<property name="n_rows">14</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -593,6 +592,59 @@
<property name="x_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="images">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Reference images from path: </property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="images_path">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">media</property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">13</property>
<property name="bottom_attach">14</property>
<property name="x_padding">2</property>
<property name="x_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>