From 87d879dc6af907e2b5f2860f972e9e717111c797 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Sat, 7 May 2005 13:22:28 +0000 Subject: [PATCH] * src/PedView.py (build_detail_string), src/FamilyView.py (load_family): Dont crash on strange signal race condition, that leaves database in corrupt state before sending "active-changed" * src/plugins/ImportGeneWeb.py (read_children_lines): Properly add birth event; (parse_person): Remove brackets from name; (get_or_create_place): Fix typo svn: r4506 --- gramps2/ChangeLog | 8 ++++++++ gramps2/src/FamilyView.py | 3 +++ gramps2/src/PedView.py | 8 ++++---- gramps2/src/plugins/ImportGeneWeb.py | 16 ++++++++-------- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index d796e9979..5b73672b4 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,11 @@ +2005-05-07 Martin Hawlisch + * src/PedView.py (build_detail_string), src/FamilyView.py (load_family): + Dont crash on strange signal race condition, that leaves database in + corrupt state before sending "active-changed" + * src/plugins/ImportGeneWeb.py (read_children_lines): Properly add + birth event; (parse_person): Remove brackets from name; + (get_or_create_place): Fix typo + 2005-05-06 Alex Roitman * acinclude.m4: Copy macro for GCONF configuration from gconf2-dev; add --disable-mime-install and --enable-packager-mode arguments. diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index b9378f5dd..bf694b5d4 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -968,6 +968,9 @@ class FamilyView: if self.parent.active_person: handle = self.parent.active_person.get_handle() self.person = self.parent.db.get_person_from_handle(handle) + if not self.person: + self.clear() + return splist = self.person.get_family_handle_list() else: self.person = None diff --git a/gramps2/src/PedView.py b/gramps2/src/PedView.py index 66b918841..6b0724452 100644 --- a/gramps2/src/PedView.py +++ b/gramps2/src/PedView.py @@ -802,10 +802,10 @@ def build_detail_string(db,person): else: for event_handle in person.get_event_list(): event = db.get_event_from_handle(event_handle) - if event.get_name() == "Baptism": + if event and event.get_name() == "Baptism": detail_text += format_event(db, _BAPT, event) break - if event.get_name() == "Christening": + if event and event.get_name() == "Christening": detail_text += format_event(db, _CHRI, event) break @@ -815,10 +815,10 @@ def build_detail_string(db,person): else: for event_handle in person.get_event_list(): event = db.get_event_from_handle(event_handle) - if event.get_name() == "Burial": + if event and event.get_name() == "Burial": detail_text += format_event(db, _BURI, event) break - if event.get_name() == "Cremation": + if event and event.get_name() == "Cremation": detail_text += format_event(db, _CREM, event) break diff --git a/gramps2/src/plugins/ImportGeneWeb.py b/gramps2/src/plugins/ImportGeneWeb.py index 47d06393f..a54af9515 100644 --- a/gramps2/src/plugins/ImportGeneWeb.py +++ b/gramps2/src/plugins/ImportGeneWeb.py @@ -86,9 +86,8 @@ def importData(database, filename, cb=None): #------------------------------------------------------------------------- -# -# -# +# For a description of the file format see +# http://cristal.inria.fr/~ddr/GeneWeb/en/gwformat.htm #------------------------------------------------------------------------- class GeneWebParser: def __init__(self, dbase, file): @@ -255,7 +254,8 @@ class GeneWebParser: birth_handle = child.get_birth_handle() birth = self.db.get_event_from_handle(birth_handle) if not birth: - birth = RelLib.Event() + birth = self.create_event("Birth") + child.set_birth_handle(birth.get_handle()) birth.set_place_handle(self.current_child_birthplace_handle) self.db.commit_event(birth,self.trans) if self.current_child_source_handle: @@ -450,14 +450,14 @@ class GeneWebParser: while idx < len(fields) and personDataRe.match(fields[idx]): if fields[idx][0] == '(': #print "Public Name: %s" % fields[idx] - public_name = self.decode(fields[idx]) + public_name = self.decode(fields[idx][1:-1]) idx = idx + 1 elif fields[idx][0] == '{': #print "Firstsname Alias: %s" % fields[idx] - firstname_aliases.append(self.decode(fields[idx])) + firstname_aliases.append(self.decode(fields[idx][1:-1])) idx = idx + 1 elif fields[idx][0] == '[': - #print "Titles: %s" % fields[idx] + print "TODO: Titles: %s" % fields[idx] idx = idx + 1 elif fields[idx] == '#nick': idx = idx + 1 @@ -672,7 +672,7 @@ class GeneWebParser: def get_or_create_place(self,place_name): place = None if place_name in self.pkeys: - person = self.db.get_place_from_handle(self.pkeys[place_name]) + place = self.db.get_place_from_handle(self.pkeys[place_name]) else: place = RelLib.Place() place.set_title(place_name)