From d43ec2d13c6ed12c1bbc65f87c4e4c3d608f4604 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Thu, 21 Apr 2005 09:54:53 +0000 Subject: [PATCH] * src/ReadGedcom.py (parse_family_object): Set MediaRef properly * src/Marriage.py (__init__): Properly get place title svn: r4395 --- gramps2/ChangeLog | 4 ++++ gramps2/src/Marriage.py | 7 +++++-- gramps2/src/ReadGedcom.py | 17 +++++++++++------ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index c6f907c0c..ecd67c925 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2005-04-21 Martin Hawlisch + * src/ReadGedcom.py (parse_family_object): Set MediaRef properly + * src/Marriage.py (__init__): Properly get place title + 2005-04-20 Don Allingham * src/DbPrompter.py: handle runtime errors issued by gnomevfs.get_mime_type diff --git a/gramps2/src/Marriage.py b/gramps2/src/Marriage.py index c347cdac1..940ec3e31 100644 --- a/gramps2/src/Marriage.py +++ b/gramps2/src/Marriage.py @@ -236,8 +236,11 @@ class Marriage: lds_ord = self.family.get_lds_sealing() if lds_ord: - if lds_ord.get_place_handle(): - self.lds_place.child.set_text(lds_ord.get_place_handle().get_title()) + place_handle = lds_ord.get_place_handle() + if place_handle: + place = self.db.get_place_from_handle( place_handle) + if place: + self.lds_place.child.set_text( place.get_title()) self.lds_date.set_text(lds_ord.get_date()) self.seal_stat = lds_ord.get_status() self.lds_date_object = lds_ord.get_date_object() diff --git a/gramps2/src/ReadGedcom.py b/gramps2/src/ReadGedcom.py index 208c43d35..720f15a26 100644 --- a/gramps2/src/ReadGedcom.py +++ b/gramps2/src/ReadGedcom.py @@ -1209,14 +1209,19 @@ class GedcomParser: self.warn("\n\t\t".join(path)) self.warn('\n') else: - photo = RelLib.MediaObject() - photo.set_path(path) - photo.set_description(title) - photo.set_mime_type(GrampsMime.get_type(os.path.abspath(path))) - self.db.add_object(photo, self.trans) + photo_handle = self.media_map.get(path) + if photo_handle == None: + photo = RelLib.MediaObject() + photo.set_path(path) + photo.set_description(title) + photo.set_mime_type(GrampsMime.get_type(os.path.abspath(path))) + self.db.add_object(photo, self.trans) + self.media_map[path] = photo.get_handle() + else: + photo = self.db.get_object_from_handle(photo_handle) oref = RelLib.MediaRef() oref.set_reference_handle(photo.get_handle()) - self.family.add_media_reference(photo) + self.family.add_media_reference(oref) self.db.commit_family(self.family, self.trans) def parse_residence(self,address,level):