From 8ddbce94f0365b834fdfecc6beb9beabc298fc35 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 26 May 2004 02:05:02 +0000 Subject: [PATCH] * src/RelLib.py (try_to_find_person_from_id): Remove transaction; (try_to_find_source_from_id, try_to_find_object_from_id, try_to_find_place_from_id): Add functions. * src/plugins/WriteCD.py, src/plugins/WritePkg.py, src/plugins/WebPage.py, src/plugins/Verify.py, src/plugins/TimeLine.py, src/plugins/Summary.py, src/plugins/SoundGen.py, src/plugins/RelGraph.py, src/plugins/RelCalc.py, src/plugins/PatchNames.py, src/plugins/Merge.py, src/plugins/IndivSummary.py, src/plugins/IndivComplete.py, src/plugins/GraphViz.py, src/plugins/FtmStyleDescendants.py, src/plugins/FtmStyleAncestors.py, src/plugins/FilterEditor.py, src/plugins/FanChart.py, src/plugins/FamilyGroup.py, src/plugins/EventCmp.py, src/plugins/DetDescendantReport.py, src/plugins/DetAncestralReport.py, src/plugins/DescendReport.py, src/plugins/Desbrowser.py, src/plugins/CountAncestors.py, src/plugins/Check.py, src/plugins/ChangeTypes.py, src/plugins/BookReport.py, src/plugins/Ancestors.py, src/plugins/AncestorReport.py, src/plugins/AncestorChart.py, src/plugins/AncestorChart2.py, src/Relationship.py, src/Sort.py, src/GenericFilter.py, src/SubstKeywords.py, src/GraphLayout.py: Switch from find_* to try_to_find_* methods. svn: r3191 --- ChangeLog | 24 ++++++++++++ src/GenericFilter.py | 54 +++++++++++++-------------- src/GraphLayout.py | 4 +- src/RelLib.py | 43 ++++++++++++++++++++-- src/Relationship.py | 4 +- src/Sort.py | 8 ++-- src/SubstKeywords.py | 12 +++--- src/plugins/AncestorChart.py | 2 +- src/plugins/AncestorChart2.py | 2 +- src/plugins/AncestorReport.py | 10 ++--- src/plugins/Ancestors.py | 59 +++++++++++++++--------------- src/plugins/BookReport.py | 2 +- src/plugins/ChangeTypes.py | 6 +-- src/plugins/Check.py | 34 ++++++++--------- src/plugins/CountAncestors.py | 2 +- src/plugins/Desbrowser.py | 4 +- src/plugins/DescendReport.py | 2 +- src/plugins/DetAncestralReport.py | 52 +++++++++++++------------- src/plugins/DetDescendantReport.py | 56 ++++++++++++++-------------- src/plugins/EventCmp.py | 10 ++--- src/plugins/FamilyGroup.py | 26 ++++++------- src/plugins/FanChart.py | 4 +- src/plugins/FilterEditor.py | 4 +- src/plugins/FtmStyleAncestors.py | 24 ++++++------ src/plugins/FtmStyleDescendants.py | 38 +++++++++---------- src/plugins/GraphViz.py | 4 +- src/plugins/IndivComplete.py | 26 ++++++------- src/plugins/IndivSummary.py | 12 +++--- src/plugins/Merge.py | 36 +++++++++--------- src/plugins/PatchNames.py | 8 ++-- src/plugins/RelCalc.py | 10 ++--- src/plugins/RelGraph.py | 22 +++++------ src/plugins/SoundGen.py | 2 +- src/plugins/Summary.py | 4 +- src/plugins/TimeLine.py | 8 ++-- src/plugins/Verify.py | 12 +++--- src/plugins/WebPage.py | 44 +++++++++++----------- src/plugins/WriteCD.py | 10 ++--- src/plugins/WritePkg.py | 8 ++-- 39 files changed, 377 insertions(+), 315 deletions(-) diff --git a/ChangeLog b/ChangeLog index 981e4c75f..505288178 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2004-05-25 Alex Roitman + * src/RelLib.py (try_to_find_person_from_id): Remove transaction; + (try_to_find_source_from_id, try_to_find_object_from_id, + try_to_find_place_from_id): Add functions. + * src/plugins/WriteCD.py, src/plugins/WritePkg.py, + src/plugins/WebPage.py, src/plugins/Verify.py, + src/plugins/TimeLine.py, src/plugins/Summary.py, + src/plugins/SoundGen.py, src/plugins/RelGraph.py, + src/plugins/RelCalc.py, src/plugins/PatchNames.py, + src/plugins/Merge.py, src/plugins/IndivSummary.py, + src/plugins/IndivComplete.py, src/plugins/GraphViz.py, + src/plugins/FtmStyleDescendants.py, + src/plugins/FtmStyleAncestors.py, src/plugins/FilterEditor.py, + src/plugins/FanChart.py, src/plugins/FamilyGroup.py, + src/plugins/EventCmp.py, src/plugins/DetDescendantReport.py, + src/plugins/DetAncestralReport.py, src/plugins/DescendReport.py, + src/plugins/Desbrowser.py, src/plugins/CountAncestors.py, + src/plugins/Check.py, src/plugins/ChangeTypes.py, + src/plugins/BookReport.py, src/plugins/Ancestors.py, + src/plugins/AncestorReport.py, src/plugins/AncestorChart.py, + src/plugins/AncestorChart2.py, src/Relationship.py, + src/Sort.py, src/GenericFilter.py, src/SubstKeywords.py, + src/GraphLayout.py: Switch from find_* to try_to_find_* methods. + 2004-05-24 Don Allingham * src/PeopleModel.py: temporary fix for add person update * src/PeopleView.py: temporary fix for add person update diff --git a/src/GenericFilter.py b/src/GenericFilter.py index 2349ca873..696bef18c 100644 --- a/src/GenericFilter.py +++ b/src/GenericFilter.py @@ -167,7 +167,7 @@ class RelationshipPathBetween(Rule): if not first: map[p_id] = 1 - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) for fam_id in p.get_family_id_list(): if fam_id: fam = self.db.find_family_from_id(fam_id) @@ -279,7 +279,7 @@ class HasCompleteRecord(Rule): return _('Matches all people whose records are complete') def apply(self,db,p_id): - return db.find_person_from_id(p_id).get_complete() == 1 + return db.try_to_find_person_from_id(p_id).get_complete() == 1 #------------------------------------------------------------------------- # @@ -301,7 +301,7 @@ class IsFemale(Rule): return _('Matches all females') def apply(self,db,p_id): - return db.find_person_from_id(p_id).get_gender() == RelLib.Person.female + return db.try_to_find_person_from_id(p_id).get_gender() == RelLib.Person.female #------------------------------------------------------------------------- # @@ -349,7 +349,7 @@ class IsDescendantOf(Rule): if not first: self.map[p_id] = 1 - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) for fam_id in p.get_family_id_list(): if fam_id: fam = self.db.find_family_from_id(fam_id) @@ -440,7 +440,7 @@ class IsLessThanNthGenerationDescendantOf(Rule): if gen >= int(self.list[1]): return - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) for fam_id in p.get_family_id_list(): fam = self.db.find_family_from_id(fam_id) for child_id in fam.get_child_id_list(): @@ -486,7 +486,7 @@ class IsMoreThanNthGenerationDescendantOf(Rule): if gen >= int(self.list[1]): self.map[p_id] = 1 - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) for fam_id in p.get_family_id_list(): fam = self.db.find_family_from_id(fam_id) for child_id in fam.get_child_id_list(): @@ -530,7 +530,7 @@ class IsChildOfFilterMatch(Rule): return self.map.has_key(p_id) def init_list(self,p_id): - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) for fam_id in p.get_family_id_list(): fam = self.db.find_family_from_id(fam_id) for child_id in fam.get_child_id_list(): @@ -568,7 +568,7 @@ class IsDescendantFamilyOf(Rule): self.map[p_id] = 1 return 1 - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) for (f,r1,r2) in p.get_parent_family_id_list(): family = self.db.find_family_from_id(f) for person_id in [family.get_mother_id(),family.get_father_id()]: @@ -633,7 +633,7 @@ class IsAncestorOf(Rule): if not first: self.map[p_id] = 1 - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) fam_id = p.get_main_parents_family_id() if fam_id: fam = self.db.find_family_from_id(fam_id) @@ -730,7 +730,7 @@ class IsLessThanNthGenerationAncestorOf(Rule): if gen >= int(self.list[1]): return - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) fam_id = p.get_main_parents_family_id() if fam_id: fam = self.db.find_family_from_id(fam_id) @@ -783,7 +783,7 @@ class IsMoreThanNthGenerationAncestorOf(Rule): if gen >= int(self.list[1]): self.map[p_id] = 1 - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) fam_id = p.get_main_parents_family_id() if fam_id: fam = self.db.find_family_from_id(fam_id) @@ -833,7 +833,7 @@ class IsParentOfFilterMatch(Rule): return self.map.has_key(p_id) def init_list(self,p_id): - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) for fam_id in p.get_main_parents_family_id(): fam = self.db.find_family_from_id(fam_id) for parent_id in [fam.get_father_id (), fam.get_mother_id ()]: @@ -937,7 +937,7 @@ class IsMale(Rule): return _('Matches all males') def apply(self,db,p_id): - return db.find_person_from_id(p_id).get_gender() == RelLib.Person.male + return db.try_to_find_person_from_id(p_id).get_gender() == RelLib.Person.male #------------------------------------------------------------------------- # @@ -967,7 +967,7 @@ class HasEvent(Rule): return _('Event filters') def apply(self,db,p_id): - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) for event_id in p.get_event_list(): if not event_id: continue @@ -984,7 +984,7 @@ class HasEvent(Rule): if self.list[2]: pl_id = event.get_place_id() if pl_id: - pl = db.find_place_from_id(pl_id) + pl = db.try_to_find_place_from_id(pl_id) pn = pl.get_title() if string.find(pn.upper(),self.list[2].upper()) == -1: val = 0 @@ -1021,7 +1021,7 @@ class HasFamilyEvent(Rule): return _('Event filters') def apply(self,db,p_id): - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) for f_id in p.get_family_id_list(): f = db.find_family_from_id(f_id) for event_id in f.get_event_list(): @@ -1039,7 +1039,7 @@ class HasFamilyEvent(Rule): val = 0 pl_id = event.get_place_id() if pl_id: - pl = db.find_place_from_id(pl_id) + pl = db.try_to_find_place_from_id(pl_id) pn = pl.get_title() if self.list[2] and string.find(pn,self.list[2].upper()) == -1: val = 0 @@ -1071,7 +1071,7 @@ class HasRelationship(Rule): def apply(self,db,p_id): rel_type = 0 cnt = 0 - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) num_rel = len(p.get_family_id_list()) # count children and look for a relationship type match @@ -1133,7 +1133,7 @@ class HasBirth(Rule): return _('Event filters') def apply(self,db,p_id): - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) event_id = p.get_birth_id() if not event_id: return 0 @@ -1146,7 +1146,7 @@ class HasBirth(Rule): return 0 pl_id = event.get_place_id() if pl_id: - pl = db.find_place_from_id(pl_id) + pl = db.try_to_find_place_from_id(pl_id) pn = pl.get_title() if len(self.list) > 1 and string.find(pn,self.list[1].upper()) == -1: return 0 @@ -1180,7 +1180,7 @@ class HasDeath(Rule): return _('Event filters') def apply(self,db,p_id): - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) event_id = p.get_death_id() if not event_id: return 0 @@ -1193,7 +1193,7 @@ class HasDeath(Rule): return 0 pl_id = event.get_place_id() if pl_id: - pl = db.find_place_from_id(pl_id) + pl = db.try_to_find_place_from_id(pl_id) pn = pl.get_title() if self.list[1] and string.find(pn,self.list[1].upper()) == -1: return 0 @@ -1213,7 +1213,7 @@ class HasAttribute(Rule): return 'Has the personal attribute' def apply(self,db,p_id): - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) for event in p.getAttributes(): if self.list[0] and event.get_type() != self.list[0]: return 0 @@ -1236,7 +1236,7 @@ class HasFamilyAttribute(Rule): return 'Has the family attribute' def apply(self,db,p_id): - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) for f_id in p.get_family_id_list(): f = db.find_family_from_id(f_id) for event in f.getAttributes(): @@ -1274,7 +1274,7 @@ class HasNameOf(Rule): self.l = self.list[1] self.s = self.list[2] self.t = self.list[3] - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) for name in [p.get_primary_name()] + p.get_alternate_names(): val = 1 if self.f and string.find(name.get_first_name().upper(),self.f.upper()) == -1: @@ -1310,7 +1310,7 @@ class SearchName(Rule): def apply(self,db,p_id): self.f = self.list[0] - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) return self.f and string.find(p.get_primary_name().get_name().upper(),self.f.upper()) != -1 #------------------------------------------------------------------------- @@ -1357,7 +1357,7 @@ class IsSpouseOfFilterMatch(Rule): def apply(self,db,p_id): filter = MatchesFilter (self.list) - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) for family_id in p.get_family_id_list (): family = db.find_family_from_id(family_id) for spouse_id in [family.get_father_id (), family.get_mother_id ()]: diff --git a/src/GraphLayout.py b/src/GraphLayout.py index 1bdc40fe0..d8c6c7ae4 100644 --- a/src/GraphLayout.py +++ b/src/GraphLayout.py @@ -54,7 +54,7 @@ class DescendLine(GraphLayout): if pos > self.maxy: self.maxy = pos - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) for family_id in person.get_family_id_list(): family = self.database.find_family_from_id(family_id) for child_id in family.get_child_id_list(): @@ -65,7 +65,7 @@ class DescendLine(GraphLayout): self.elist.pop() def depth(self,person_id,val=0): - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) for family_id in person.get_family_id_list(): family = self.database.find_family_from_id(family_id) clist = family.get_child_id_list() diff --git a/src/RelLib.py b/src/RelLib.py index f74522a06..b2932bab6 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -2958,14 +2958,14 @@ class GrampsDB: def has_family_id(self,val): return self.family_map.get(str(val)) - def try_to_find_person_from_id(self,val,trans): + def try_to_find_person_from_id(self,val): """finds a Person in the database from the passed gramps' ID. If no such Person exists, a new Person is added to the database.""" - person = Person() data = self.person_map.get(str(val)) if data: + person = Person() person.unserialize(data) return person else: @@ -3084,6 +3084,18 @@ class GrampsDB: map[gid] = self.add_event(event,trans) return event + def try_to_find_source_from_id(self,val): + """finds a Source in the database from the passed gramps' ID. + If no such Source exists, None is returned.""" + + data = self.source_map.get(str(val)) + if data: + source = Source() + source.unserialize(data) + return source + else: + return None + def find_source_from_id(self,val,trans): """finds a Source in the database from the passed gramps' ID. If no such Source exists, a new Source is added to the database.""" @@ -3172,9 +3184,21 @@ class GrampsDB: self.added_files.append(object) return index + def try_to_find_object_from_id(self,gid): + """finds an Object in the database from the passed gramps' ID. + If no such Object exists, None is returned.""" + + data = self.media_map.get(str(gid)) + if data: + mobject = MediaObject() + mobject.unserialize(data) + return mobject + else: + return None + def find_object_from_id(self,gid,trans): """finds an Object in the database from the passed gramps' ID. - If no such Source exists, a new Source is added to the database.""" + If no such Object exists, a new Object is added to the database.""" object = MediaObject() if self.media_map.get(str(gid)): @@ -3272,6 +3296,19 @@ class GrampsDB: place.unserialize(data) return place + def try_to_find_place_from_id(self,gid): + """finds a Place in the database from the passed gramps' ID. + If no such Place exists, None is returned.""" + + data = self.place_map.get(str(gid)) + + if data: + place = Place() + place.unserialize(data) + return place + else: + return None + def sortbyplace(self,f,s): fp = self.place_map[f][1].upper() sp = self.place_map[s][1].upper() diff --git a/src/Relationship.py b/src/Relationship.py index 443929bab..5d2114cb5 100644 --- a/src/Relationship.py +++ b/src/Relationship.py @@ -172,8 +172,8 @@ class RelationshipCalculator: family_id = person.get_main_parents_family_id() family = self.db.find_family_from_id(family_id) if family != None: - father = self.db.find_person_from_id(family.get_father_id()) - mother = self.db.find_person_from_id(family.get_mother_id()) + father = self.db.try_to_find_person_from_id(family.get_father_id()) + mother = self.db.try_to_find_person_from_id(family.get_mother_id()) self.apply_filter(father,index+1,plist,pmap) self.apply_filter(mother,index+1,plist,pmap) diff --git a/src/Sort.py b/src/Sort.py index 507a4238d..3bf5fdab5 100644 --- a/src/Sort.py +++ b/src/Sort.py @@ -79,8 +79,8 @@ class Sort: def by_last_name(self,first_id,second_id): """Sort routine for comparing two last names. If last names are equal, uses the given name and suffix""" - first = self.database.find_person_from_id(first_id) - second = self.database.find_person_from_id(second_id) + first = self.database.try_to_find_person_from_id(first_id) + second = self.database.try_to_find_person_from_id(second_id) name1 = first.get_primary_name() name2 = second.get_primary_name() @@ -101,8 +101,8 @@ class Sort: def by_birthdate(self,first_id,second_id): """Sort routine for comparing two people by birth dates. If the birth dates are equal, sorts by name""" - first = self.database.find_person_from_id(first_id) - second = self.database.find_person_from_id(second_id) + first = self.database.try_to_find_person_from_id(first_id) + second = self.database.try_to_find_person_from_id(second_id) birth_id1 = first.get_birth_id() if birth_id1: diff --git a/src/SubstKeywords.py b/src/SubstKeywords.py index f87dbfb3d..9a77b2ca0 100644 --- a/src/SubstKeywords.py +++ b/src/SubstKeywords.py @@ -68,7 +68,7 @@ class SubstKeywords: def __init__(self,database,person_id): """Creates a new object and associates a person with it.""" - person = database.find_person_from_id(person_id) + person = database.try_to_find_person_from_id(person_id) self.n = person.get_primary_name().get_regular_name() self.N = person.get_primary_name().get_name() self.b = "" @@ -86,14 +86,14 @@ class SubstKeywords: self.b = birth.get_date() bplace_id = birth.get_place_id() if bplace_id: - self.B = database.find_place_from_id(bplace_id).get_title() + self.B = database.try_to_find_place_from_id(bplace_id).get_title() death_id = person.get_death_id() if death_id: death = database.find_event_from_id(death_id) self.d = death.get_date() dplace_id = death.get_place_id() if dplace_id: - self.D = database.find_place_from_id(dplace_id).get_title() + self.D = database.try_to_find_place_from_id(dplace_id).get_title() self.i = str(person_id) if person.get_family_id_list(): @@ -103,12 +103,12 @@ class SubstKeywords: mother_id = f.get_mother_id() if father_id == person_id: if mother_id: - mother = database.find_person_from_id(mother_id) + mother = database.try_to_find_person_from_id(mother_id) self.s = mother.get_primary_name().get_regular_name() self.S = mother.get_primary_name().get_name() else: if father_id: - father = database.find_person_from_id(father_id) + father = database.try_to_find_person_from_id(father_id) self.s = father.get_primary_name().get_regular_name() self.S = father.get_primary_name().get_name() for e_id in f.get_event_list(): @@ -119,7 +119,7 @@ class SubstKeywords: self.m = e.get_date() mplace_id = e.get_place_id() if mplace_id: - self.M = database.find_place_from_id(mplace_id).get_title() + self.M = database.try_to_find_place_from_id(mplace_id).get_title() def replace(self,line): """Returns a new line of text with the substitutions performed.""" diff --git a/src/plugins/AncestorChart.py b/src/plugins/AncestorChart.py index a8f579370..dbb058069 100644 --- a/src/plugins/AncestorChart.py +++ b/src/plugins/AncestorChart.py @@ -112,7 +112,7 @@ class AncestorChart: self.lines = max(self.lines,len(self.text[index])) - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) family_id = person.get_main_parents_family_id() if family_id: family = self.database.find_family_from_id(family_id) diff --git a/src/plugins/AncestorChart2.py b/src/plugins/AncestorChart2.py index 134270526..45519cb2c 100644 --- a/src/plugins/AncestorChart2.py +++ b/src/plugins/AncestorChart2.py @@ -226,7 +226,7 @@ class AncestorChart: self.lines = max(self.lines,len(self.text[index])) - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) family_id = person.get_main_parents_family_id() if family_id: family = self.database.find_family_from_id(family_id) diff --git a/src/plugins/AncestorReport.py b/src/plugins/AncestorReport.py index f33084c31..cd43fcc96 100644 --- a/src/plugins/AncestorReport.py +++ b/src/plugins/AncestorReport.py @@ -69,7 +69,7 @@ class AncestorReport(Report.Report): return self.map[index] = person_id - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) family_id = person.get_main_parents_family_id() if family_id: family = self.database.find_family_from_id(family_id) @@ -105,7 +105,7 @@ class AncestorReport(Report.Report): self.doc.start_paragraph("AHN-Entry","%s." % str(key)) person_id = self.map[key] - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) name = person.get_primary_name().get_regular_name() self.doc.start_bold() @@ -124,7 +124,7 @@ class AncestorReport(Report.Report): date = birth.get_date_object().get_start_date() place_id = birth.get_place_id() if place_id: - place = self.database.find_place_from_id(place_id).get_title() + place = self.database.try_to_find_place_from_id(place_id).get_title() else: place = u'' if place[-1:] == '.': @@ -159,7 +159,7 @@ class AncestorReport(Report.Report): date = death.get_date_object().get_start_date() place_id = death.get_place_id() if place_id: - place = self.database.find_place_from_id(place_id).get_title() + place = self.database.try_to_find_place_from_id(place_id).get_title() else: place = u'' if place[-1:] == '.': @@ -204,7 +204,7 @@ class AncestorReport(Report.Report): date = buried.get_date_object().get_start_date() place_id = buried.get_place_id() if place_id: - place = self.database.find_place_from_id(place_id).get_title() + place = self.database.try_to_find_place_from_id(place_id).get_title() else: place = u'' if place[-1:] == '.': diff --git a/src/plugins/Ancestors.py b/src/plugins/Ancestors.py index d237ad2e2..e0c5ec8af 100644 --- a/src/plugins/Ancestors.py +++ b/src/plugins/Ancestors.py @@ -138,7 +138,7 @@ class ComprehensiveAncestorsReport (Report.Report): i = 1 for source_id in self.sources: - source = self.database.find_source_from_id(source_id) + source = self.database.try_to_find_source_from_id(source_id) self.doc.start_paragraph ("AR-Entry") self.doc.write_text ("[%d] %s" % (i, source.get_title ())) author = source.get_author () @@ -186,8 +186,8 @@ class ComprehensiveAncestorsReport (Report.Report): return ret father_id = family.get_father_id () mother_id = family.get_mother_id () - father = self.database.find_person_from_id(father_id) - mother = self.database.find_person_from_id(mother_id) + father = self.database.try_to_find_person_from_id(father_id) + mother = self.database.try_to_find_person_from_id(mother_id) if father: ret.extend (self.person (father_id, short_form = father_id in already_described, @@ -209,7 +209,7 @@ class ComprehensiveAncestorsReport (Report.Report): ret.append ((self.doc.end_paragraph, [])) for child_id in children_ids: - child = self.database.find_person_from_id(child_id) + child = self.database.try_to_find_person_from_id(child_id) ret.extend (self.person (child_id, suppress_children = 1, short_form=child_id in already_described, already_described = already_described, @@ -232,7 +232,7 @@ class ComprehensiveAncestorsReport (Report.Report): break relstring = self.relationship.get_grandparents_string (self.start, - self.database.find_person_from_id(self.gp))[0] + self.database.try_to_find_person_from_id(self.gp))[0] heading = _("%(name)s's maternal %(grandparents)s") % \ { 'name': self.first_name_or_nick (self.start), 'grandparents': relstring } @@ -255,7 +255,7 @@ class ComprehensiveAncestorsReport (Report.Report): break relstring = self.relationship.get_grandparents_string (self.start, - self.database.find_person_from_id(self.gp))[0] + self.database.try_to_find_person_from_id(self.gp))[0] if thisgen == 2: heading = _("%(name)s's %(parents)s") % \ { 'name': self.first_name_or_nick (self.start), @@ -274,7 +274,7 @@ class ComprehensiveAncestorsReport (Report.Report): for family_id in family_ids: family = self.database.find_family_from_id(family_id) father_id = family.get_father_id () - father = self.database.find_person_from_id(father_id) + father = self.database.try_to_find_person_from_id(father_id) if father: already_described.append (father_id) father_family_id = father.get_main_parents_family_id () @@ -283,7 +283,7 @@ class ComprehensiveAncestorsReport (Report.Report): next_pfamily_ids.append (father_family_id) mother_id = family.get_mother_id () - mother = self.database.find_person_from_id(mother_id) + mother = self.database.try_to_find_person_from_id(mother_id) if mother: already_described.append (mother_id) mother_family_id = mother.get_main_parents_family_id () @@ -302,7 +302,7 @@ class ComprehensiveAncestorsReport (Report.Report): needs_name = 0, from_family = None): ret = [] - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) name = self.person_name (person_id) if name: photos = person.get_media_list () @@ -311,7 +311,7 @@ class ComprehensiveAncestorsReport (Report.Report): bits += self.short_occupation (person) bits += self.long_born_died (person) if not suppress_children: - bits += self.parents_of (person) + bits += self.parents_of (person_id) else: bits += '.' bits += self.married_whom (person, from_family, suppress_children) @@ -335,7 +335,7 @@ class ComprehensiveAncestorsReport (Report.Report): family = self.database.find_family_from_id(family_id) for partner_id in [family.get_father_id (), family.get_mother_id ()]: - partner = self.database.find_person_from_id(partner_id) + partner = self.database.try_to_find_person_from_id(partner_id) if partner_id == person_id or not partner: continue @@ -344,7 +344,7 @@ class ComprehensiveAncestorsReport (Report.Report): partner != from_family_mother)): for media_ref in partner.get_media_list ()[:1]: object_id = media_ref.get_reference_id() - mobject = self.database.find_object_from_id(object_id) + mobject = self.database.try_to_find_object_from_id(object_id) if mobject.get_mime_type()[0:5] == "image": spouse.append ((self.doc.add_media_object, [mobject.get_path (), @@ -377,7 +377,7 @@ class ComprehensiveAncestorsReport (Report.Report): ret.append ((self.doc.start_cell, ["AR-Photo"])) for media_ref in photos[:1]: object_id = media_ref.get_reference_id() - mobject = self.database.find_object_from_id(object_id) + mobject = self.database.try_to_find_object_from_id(object_id) if mobject.get_mime_type()[0:5] == "image": ret.append ((self.doc.add_media_object, [mobject.get_path (), 'left', 2, 2])) @@ -452,7 +452,7 @@ class ComprehensiveAncestorsReport (Report.Report): info += _(' in %(month_or_year)s') % \ {'month_or_year': dateobj.get_date ()} - placename = self.database.find_place_from_id(event.get_place_id()).get_title() + placename = self.database.try_to_find_place_from_id(event.get_place_id()).get_title() if placename: info += _(' in %(place)s') % {'place': placename} note = event.get_note () @@ -530,32 +530,33 @@ class ComprehensiveAncestorsReport (Report.Report): return ret def parents_of (self, person_id): - person = self.database.find_person_from_id(person_id) + ret = '. ' + person = self.database.try_to_find_person_from_id(person_id) gender = person.get_gender () - family = person.get_main_parents_family_id () - ret = '. ' - if family: + family_id = person.get_main_parents_family_id () + if family_id: + family = self.database.find_family_from_id(family_id) fathername = mothername = None father_id = family.get_father_id () - father = self.database.find_person_from_id(father_id) - if father: + if father_id: + #father = self.database.try_to_find_person_from_id(father_id) fathername = self.person_name (father_id) mother_id = family.get_mother_id () - mother = self.database.find_person_from_id(mother_id) - if mother: + if mother_id: + #mother = self.database.try_to_find_person_from_id(mother_id) mothername = self.person_name (mother_id) - if not mother and not father: + if not mother_id and not father_id: pass - elif not father: + elif not father_id: if gender == RelLib.Person.female: ret += _("She is the daughter of %(mother)s.") % \ {'mother': mothername} else: ret += _("He is the son of %(mother)s.") % \ {'mother': mothername} - elif not mother: + elif not mother_id: if gender == RelLib.Person.female: ret += _("She is the daughter of %(father)s.") % \ {'father': fathername} @@ -631,7 +632,7 @@ class ComprehensiveAncestorsReport (Report.Report): return citation def person_name (self, person_id): - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) primary = person.get_primary_name () name = primary.get_title () @@ -682,9 +683,9 @@ class ComprehensiveAncestorsReport (Report.Report): for family_id in person.get_family_id_list (): family = self.database.find_family_from_id(family_id) mother_id = family.get_mother_id () - mother = self.database.find_person_from_id(mother_id) + mother = self.database.try_to_find_person_from_id(mother_id) for spouse_id in [family.get_father_id (), mother_id]: - spouse = self.database.find_person_from_id(spouse_id) + spouse = self.database.try_to_find_person_from_id(spouse_id) if spouse_id == person.get_id() or not spouse_id: continue @@ -701,7 +702,7 @@ class ComprehensiveAncestorsReport (Report.Report): count = 1 for child_id in childlist: - child = self.database.find_person_from_id(child_id) + child = self.database.try_to_find_person_from_id(child_id) children += self.first_name_or_nick (child) children += self.cite_sources (child.get_primary_name (). get_source_references ()) diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index 48419c66f..1dc3a9f46 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -680,7 +680,7 @@ class BookReportSelector: if data[1] == _("Title"): data.append(_("Not Applicable")) else: - pname = self.db.find_person_from_id(options[0]) + pname = self.db.try_to_find_person_from_id(options[0]) data.append(pname.get_primary_name().get_regular_name()) self.bk_model.add(data) diff --git a/src/plugins/ChangeTypes.py b/src/plugins/ChangeTypes.py index 5b117c555..2bc590c31 100644 --- a/src/plugins/ChangeTypes.py +++ b/src/plugins/ChangeTypes.py @@ -42,9 +42,9 @@ def runTool(database,person,callback,parent=None): try: trans = database.start_transaction() ChangeTypes(database,person,parent,trans) - database.add_transaction(trans) + database.add_transaction(trans,_('Change types')) except: - database.add_transaction(trans) + database.add_transaction(trans,_('Change types')) database.undo() import DisplayTrace @@ -85,7 +85,7 @@ class ChangeTypes: new = unicode(self.glade.get_widget("new_text").get_text()) for person_id in self.db.get_person_keys(): - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) for event_id in person.get_event_list(): if not event_id: continue diff --git a/src/plugins/Check.py b/src/plugins/Check.py index 19a45ad30..064e781cd 100644 --- a/src/plugins/Check.py +++ b/src/plugins/Check.py @@ -64,7 +64,7 @@ def runTool(database,active_person,callback,parent=None): checker.cleanup_missing_photos(0) checker.check_parent_relationships() checker.cleanup_empty_families(0) - database.add_transaction(trans) + database.add_transaction(trans, _("Check Integrity")) errs = checker.build_report(0) if errs: @@ -98,9 +98,9 @@ class CheckIntegrity: father_id = family.get_father_id() mother_id = family.get_mother_id() if father_id: - father = self.db.find_person_from_id(father_id) + father = self.db.try_to_find_person_from_id(father_id) if mother_id: - mother = self.db.find_person_from_id(mother_id) + mother = self.db.try_to_find_person_from_id(mother_id) if father_id and family_id not in father.get_family_id_list(): self.broken_parent_links.append((father_id,family_id)) @@ -111,7 +111,7 @@ class CheckIntegrity: mother.add_family_id(family_id) self.db.commit_person(mother,self.trans) for child_id in family.get_child_id_list(): - child = self.db.find_person_from_id(child_id) + child = self.db.try_to_find_person_from_id(child_id) if family_id == child.get_main_parents_family_id(): continue for family_type in child.get_parent_family_id_list(): @@ -128,7 +128,7 @@ class CheckIntegrity: def remove_clicked(): # File is lost => remove all references and the object itself for person_id in self.db.get_family_keys(): - p = self.db.find_family_from_id(person_id) + p = self.db.try_to_find_person_from_id(person_id) nl = p.get_media_list() changed = 0 for o in nl: @@ -140,7 +140,7 @@ class CheckIntegrity: self.db.commit_person(p,self.trans) for key in self.db.get_person_keys(): - p = self.db.find_person_from_id(key) + p = self.db.try_to_find_person_from_id(key) nl = p.get_media_list() changed = 0 for o in nl: @@ -152,7 +152,7 @@ class CheckIntegrity: self.db.commit_person(p,self.trans) for key in self.db.get_source_keys(): - p = self.db.find_source_from_id(key) + p = self.db.try_to_find_source_from_id(key) nl = p.get_media_list() changed = 0 for o in nl: @@ -207,7 +207,7 @@ class CheckIntegrity: #------------------------------------------------------------------------- for ObjectId in self.db.get_object_keys(): - obj = self.db.find_object_from_id(ObjectId) + obj = self.db.try_to_find_object_from_id(ObjectId) photo_name = obj.get_path() if not os.path.isfile(photo_name): if cl: @@ -240,7 +240,7 @@ class CheckIntegrity: def delete_empty_family(self,family_id): for key in self.db.get_person_keys(): - child = self.db.find_person_from_id(key) + child = self.db.try_to_find_person_from_id(key) child.remove_parent_family_id(family_id) child.remove_family_id(family_id) self.db.delete_family(family_id,self.trans) @@ -251,9 +251,9 @@ class CheckIntegrity: mother_id = family.get_mother_id() father_id = family.get_father_id() if father_id: - father = self.db.find_person_from_id(father_id) + father = self.db.try_to_find_person_from_id(father_id) if mother_id: - mother = self.db.find_person_from_id(mother_id) + mother = self.db.try_to_find_person_from_id(mother_id) type = family.get_relationship() if not father_id and not mother_id: @@ -316,11 +316,11 @@ class CheckIntegrity: else: self.text.write(_("%d broken child/family links were found\n") % blink) for (person_id,family_id) in self.broken_links: - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) family = self.db.find_family_from_id(family_id) cn = person.get_primary_name().get_name() - f = self.db.find_person_from_id(family.get_father_id()) - m = self.db.find_person_from_id(family.get_mother_id()) + f = self.db.try_to_find_person_from_id(family.get_father_id()) + m = self.db.try_to_find_person_from_id(family.get_mother_id()) if f and m: pn = _("%s and %s") % (f.get_primary_name().get_name(),\ m.get_primary_name().get_name()) @@ -339,11 +339,11 @@ class CheckIntegrity: else: self.text.write(_("%d broken spouse/family links were found\n") % plink) for (person_id,family_id) in self.broken_parent_links: - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) family = self.db.find_family_from_id(family_id) cn = person.get_primary_name().get_name() - f = self.db.find_person_from_id(family.get_father_id()) - m = self.db.find_person_from_id(family.get_mother_id()) + f = self.db.try_to_find_person_from_id(family.get_father_id()) + m = self.db.try_to_find_person_from_id(family.get_mother_id()) if f and m: pn = _("%s and %s") % (f.get_primary_name().get_name(),\ m.get_primary_name().get_name()) diff --git a/src/plugins/CountAncestors.py b/src/plugins/CountAncestors.py index 923ee973c..958b0b1c9 100644 --- a/src/plugins/CountAncestors.py +++ b/src/plugins/CountAncestors.py @@ -67,7 +67,7 @@ class CountAncestors: temp = thisgen thisgen = [] for person_id in temp: - person = database.find_person_from_id(person_id) + person = database.try_to_find_person_from_id(person_id) family_id = person.get_main_parents_family_id() if family_id: family = database.find_family_from_id(family_id) diff --git a/src/plugins/Desbrowser.py b/src/plugins/Desbrowser.py index 012ba5fcf..6cc7c28f1 100644 --- a/src/plugins/Desbrowser.py +++ b/src/plugins/Desbrowser.py @@ -118,7 +118,7 @@ class DesBrowse: def add_to_tree(self,parent_id,sib_id,person_id): item_id = self.model.insert_after(parent_id,sib_id) - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) self.model.set(item_id,0,GrampsCfg.nameof(person)) self.model.set(item_id,1,person_id) prev_id = None @@ -135,7 +135,7 @@ class DesBrowse: store,iter = self.tree.get_selection().get_selected() if iter: person_id = store.get_value(iter,1) - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) EditPerson.EditPerson(self.parent,person,self.db,self.callback) #------------------------------------------------------------------------ diff --git a/src/plugins/DescendReport.py b/src/plugins/DescendReport.py index ee65634e0..d3d74d5dd 100644 --- a/src/plugins/DescendReport.py +++ b/src/plugins/DescendReport.py @@ -133,7 +133,7 @@ class DescendantReport: childlist.sort(self.by_birthdate) for child_id in childlist: - child = self.database.find_person_from_id(child_id) + child = self.database.try_to_find_person_from_id(child_id) self.dump(level+1,child) #------------------------------------------------------------------------ diff --git a/src/plugins/DetAncestralReport.py b/src/plugins/DetAncestralReport.py index bfff188c8..475582517 100644 --- a/src/plugins/DetAncestralReport.py +++ b/src/plugins/DetAncestralReport.py @@ -79,7 +79,7 @@ class DetAncestorReport(Report.Report): return self.map[index] = person_id - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) family_id = person.get_main_parents_family_id() if family_id: family = self.database.find_family_from_id(family_id) @@ -116,14 +116,14 @@ class DetAncestorReport(Report.Report): self.doc.start_paragraph("DAR-ChildTitle") mother_id = family.get_mother_id() if mother_id: - mother_obj = self.database.find_person_from_id(mother_id) + mother_obj = self.database.try_to_find_person_from_id(mother_id) mother = mother_obj.get_primary_name().get_regular_name() else: mother = _("unknown") father_id = family.get_father_id() if father_id: - father_obj = self.database.find_person_from_id(father_id) + father_obj = self.database.try_to_find_person_from_id(father_id) father = father_obj.get_primary_name().get_regular_name() else: father = _("unknown") @@ -137,7 +137,7 @@ class DetAncestorReport(Report.Report): for child_id in family.get_child_id_list(): self.doc.start_paragraph("DAR-ChildList") - child = self.database.find_person_from_id(child_id) + child = self.database.try_to_find_person_from_id(child_id) name = child.get_primary_name().get_regular_name() birth_id = child.get_birth_id() death_id = child.get_death_id() @@ -157,10 +157,10 @@ class DetAncestorReport(Report.Report): if birth and birth.get_date(): if birth.get_place_id(): - bplace = self.database.find_place_from_id(birth.get_place_id()).get_title() + bplace = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() if death and death.get_date(): if death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \ (name, birth.get_date(), bplace, death.get_date(), dplace)) # f @@ -169,7 +169,7 @@ class DetAncestorReport(Report.Report): (name, birth.get_date(), bplace, death.get_date())) # e elif death and death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ (name, birth.get_date(), bplace, dplace)) # d @@ -179,7 +179,7 @@ class DetAncestorReport(Report.Report): else: if death and death.get_date(): if death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ (name, birth.get_date(), death.get_date(), \ dplace)) # b @@ -187,7 +187,7 @@ class DetAncestorReport(Report.Report): self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, birth.get_date(), death.get_date())) # a elif death and death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, birth.get_date(), dplace)) # 9 else: @@ -195,10 +195,10 @@ class DetAncestorReport(Report.Report): (name, birth.get_date())) # 8 else: if birth and birth.get_place_id(): - bplace = self.database.find_place_from_id(birth.get_place_id()).get_title() + bplace = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() if death and death.get_date(): if death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ (name, bplace, \ death.get_date(), dplace)) # 7 @@ -206,7 +206,7 @@ class DetAncestorReport(Report.Report): self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, bplace, death.get_date())) # 6 elif death and death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, bplace, dplace)) # 5 else: @@ -215,14 +215,14 @@ class DetAncestorReport(Report.Report): else: if death and death.get_date(): if death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Died: %s %s") % \ (name, death.get_date(), dplace)) # 3 else: self.doc.write_text(_("- %s Died: %s") % \ (name, death.get_date())) # 2 elif death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Died: %s") % \ (name, dplace)) # 1 else: @@ -234,7 +234,7 @@ class DetAncestorReport(Report.Report): """Output birth, death, parentage, marriage and notes information """ person_id = self.map[key] - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) if rptOptions.addImages == reportOptions.Yes: self.insert_images(person) @@ -305,7 +305,7 @@ class DetAncestorReport(Report.Report): birth = self.database.find_event_from_id(birth_id) date = birth.get_date_object().get_start_date() if birth.get_place_id(): - place = self.database.find_place_from_id(birth.get_place_id()).get_title() + place = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() if place[-1:] == '.': place = place[:-1] elif rptOptions.blankDate == reportOptions.Yes: @@ -364,7 +364,7 @@ class DetAncestorReport(Report.Report): death = self.database.find_event_from_id(death_id) date = death.get_date_object().get_start_date() if death.get_place_id(): - place = self.database.find_place_from_id(death.get_place_id()).get_title() + place = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() if place[-1:] == '.': place = place[:-1] elif rptOptions.blankPlace == reportOptions.Yes: @@ -447,12 +447,12 @@ class DetAncestorReport(Report.Report): if ext_family_id: ext_family = self.database.find_family_from_id(ext_family_id) if ext_family.get_father_id(): - father_obj = self.database.find_person_from_id(ext_family.get_father_id()) + father_obj = self.database.try_to_find_person_from_id(ext_family.get_father_id()) father = father_obj.get_primary_name().get_regular_name() else: father= "" if ext_family.get_mother_id(): - mother_obj = self.database.find_person_from_id(ext_family.get_mother_id()) + mother_obj = self.database.try_to_find_person_from_id(ext_family.get_mother_id()) mother = mother_obj.get_primary_name().get_regular_name() else: mother= "" @@ -503,7 +503,7 @@ class DetAncestorReport(Report.Report): t= "" if person.get_gender() == RelLib.Person.male: if fam.get_mother_id(): - mother = self.database.find_person_from_id(fam.get_mother_id()) + mother = self.database.try_to_find_person_from_id(fam.get_mother_id()) spouse = mother.get_primary_name().get_regular_name() if fam_num == 1: heshe= _("He") @@ -518,7 +518,7 @@ class DetAncestorReport(Report.Report): else: heshe= _("and she") if fam.get_father_id(): - father = self.database.find_person_from_id(fam.get_father_id()) + father = self.database.try_to_find_person_from_id(fam.get_father_id()) spouse = father.get_primary_name().get_regular_name() for event_id in fam.get_event_list(): @@ -534,7 +534,7 @@ class DetAncestorReport(Report.Report): place = "" if marriage: if marriage.get_place_id(): - place = self.database.find_place_from_id(marriage.get_place_id()).get_title() + place = self.database.try_to_find_place_from_id(marriage.get_place_id()).get_title() elif rptOptions.blankPlace == reportOptions.Yes: place= "____________" @@ -584,7 +584,7 @@ class DetAncestorReport(Report.Report): if mate.get_gender() == RelLib.Person.male: if fam.get_mother_id(): ind_id= fam.get_mother_id() - ind = self.database.find_person_from_id(ind_id) + ind = self.database.try_to_find_person_from_id(ind_id) person = ind.get_primary_name().get_regular_name() firstName = ind.get_primary_name().get_first_name() heshe = _("She") @@ -592,7 +592,7 @@ class DetAncestorReport(Report.Report): heshe= _("He") if fam.get_father_id(): ind_id = fam.get_father_id() - ind = self.database.find_person_from_id(ind_id) + ind = self.database.try_to_find_person_from_id(ind_id) person = ind.get_primary_name().get_regular_name() firstName = ind.get_primary_name().get_first_name() @@ -629,7 +629,7 @@ class DetAncestorReport(Report.Report): photos = person.get_media_list() for photo in photos : object_id = photo.get_reference_id() - object = self.database.find_object_from_id(object_id) + object = self.database.try_to_find_object_from_id(object_id) if object.get_mime_type()[0:5] == "image": file = object.get_path() self.doc.add_media_object(file,"row",4.0,4.0) @@ -672,7 +672,7 @@ class DetAncestorReport(Report.Report): self.genIDs.clear() person_id = self.map[key] - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) self.genIDs[person_id]= key dupPerson= self.write_person(key, rptOpt) if dupPerson == 0: # Is this a duplicate ind record diff --git a/src/plugins/DetDescendantReport.py b/src/plugins/DetDescendantReport.py index bddd72b9c..1ec6d8fc4 100644 --- a/src/plugins/DetDescendantReport.py +++ b/src/plugins/DetDescendantReport.py @@ -85,7 +85,7 @@ class DetDescendantReport(Report.Report): else: self.genKeys[cur_gen-1].append(index) - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) for family_id in person.get_family_id_list(): family = self.database.find_family_from_id(family_id) for child_id in family.get_child_id_list(): @@ -122,12 +122,12 @@ class DetDescendantReport(Report.Report): self.doc.start_paragraph("DDR-ChildTitle") mother_id = family.get_mother_id() if mother_id: - mother = self.database.find_person_from_id(mother_id).get_primary_name().get_regular_name() + mother = self.database.try_to_find_person_from_id(mother_id).get_primary_name().get_regular_name() else: mother = _("unknown") father_id = family.get_father_id() if father_id: - father = self.database.find_person_from_id(father_id).get_primary_name().get_regular_name() + father = self.database.try_to_find_person_from_id(father_id).get_primary_name().get_regular_name() else: father = _("unknown") self.doc.start_bold() @@ -139,7 +139,7 @@ class DetDescendantReport(Report.Report): self.doc.end_paragraph() for child_id in family.get_child_id_list(): - child = self.database.find_person_from_id(child_id) + child = self.database.try_to_find_person_from_id(child_id) self.doc.start_paragraph("DDR-ChildList") name = child.get_primary_name().get_regular_name() birth_id = child.get_birth_id() @@ -160,10 +160,10 @@ class DetDescendantReport(Report.Report): if birth and birth.get_date(): if birth.get_place_id(): - bplace = self.database.find_place_from_id(birth.get_place_id()).get_title() + bplace = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() if death and death.get_date(): if death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \ (name, birth.get_date(), bplace, death.get_date(), dplace)) # f @@ -172,7 +172,7 @@ class DetDescendantReport(Report.Report): (name, birth.get_date(), bplace, death.get_date())) # e elif death and death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s %s Died: %s") % \ (name, birth.get_date(), bplace, dplace)) # d @@ -181,7 +181,7 @@ class DetDescendantReport(Report.Report): else: if death and death.get_date(): if death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ (name, birth.get_date(), death.get_date(), \ dplace)) # b @@ -189,7 +189,7 @@ class DetDescendantReport(Report.Report): self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, birth.get_date(), death.get_date())) # a elif death and death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, birth.get_date(), dplace)) # 9 else: @@ -197,10 +197,10 @@ class DetDescendantReport(Report.Report): (name, birth.get_date())) # 8 else: if birth and birth.get_place_id(): - bplace = self.database.find_place_from_id(birth.get_place_id()).get_title() + bplace = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() if death and death.get_date(): if death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s %s") % \ (name, bplace, \ death.get_date(), dplace)) # 7 @@ -208,7 +208,7 @@ class DetDescendantReport(Report.Report): self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, bplace, death.get_date())) # 6 elif death and death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Born: %s Died: %s") % \ (name, bplace, dplace)) # 5 else: @@ -217,14 +217,14 @@ class DetDescendantReport(Report.Report): else: if death and death.get_date(): if death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Died: %s %s") % \ (name, death.get_date(), dplace)) # 3 else: self.doc.write_text(_("- %s Died: %s") % \ (name, death.get_date())) # 2 elif death and death.get_place_id(): - dplace = self.database.find_place_from_id(death.get_place_id()).get_title() + dplace = self.database.try_to_find_place_from_id(death.get_place_id()).get_title() self.doc.write_text(_("- %s Died: %s") % \ (name, dplace)) # 1 else: @@ -236,7 +236,7 @@ class DetDescendantReport(Report.Report): """Output birth, death, parentage, marriage and notes information """ person_id = self.map[key] - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) if rptOptions.addImages == reportOptions.Yes: self.insert_images(person) @@ -306,7 +306,7 @@ class DetDescendantReport(Report.Report): birth = self.database.find_event_from_id(birth_id) date = birth.get_date_object().get_start_date() if birth.get_place_id(): - place = self.database.find_place_from_id(birth.get_place_id()).get_title() + place = self.database.try_to_find_place_from_id(birth.get_place_id()).get_title() if place[-1:] == '.': place = place[:-1] elif rptOptions.blankDate == reportOptions.Yes: @@ -363,7 +363,7 @@ class DetDescendantReport(Report.Report): date = death.get_date_object().get_start_date() place_id = death.get_place_id() if place_id: - place = self.database.find_place_from_id(place_id).get_title() + place = self.database.try_to_find_place_from_id(place_id).get_title() if place[-1:] == '.': place = place[:-1] elif rptOptions.blankPlace == reportOptions.Yes: @@ -450,12 +450,12 @@ class DetDescendantReport(Report.Report): ext_family = self.database.find_family_from_id(ext_family_id) father_id = ext_family.get_father_id() if father_id: - father = self.database.find_person_from_id(father_id).get_primary_name().get_regular_name() + father = self.database.try_to_find_person_from_id(father_id).get_primary_name().get_regular_name() else: father = "" mother_id = ext_family.get_father_id() if mother_id: - mother = self.database.find_person_from_id(mother_id).get_primary_name().get_regular_name() + mother = self.database.try_to_find_person_from_id(mother_id).get_primary_name().get_regular_name() else: mother = "" @@ -501,7 +501,7 @@ class DetDescendantReport(Report.Report): if person.get_gender() == RelLib.Person.male: mother_id = fam.get_mother_id() if mother_id: - spouse = self.database.find_person_from_id(mother_id).get_primary_name().get_regular_name() + spouse = self.database.try_to_find_person_from_id(mother_id).get_primary_name().get_regular_name() if fam_num == 1: heshe = _("He") elif fam_num < len(famList): @@ -518,7 +518,7 @@ class DetDescendantReport(Report.Report): father_id = fam.get_father_id() if father_id: - spouse = self.database.find_person_from_id(father_id).get_primary_name().get_regular_name() + spouse = self.database.try_to_find_person_from_id(father_id).get_primary_name().get_regular_name() for event_id in fam.get_event_list(): if event_id: @@ -533,7 +533,7 @@ class DetDescendantReport(Report.Report): place = "" if marriage: if marriage.get_place_id(): - place = self.database.find_place_from_id(marriage.get_place_id()).get_title() + place = self.database.try_to_find_place_from_id(marriage.get_place_id()).get_title() elif rptOptions.blankPlace == reportOptions.Yes: place= "____________" @@ -582,14 +582,14 @@ class DetDescendantReport(Report.Report): heshe = _("She") mother_id = fam.get_mother_id() if mother_id: - mate = self.database.find_person_from_id(mother_id) + mate = self.database.try_to_find_person_from_id(mother_id) mateName = mate.get_primary_name().get_regular_name() mateFirstName = mate.get_primary_name().get_first_name() else: heshe = _("He") father_id = fam.get_father_id() if father_id: - mate = self.database.find_person_from_id(father_id) + mate = self.database.try_to_find_person_from_id(father_id) mateName = mate.get_primary_name().get_regular_name() mateFirstName = mate.get_primary_name().get_first_name() @@ -622,7 +622,7 @@ class DetDescendantReport(Report.Report): photos = person.get_media_list() for photo in photos : object_id = photo.get_reference_id() - object = self.database.find_object_from_id(object_id) + object = self.database.try_to_find_object_from_id(object_id) if object.get_mime_type()[0:5] == "image": file = object.get_path() self.doc.add_media_object(file,"row",4.0,4.0) @@ -651,11 +651,11 @@ class DetDescendantReport(Report.Report): if self.start.get_gender() == RelLib.Person.male: mother_id = fam.get_mother_id() if mother_id: - spouseName = self.database.find_person_from_id(mother_id).get_primary_name().get_first_name() + spouseName = self.database.try_to_find_person_from_id(mother_id).get_primary_name().get_first_name() else: father_id = fam.get_father_id() if father_id: - spouseName = self.database.find_person_from_id(father_id).get_primary_name().get_first_name() + spouseName = self.database.try_to_find_person_from_id(father_id).get_primary_name().get_first_name() self.doc.start_paragraph("DDR-Title") if spouseName: @@ -684,7 +684,7 @@ class DetDescendantReport(Report.Report): for key in self.genKeys[generation]: person_id = self.map[key] - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) self.genIDs[person_id]= key dupPerson= self.write_person(key, rptOpt) if dupPerson == 0: # Is this a duplicate ind record diff --git a/src/plugins/EventCmp.py b/src/plugins/EventCmp.py index b6302e8bd..2c81e8353 100644 --- a/src/plugins/EventCmp.py +++ b/src/plugins/EventCmp.py @@ -316,7 +316,7 @@ class DisplayChart: def build_row_data(self): for individual_id in self.my_list: - individual = self.db.find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_id(individual_id) name = individual.get_primary_name().get_name() birth_id = individual.get_birth_id() bdate = "" @@ -326,7 +326,7 @@ class DisplayChart: bdate = birth.get_date() bplace_id = birth.get_place_id() if bplace_id: - bplace = self.db.find_place_from_id(bplace_id).get_title() + bplace = self.db.try_to_find_place_from_id(bplace_id).get_title() death_id = individual.get_death_id() ddate = "" dplace = "" @@ -335,7 +335,7 @@ class DisplayChart: ddate = death.get_date() dplace_id = death.get_place_id() if dplace_id: - dplace = self.db.find_place_from_id(dplace_id).get_title() + dplace = self.db.try_to_find_place_from_id(dplace_id).get_title() map = {} elist = individual.get_event_list()[:] for ievent_id in elist: @@ -368,7 +368,7 @@ class DisplayChart: date = event.get_date() place_id = event.get_place_id() if place_id: - place = self.db.find_place_from_id(place_id).get_title() + place = self.db.try_to_find_place_from_id(place_id).get_title() tlist.append("%s\n%s" % (date, place)) added = 1 else: @@ -387,7 +387,7 @@ class DisplayChart: name, birth, and death. This should be the column titles of the report""" map = {} for individual_id in self.my_list: - individual = self.db.find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_id(individual_id) elist = individual.get_event_list() for event_id in elist: if not event_id: diff --git a/src/plugins/FamilyGroup.py b/src/plugins/FamilyGroup.py index e6bd4a735..c63823794 100644 --- a/src/plugins/FamilyGroup.py +++ b/src/plugins/FamilyGroup.py @@ -135,7 +135,7 @@ class FamilyGroup: if not person_id: return - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) if person.get_gender() == RelLib.Person.male: id = _("Husband") @@ -160,7 +160,7 @@ class FamilyGroup: bdate = birth.get_date() bplace_id = birth.get_place_id() if bplace_id: - bplace = self.db.find_place_from_id(bplace_id).get_title() + bplace = self.db.try_to_find_place_from_id(bplace_id).get_title() death_id = person.get_death_id() ddate = "" @@ -170,7 +170,7 @@ class FamilyGroup: ddate = death.get_date() dplace_id = death.get_place_id() if dplace_id: - dplace = self.db.find_place_from_id(dplace_id).get_title() + dplace = self.db.try_to_find_place_from_id(dplace_id).get_title() self.doc.start_row() self.doc.start_cell("FGR-TextContents") @@ -215,10 +215,10 @@ class FamilyGroup: family = self.db.find_family_from_id(family_id) father_id = family.get_father_id() if father_id: - father_name = self.db.find_person_from_id(father_id).get_primary_name().get_regular_name() + father_name = self.db.try_to_find_person_from_id(father_id).get_primary_name().get_regular_name() mother_id = family.get_mother_id() if mother_id: - mother_name = self.db.find_person_from_id(mother_id).get_primary_name().get_regular_name() + mother_name = self.db.try_to_find_person_from_id(mother_id).get_primary_name().get_regular_name() self.doc.start_row() self.doc.start_cell("FGR-TextContents") @@ -255,7 +255,7 @@ class FamilyGroup: date = event.get_date() place_id = event.get_place_id() if place_id: - place = self.db.find_place_from_id(place_id).get_title() + place = self.db.try_to_find_place_from_id(place_id).get_title() self.doc.start_row() self.doc.start_cell(text) @@ -281,7 +281,7 @@ class FamilyGroup: def dump_child(self,index,person_id): - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) self.doc.start_row() self.doc.start_cell('FGR-TextChild1') self.doc.start_paragraph('FGR-ChildText') @@ -344,7 +344,7 @@ class FamilyGroup: self.doc.start_cell('FGR-TextContentsEnd',2) self.doc.start_paragraph('FGR-Normal') if spouse_id: - spouse = self.db.find_person_from_id(spouse_id) + spouse = self.db.try_to_find_person_from_id(spouse_id) self.doc.write_text(spouse.get_primary_name().get_regular_name()) self.doc.end_paragraph() self.doc.end_cell() @@ -547,7 +547,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog): return 1 def get_report_extra_menu_info(self): - self.spouse_map = _build_spouse_map(self.person) + self.spouse_map = _build_spouse_map(self.db,self.person) return (_("Spouse"), self.spouse_map, None, None) def on_center_person_change_clicked(self,obj): @@ -556,7 +556,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog): new_person = sel_person.run() if new_person: self.new_person = new_person - self.new_spouse_map = _build_spouse_map(self.new_person) + self.new_spouse_map = _build_spouse_map(self.db,self.new_person) if self.new_spouse_map: if not self.extra_menu: @@ -577,7 +577,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog): self.extra_menu = None new_name = new_person.get_primary_name().get_regular_name() - if new_name: + if new_name: self.person_label.set_text( "%s" % new_name ) self.person_label.set_use_markup(gtk.TRUE) @@ -619,7 +619,7 @@ def write_book_item(database,person,doc,options,newpage=0): if options[0]: person = database.get_person(options[0]) spouse_name = options[1] - spouse_map = _build_spouse_map(person) + spouse_map = _build_spouse_map(database,person) if spouse_map: if spouse_map.has_key(spouse_name): family = spouse_map[spouse_name] @@ -704,7 +704,7 @@ def _build_spouse_map(database,person): else: spouse_id = family.get_father_id() if spouse_id: - spouse = database.find_person_from_id(spouse_id) + spouse = database.try_to_find_person_from_id(spouse_id) name = spouse.get_primary_name().get_name() else: name= _("unknown") diff --git a/src/plugins/FanChart.py b/src/plugins/FanChart.py index fe4adb7c7..0ba117012 100644 --- a/src/plugins/FanChart.py +++ b/src/plugins/FanChart.py @@ -165,7 +165,7 @@ class FanChart: self.lines = max(self.lines,len(self.text[index-1])) - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) family_id = person.get_main_parents_family_id() if family_id: family = self.database.find_family_from_id(family_id) @@ -202,7 +202,7 @@ class FanChart: self.doc.close() def get_info(self,person_id): - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) pn = person.get_primary_name() birth_id = person.get_birth_id() diff --git a/src/plugins/FilterEditor.py b/src/plugins/FilterEditor.py index 4f60cd06c..af0c56c25 100644 --- a/src/plugins/FilterEditor.py +++ b/src/plugins/FilterEditor.py @@ -534,7 +534,7 @@ class EditRule: self.add_places = [] for p_id in self.db.get_place_ids(): - p = self.db.find_place_from_id(p_id) + p = self.db.try_to_find_place_from_id(p_id) self.pmap[p.get_title()] = p_id self.active_rule = val @@ -764,7 +764,7 @@ class ShowResults: n = [] for p_id in id_list: - p = db.find_person_from_id(p_id) + p = db.try_to_find_person_from_id(p_id) n.append ("%s [%s]\n" % (p.get_primary_name().get_name(),p.get_id())) n.sort () diff --git a/src/plugins/FtmStyleAncestors.py b/src/plugins/FtmStyleAncestors.py index 0675dee77..9df2a5257 100644 --- a/src/plugins/FtmStyleAncestors.py +++ b/src/plugins/FtmStyleAncestors.py @@ -69,7 +69,7 @@ class FtmAncestorReport(Report.Report): return self.map[index] = (person_id,generation) - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) family_id = person.get_main_parents_family_id() if family_id: family = self.database.find_family_from_id(family_id) @@ -103,7 +103,7 @@ class FtmAncestorReport(Report.Report): self.doc.end_paragraph() old_gen = generation - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) pri_name = person.get_primary_name() self.doc.start_paragraph("FTA-Entry","%d." % key) name = pri_name.get_regular_name() @@ -119,7 +119,7 @@ class FtmAncestorReport(Report.Report): birth = self.database.find_event_from_id(birth_id) place_id = birth.get_place_id() if place_id: - bplace = self.database.find_place_from_id(place_id).get_title() + bplace = self.database.try_to_find_place_from_id(place_id).get_title() else: bplace = u'' bdate = birth.get_date() @@ -134,7 +134,7 @@ class FtmAncestorReport(Report.Report): death = self.database.find_event_from_id(death_id) place_id = death.get_place_id() if place_id: - dplace = self.database.find_place_from_id(place_id).get_title() + dplace = self.database.try_to_find_place_from_id(place_id).get_title() else: dplace = u'' ddate = death.get_date() @@ -448,7 +448,7 @@ class FtmAncestorReport(Report.Report): keys.sort() for key in keys: srcref = self.sref_map[key] - base = self.database.find_source_from_id(srcref.get_base_id()) + base = self.database.try_to_find_source_from_id(srcref.get_base_id()) self.doc.start_paragraph('FTA-Endnotes',"%d." % key) self.doc.write_text(base.get_title()) @@ -537,7 +537,7 @@ class FtmAncestorReport(Report.Report): date = event.get_date() place_id = event.get_place_id() if place_id: - place = self.database.find_place_from_id(place_id).get_title() + place = self.database.try_to_find_place_from_id(place_id).get_title() else: place = u'' @@ -584,7 +584,7 @@ class FtmAncestorReport(Report.Report): spouse_id = family.get_father_id() if not spouse_id: return - spouse = self.database.find_person_from_id(spouse_id) + spouse = self.database.try_to_find_person_from_id(spouse_id) spouse_name = spouse.get_primary_name().get_regular_name() for event_id in family.get_event_list(): @@ -598,7 +598,7 @@ class FtmAncestorReport(Report.Report): date = event.get_date() place_id = event.get_place_id() if place_id: - place = self.database.find_place_from_id(place_id).get_title() + place = self.database.try_to_find_place_from_id(place_id).get_title() else: place = u'' @@ -657,7 +657,7 @@ class FtmAncestorReport(Report.Report): ddate = death.get_date() place_id = death.get_place_id() if place_id: - dplace = self.database.find_place_from_id(place_id).get_title() + dplace = self.database.try_to_find_place_from_id(place_id).get_title() else: dplace = u'' else: @@ -672,7 +672,7 @@ class FtmAncestorReport(Report.Report): bdate = birth.get_date() place_id = birth.get_place_id() if place_id: - bplace = self.database.find_place_from_id(place_id).get_title() + bplace = self.database.try_to_find_place_from_id(place_id).get_title() else: bplace = u'' else: @@ -962,10 +962,10 @@ class FtmAncestorReport(Report.Report): mother_id = family.get_mother_id() father_id = family.get_father_id() if mother_id: - mother = self.database.find_person_from_id(mother_id) + mother = self.database.try_to_find_person_from_id(mother_id) mother_name = mother.get_primary_name().get_regular_name() if father_id: - father = self.database.find_person_from_id(father_id) + father = self.database.try_to_find_person_from_id(father_id) father_name = father.get_primary_name().get_regular_name() if person.get_gender() == RelLib.Person.male: diff --git a/src/plugins/FtmStyleDescendants.py b/src/plugins/FtmStyleDescendants.py index 1c148c95e..e3874f4ae 100644 --- a/src/plugins/FtmStyleDescendants.py +++ b/src/plugins/FtmStyleDescendants.py @@ -97,7 +97,7 @@ class FtmDescendantReport(Report.Report): self.gen_map[generation] = [] self.gen_map[generation].append(index) - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) for family_id in person.get_family_id_list(): family = self.database.find_family_from_id(family_id) for child_id in family.get_child_id_list(): @@ -133,7 +133,7 @@ class FtmDescendantReport(Report.Report): indexlist.sort() for key in indexlist: person_id = self.anc_map[key] - person = self.database.find_person_from_id(person_id) + person = self.database.try_to_find_person_from_id(person_id) pri_name = person.get_primary_name() self.doc.start_paragraph("FTD-Entry","%d." % key) @@ -152,7 +152,7 @@ class FtmDescendantReport(Report.Report): bdate = birth.get_date() bplace_id = birth.get_place_id() if bplace_id: - bplace = self.database.find_place_from_id(bplace_id).get_title() + bplace = self.database.try_to_find_place_from_id(bplace_id).get_title() death_id = person.get_death_id() dplace = "" @@ -162,7 +162,7 @@ class FtmDescendantReport(Report.Report): ddate = death.get_date() dplace_id = death.get_place_id() if dplace_id: - dplace = self.database.find_place_from_id(dplace_id).get_title() + dplace = self.database.try_to_find_place_from_id(dplace_id).get_title() birth_valid = bdate or bplace death_valid = ddate or dplace @@ -476,7 +476,7 @@ class FtmDescendantReport(Report.Report): for key in keys: srcref = self.sref_map[key] base_id = srcref.get_base_id() - base = self.database.find_source_from_id(base_id) + base = self.database.try_to_find_source_from_id(base_id) self.doc.start_paragraph('FTD-Endnotes',"%d." % key) self.doc.write_text(base.get_title()) @@ -567,7 +567,7 @@ class FtmDescendantReport(Report.Report): date = event.get_date() place_id = event.get_place_id() if place_id: - place = self.database.find_place_from_id(place_id) + place = self.database.try_to_find_place_from_id(place_id) else: place = None @@ -612,8 +612,8 @@ class FtmDescendantReport(Report.Report): father_id = family.get_father_id() mother_id = family.get_mother_id() if father_id and mother_id: - husband = self.database.find_person_from_id(father_id).get_primary_name().get_regular_name() - wife = self.database.find_person_from_id(mother_id).get_primary_name().get_regular_name() + husband = self.database.try_to_find_person_from_id(father_id).get_primary_name().get_regular_name() + wife = self.database.try_to_find_person_from_id(mother_id).get_primary_name().get_regular_name() else: continue for event_id in family.get_event_list(): @@ -623,7 +623,7 @@ class FtmDescendantReport(Report.Report): date = event.get_date() place_id = event.get_place_id() if place_id: - place = self.database.find_place_from_id(place_id) + place = self.database.try_to_find_place_from_id(place_id) else: place = None @@ -672,11 +672,11 @@ class FtmDescendantReport(Report.Report): spouse_id = mother_id else: spouse_id = father_id - spouse = self.database.find_person_from_id(spouse_id) + spouse = self.database.try_to_find_person_from_id(spouse_id) child_index = 0 for child_id in family.get_child_id_list(): - child = self.database.find_person_from_id(child_id) + child = self.database.try_to_find_person_from_id(child_id) child_index = child_index + 1 child_name = child.get_primary_name().get_regular_name() for (ind,p_id) in self.anc_map.items(): @@ -718,7 +718,7 @@ class FtmDescendantReport(Report.Report): bdate = birth.get_date() bplace_id = birth.get_place_id() if bplace_id: - bplace = self.database.find_place_from_id(bplace_id).get_title() + bplace = self.database.try_to_find_place_from_id(bplace_id).get_title() death_id = child.get_death_id() dplace = "" @@ -728,7 +728,7 @@ class FtmDescendantReport(Report.Report): ddate = death.get_date() dplace_id = death.get_place_id() if dplace_id: - dplace = self.database.find_place_from_id(dplace_id).get_title() + dplace = self.database.try_to_find_place_from_id(dplace_id).get_title() if child.get_gender() == RelLib.Person.male: if bdate: @@ -1007,7 +1007,7 @@ class FtmDescendantReport(Report.Report): spouse_id = family.get_father_id() if not spouse_id: return - spouse = self.database.find_person_from_id(spouse_id) + spouse = self.database.try_to_find_person_from_id(spouse_id) for event_id in family.get_event_list(): if event_id: @@ -1022,7 +1022,7 @@ class FtmDescendantReport(Report.Report): date = event.get_date() place_id = event.get_place_id() if place_id: - place = self.database.find_place_from_id(place_id).get_title() + place = self.database.try_to_find_place_from_id(place_id).get_title() else: place = "" @@ -1080,7 +1080,7 @@ class FtmDescendantReport(Report.Report): bdate = birth.get_date() bplace_id = birth.get_place_id() if bplace_id: - bplace = self.database.find_place_from_id(bplace_id).get_title() + bplace = self.database.try_to_find_place_from_id(bplace_id).get_title() death_id = spouse.get_death_id() dplace = "" @@ -1090,7 +1090,7 @@ class FtmDescendantReport(Report.Report): ddate = death.get_date() dplace_id = death.get_place_id() if dplace_id: - dplace = self.database.find_place_from_id(dplace_id).get_title() + dplace = self.database.try_to_find_place_from_id(dplace_id).get_title() death_valid = ddate or dplace birth_valid = bdate or bplace @@ -1384,12 +1384,12 @@ class FtmDescendantReport(Report.Report): family = self.database.find_family_from_id(family_id) mother_id = family.get_mother_id() if mother_id: - mother = self.database.find_person_from_id(mother_id) + mother = self.database.try_to_find_person_from_id(mother_id) else: mother = None father_id = family.get_father_id() if father_id: - father = self.database.find_person_from_id(father_id) + father = self.database.try_to_find_person_from_id(father_id) else: father = None if person.get_gender() == RelLib.Person.male: diff --git a/src/plugins/GraphViz.py b/src/plugins/GraphViz.py index 2de365057..8c17c8b79 100644 --- a/src/plugins/GraphViz.py +++ b/src/plugins/GraphViz.py @@ -396,7 +396,7 @@ def dump_person(database,person_list,file,adoptionsdashed,arrowheadstyle, for person_id in person_list: pid = string.replace(person_id,'-','_') - person = database.find_person_from_id(person_id) + person = database.try_to_find_person_from_id(person_id) for family_id, mrel, frel in person.get_parent_family_id_list(): family = database.find_family_from_id(family_id) father_id = family.get_father_id() @@ -450,7 +450,7 @@ def dump_index(database,person_list,file,includedates,includeurl,colorize, # don't do it twice. families_done = [] for person_id in person_list: - person = database.find_person_from_id(person_id) + person = database.try_to_find_person_from_id(person_id) # Output the person's node. label = person.get_primary_name().get_name() id = string.replace(person_id,'-','_') diff --git a/src/plugins/IndivComplete.py b/src/plugins/IndivComplete.py index 3e54c086c..2d35aab15 100644 --- a/src/plugins/IndivComplete.py +++ b/src/plugins/IndivComplete.py @@ -110,7 +110,7 @@ class IndivComplete(Report.Report): self.d.add_cell_style("IDS-NormalCell",cell) cell = BaseDoc.TableCellStyle() - cell.set_longlist(1) + cell.set_longlist(1) self.d.add_cell_style("IDS-ListCell",cell) def end(self): @@ -124,7 +124,7 @@ class IndivComplete(Report.Report): date = event.get_date() place_id = event.get_place_id() if place_id: - place = self.database.find_place_from_id(place_id).get_title() + place = self.database.try_to_find_place_from_id(place_id).get_title() else: place = "" description = event.get_description() @@ -206,9 +206,9 @@ class IndivComplete(Report.Report): continue family = self.database.find_family_from_id(family_id) - father_id = family.get_father_id() + father_id = family.get_father_id() if father_id: - father = self.database.find_person_from_id(father_id) + father = self.database.try_to_find_person_from_id(father_id) fname = father.get_primary_name().get_regular_name() frel = const.child_relations.find_value(frel) self.write_p_entry(_('Father'),fname,frel) @@ -217,7 +217,7 @@ class IndivComplete(Report.Report): mother_id = family.get_mother_id() if mother_id: - mother = self.database.find_person_from_id(mother_id) + mother = self.database.try_to_find_person_from_id(mother_id) fname = mother.get_primary_name().get_regular_name() frel = const.child_relations.find_value(frel) self.write_p_entry(_('Mother'),fname,frel) @@ -281,7 +281,7 @@ class IndivComplete(Report.Report): self.d.start_cell("IDS-NormalCell",2) self.d.start_paragraph("IDS-Spouse") if spouse_id: - spouse = self.database.find_person_from_id(spouse_id) + spouse = self.database.try_to_find_person_from_id(spouse_id) text = spouse.get_primary_name().get_regular_name() else: text = _("unknown") @@ -309,7 +309,7 @@ class IndivComplete(Report.Report): first = 0 else: self.d.write_text('\n') - child = self.database.find_person_from_id(child_id) + child = self.database.try_to_find_person_from_id(child_id) self.d.write_text(child.get_primary_name().get_regular_name()) self.d.end_paragraph() self.d.end_cell() @@ -336,7 +336,7 @@ class IndivComplete(Report.Report): self.d.start_row() s_id = source.get_base_id() self.normal_cell(s_id) - src = self.database.find_source_from_id(s_id) + src = self.database.try_to_find_source_from_id(s_id) self.normal_cell(src.get_title()) self.d.end_row() self.d.end_table() @@ -356,7 +356,7 @@ class IndivComplete(Report.Report): for event_id in event_id_list: if event_id: event = self.database.find_event_from_id(event_id) - self.write_fact(event) + self.write_fact(event) self.d.end_table() self.d.start_paragraph("IDS-Normal") self.d.end_paragraph() @@ -381,7 +381,7 @@ class IndivComplete(Report.Report): count = 0 for person_id in ind_list: - self.person = self.database.find_person_from_id(person_id) + self.person = self.database.try_to_find_person_from_id(person_id) self.write_person(count) count = count + 1 self.end() @@ -402,7 +402,7 @@ class IndivComplete(Report.Report): if len(media_list) > 0: object_id = media_list[0].get_reference_id() - object = self.database.find_object_from_id(object_id) + object = self.database.try_to_find_object_from_id(object_id) if object.get_mime_type()[0:5] == "image": file = object.get_path() self.d.start_paragraph("IDS-Normal") @@ -435,13 +435,13 @@ class IndivComplete(Report.Report): family = self.database.find_family_from_id(family_id) father_inst_id = family.get_father_id() if father_inst_id: - father_inst = self.database.find_person_from_id(father_inst_id) + father_inst = self.database.try_to_find_person_from_id(father_inst_id) father = father_inst.get_primary_name().get_regular_name() else: father = "" mother_inst_id = family.get_mother_id() if mother_inst_id: - mother_inst = self.database.find_person_from_id(mother_inst_id) + mother_inst = self.database.try_to_find_person_from_id(mother_inst_id) mother = mother_inst.get_primary_name().get_regular_name() else: mother = "" diff --git a/src/plugins/IndivSummary.py b/src/plugins/IndivSummary.py index 977a0d26b..44fb45ebd 100644 --- a/src/plugins/IndivSummary.py +++ b/src/plugins/IndivSummary.py @@ -118,7 +118,7 @@ class IndivSummary(Report.Report): date = event.get_date() place_id = event.get_place_id() if place_id: - place_obj = self.database.find_place_from_id(place_id) + place_obj = self.database.try_to_find_place_from_id(place_id) place = place_obj.get_title() else: place = "" @@ -178,7 +178,7 @@ class IndivSummary(Report.Report): self.d.start_cell("IVS-NormalCell",2) self.d.start_paragraph("IVS-Spouse") if spouse_id: - spouse = self.database.find_person_from_id(spouse_id) + spouse = self.database.try_to_find_person_from_id(spouse_id) self.d.write_text(spouse.get_primary_name().get_regular_name()) else: self.d.write_text(_("unknown")) @@ -208,7 +208,7 @@ class IndivSummary(Report.Report): first = 0 else: self.d.write_text('\n') - child = self.database.find_person_from_id(child_id) + child = self.database.try_to_find_person_from_id(child_id) self.d.write_text(child.get_primary_name().get_regular_name()) self.d.end_paragraph() self.d.end_cell() @@ -232,7 +232,7 @@ class IndivSummary(Report.Report): if len(media_list) > 0: object_id = media_list[0].get_reference_id() - object = self.database.find_object_from_id(object_id) + object = self.database.try_to_find_object_from_id(object_id) if object.get_mime_type()[0:5] == "image": file = object.get_path() self.d.start_paragraph("IVS-Normal") @@ -277,13 +277,13 @@ class IndivSummary(Report.Report): family = self.database.find_family_from_id(fam_id) father_id = family.get_father_id() if father_id: - dad = self.database.find_person_from_id(father_id) + dad = self.database.try_to_find_person_from_id(father_id) father = dad.get_primary_name().get_regular_name() else: father = "" mother_id = family.get_mother_id() if mother_id: - mom = self.database.find_person_from_id(mother_id) + mom = self.database.try_to_find_person_from_id(mother_id) mother = mom.get_primary_name().get_regular_name() else: mother = "" diff --git a/src/plugins/Merge.py b/src/plugins/Merge.py index 606cb1db7..801cb381d 100644 --- a/src/plugins/Merge.py +++ b/src/plugins/Merge.py @@ -147,7 +147,7 @@ class Merge: if (not p1_id) or (p1_id in id_list): return id_list.append(p1_id) - p1 = self.db.find_person_from_id(p1_id) + p1 = self.db.try_to_find_person_from_id(p1_id) f1_id = p1.get_main_parents_family_id() if f1_id: f1 = self.db.find_family_from_id(f1_id) @@ -179,7 +179,7 @@ class Merge: males = {} females = {} for p1_id in self.person_list: - p1 = self.db.find_person_from_id(p1_id) + p1 = self.db.try_to_find_person_from_id(p1_id) key = self.gen_key(p1.get_primary_name().get_surname()) if p1.get_gender() == RelLib.Person.male: if males.has_key(key): @@ -196,7 +196,7 @@ class Merge: num = 0 for p1key in self.person_list: - p1 = self.db.find_person_from_id(p1key) + p1 = self.db.try_to_find_person_from_id(p1key) if num % 25 == 0: self.progress_update((float(num)/float(length))*100) num = num + 1 @@ -212,7 +212,7 @@ class Merge: index = index + 1 if p1key == p2key: continue - p2 = self.db.find_person_from_id(p2key) + p2 = self.db.try_to_find_person_from_id(p2key) if self.map.has_key(p2key): (v,c) = self.map[p2key] if v == p1key: @@ -292,8 +292,8 @@ class Merge: for (c,p1key,p2key) in list: c1 = "%5.2f" % c c2 = "%5.2f" % (100-c) - pn1 = self.db.find_person_from_id(p1key).get_primary_name().get_name() - pn2 = self.db.find_person_from_id(p2key).get_primary_name().get_name() + pn1 = self.db.try_to_find_person_from_id(p1key).get_primary_name().get_name() + pn2 = self.db.try_to_find_person_from_id(p2key).get_primary_name().get_name() self.list.add([c, pn1, pn2,c2],(p1key,p2key)) def on_do_merge_clicked(self,obj): @@ -302,8 +302,8 @@ class Merge: return (p1,p2) = self.list.get_object(iter) - pn1 = self.db.find_person_from_id(p1) - pn2 = self.db.find_person_from_id(p2) + pn1 = self.db.try_to_find_person_from_id(p1) + pn2 = self.db.try_to_find_person_from_id(p2) MergeData.MergePeople(self.parent,self.db,pn1,pn2,self.on_update) def on_update(self,p1_id,p2_id,old_id): @@ -438,13 +438,13 @@ class Merge: if not p1_id: name1 = "" else: - p1 = self.db.find_place_from_id(p1_id) + p1 = self.db.try_to_find_place_from_id(p1_id) name1 = p1.get_title() if not p2_id: name2 = "" else: - p2 = self.db.find_place_from_id(p2_id) + p2 = self.db.try_to_find_place_from_id(p2_id) name2 = p2.get_title() if not (name1 and name2): @@ -540,12 +540,12 @@ class Merge: f2 = self.db.find_family_from_id(f2_id) dad1_id = f1.get_father_id() if dad1_id: - dad1 = get_name_obj(self.db.find_person_from_id(dad1_id)) + dad1 = get_name_obj(self.db.try_to_find_person_from_id(dad1_id)) else: dad1 = None dad2_id = f2.get_father_id() if dad2_id: - dad2 = get_name_obj(self.db.find_person_from_id(dad2_id)) + dad2 = get_name_obj(self.db.try_to_find_person_from_id(dad2_id)) else: dad2 = None @@ -558,12 +558,12 @@ class Merge: mom1_id = f1.get_mother_id() if mom1_id: - mom1 = get_name_obj(self.db.find_person_from_id(mom1_id)) + mom1 = get_name_obj(self.db.try_to_find_person_from_id(mom1_id)) else: mom1 = None mom2_id = f2.get_mother_id() if mom2_id: - mom2 = get_name_obj(self.db.find_person_from_id(mom2_id)) + mom2 = get_name_obj(self.db.try_to_find_person_from_id(mom2_id)) else: mom2 = None @@ -584,8 +584,8 @@ class Merge: if father1_id == father2_id: chance = chance + 1 else: - father1 = self.db.find_person_from_id(father1_id) - father2 = self.db.find_person_from_id(father2_id) + father1 = self.db.try_to_find_person_from_id(father1_id) + father2 = self.db.try_to_find_person_from_id(father2_id) fname1 = get_name_obj(father1) fname2 = get_name_obj(father2) value = self.name_match(fname1,fname2) @@ -598,8 +598,8 @@ class Merge: if mother1_id == mother2_id: chance = chance + 1 else: - mother1 = self.db.find_person_from_id(mother1_id) - mother2 = self.db.find_person_from_id(mother2_id) + mother1 = self.db.try_to_find_person_from_id(mother1_id) + mother2 = self.db.try_to_find_person_from_id(mother2_id) mname1 = get_name_obj(mother1) mname2 = get_name_obj(mother2) value = self.name_match(mname1,mname2) diff --git a/src/plugins/PatchNames.py b/src/plugins/PatchNames.py index 248d23787..5f7306491 100644 --- a/src/plugins/PatchNames.py +++ b/src/plugins/PatchNames.py @@ -89,7 +89,7 @@ class PatchNames: for key in self.db.get_person_keys(): - person = self.db.find_person_from_id(key) + person = self.db.try_to_find_person_from_id(key) first = person.get_primary_name().get_first_name() match = _title_re.match(first) if match: @@ -157,7 +157,7 @@ class PatchNames: self.title_hash = {} for (id,name,nick) in self.nick_list: - p = self.db.find_person_from_id(id) + p = self.db.try_to_find_person_from_id(id) iter = self.model.append() self.model.set_value(iter,0,1) self.model.set_value(iter,1,id) @@ -167,7 +167,7 @@ class PatchNames: self.nick_hash[id] = iter for (id,title,nick) in self.title_list: - p = self.db.find_person_from_id(id) + p = self.db.try_to_find_person_from_id(id) iter = self.model.append() self.model.set_value(iter,0,1) self.model.set_value(iter,1,id) @@ -215,7 +215,7 @@ class PatchNames: iter = self.title_hash[grp[0]] val = self.model.get_value(iter,0) if val: - p = self.db.find_person_from_id(grp[0]) + p = self.db.try_to_find_person_from_id(grp[0]) name = p.get_primary_name() name.set_first_name(grp[2].strip()) name.set_title(grp[1].strip()) diff --git a/src/plugins/RelCalc.py b/src/plugins/RelCalc.py index 5987ef828..0ed18e8f7 100644 --- a/src/plugins/RelCalc.py +++ b/src/plugins/RelCalc.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -144,12 +144,12 @@ class RelCalc: length = len(common) if length == 1: - person = self.db.find_person_from_id(common[0]) + person = self.db.try_to_find_person_from_id(common[0]) name = person.get_primary_name().get_regular_name() commontext = " " + _("Their common ancestor is %s.") % name elif length == 2: - p1 = self.db.find_person_from_id(common[0]) - p2 = self.db.find_person_from_id(common[1]) + p1 = self.db.try_to_find_person_from_id(common[0]) + p2 = self.db.try_to_find_person_from_id(common[1]) commontext = " " + _("Their common ancestors are %s and %s.") % \ (p1.get_primary_name().get_regular_name(),\ p2.get_primary_name().get_regular_name()) @@ -157,7 +157,7 @@ class RelCalc: index = 0 commontext = " " + _("Their common ancestors are : ") for person_id in common: - person = self.db.find_person_form_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) if index != 0: commontext = commontext + ", " commontext = commontext + person.get_primary_name().get_regular_name() diff --git a/src/plugins/RelGraph.py b/src/plugins/RelGraph.py index 6025c9913..f26fb79ec 100644 --- a/src/plugins/RelGraph.py +++ b/src/plugins/RelGraph.py @@ -506,7 +506,7 @@ def _write_graph_box (self): _write_node(self.File, shape='ellipse', color='black', fontname=self.FontStyle) for individual_id in individual_nodes: - individual = self.db.find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_id(individual_id) for family_id in individual.get_family_id_list(): if family_id not in family_nodes: family_nodes.add(family_id) @@ -518,7 +518,7 @@ def _write_graph_box (self): _write_edge(self.File, style="solid", arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle) for individual_id in individual_nodes: - individual = self.db.find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_id(individual_id) for family_id, mother_rel_ship, father_rel_ship\ in individual.get_parent_family_id_list(): family = self.db.find_family_from_id(family_id) @@ -554,7 +554,7 @@ def _write_graph_box (self): females = 0 unknowns = 0 for individual_id in individual_nodes: - individual = self.db.find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_id(individual_id) if individual.get_gender() == individual.male: males = males + 1 elif individual.get_gender() == individual.female: @@ -596,7 +596,7 @@ def _write_graph_record (self): for individual_id in natural_relatives: # If both husband and wife are members of the IndividualSet, # only one record, with the husband first, is displayed. - individual = self.db.find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_id(individual_id) if individual.get_gender() == individual.female: # There are exactly three cases where a female node is added: family_id = None # no family @@ -633,7 +633,7 @@ def _write_graph_record (self): arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle) for family_from_id, family_from_id2 in family_nodes.items(): for individual_from_id in family_from_id2: - individual_from = self.db.find_person_from_id(individual_from_id) + individual_from = self.db.try_to_find_person_from_id(individual_from_id) for family_id, mother_rel_ship, father_rel_ship\ in individual_from.get_parent_family_id_list(): family = self.db.find_family_from_id(family_id) @@ -671,7 +671,7 @@ def _write_graph_record (self): for family_id, family_id2 in family_nodes.items(): marriages = marriages + (len(family_id2) - 1) for individual_id in family_id2: - individual = self.db.find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_id(individual_id) if individual.get_gender() == individual.male\ and individual_id not in males: males.add(individual_id) @@ -692,7 +692,7 @@ def _get_individual_data (self, individual_id): """Returns a tuple of individual data""" # color color = '' - individual = self.db.find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_id(individual_id) if self.Colorize: gender = individual.get_gender() if gender == individual.male: @@ -724,7 +724,7 @@ def _get_event_label (self, event_id): elif self.PlaceCause: place_id = event.get_place_id() if place_id: - place = self.db.find_place_from_id(place_id) + place = self.db.try_to_find_place_from_id(place_id) return place.get_title() else: return event.get_cause() @@ -743,7 +743,7 @@ def _get_individual_label (self, individual_id, marriage_event_id=None, family_i individual's and family's IDs. """ # Get data ready - individual = self.db.find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_id(individual_id) name = individual.get_primary_name().get_name() if self.IncludeDates: birth = _get_event_label(self, individual.get_birth_id()) @@ -813,9 +813,9 @@ def _get_family_id_record_label (self, record): """Returns a formatted string of a family record suitable for a label""" labels = [] spouse_id = record[0] - spouse = self.db.find_person_from_id(spouse_id) + spouse = self.db.try_to_find_person_from_id(spouse_id) for individual_id in record: - individual = self.db.find_person_from_id(individual_id) + individual = self.db.try_to_find_person_from_id(individual_id) if spouse_id == individual_id: label = _get_individual_label(self, individual_id) else: diff --git a/src/plugins/SoundGen.py b/src/plugins/SoundGen.py index c72d89b5b..4116f9bd2 100644 --- a/src/plugins/SoundGen.py +++ b/src/plugins/SoundGen.py @@ -68,7 +68,7 @@ class SoundGen: names = [] for person_id in self.db.get_person_keys(): - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) lastname = person.get_primary_name().get_surname() if lastname not in names: names.append(lastname) diff --git a/src/plugins/Summary.py b/src/plugins/Summary.py index 4f5e0910a..3ff8ab0d6 100644 --- a/src/plugins/Summary.py +++ b/src/plugins/Summary.py @@ -71,7 +71,7 @@ def build_report(database,person): pobjects = len(database.get_object_keys()) for photo_id in database.get_object_keys(): - photo = database.find_object_from_id(photo_id) + photo = database.try_to_find_object_from_id(photo_id) try: bytes = bytes + posixpath.getsize(photo.get_path()) except: @@ -83,7 +83,7 @@ def build_report(database,person): with_photos = with_photos + 1 total_photos = total_photos + length - person = database.find_person_from_id(person_id) + person = database.try_to_find_person_from_id(person_id) name = person.get_primary_name() if name.get_first_name() == "" or name.get_surname() == "": incomp_names = incomp_names + 1 diff --git a/src/plugins/TimeLine.py b/src/plugins/TimeLine.py index 205bf630f..e1e9eb806 100644 --- a/src/plugins/TimeLine.py +++ b/src/plugins/TimeLine.py @@ -184,7 +184,7 @@ class TimeLine: self.plist.sort(self.sort_func) for p_id in self.plist: - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) b_id = p.get_birth_id() if b_id: b = self.db.find_event_from_id(b_id).get_date_object().get_year() @@ -282,7 +282,7 @@ class TimeLine: self.plist = self.filter.apply(self.db,self.db.get_person_keys()) for p_id in self.plist: - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) b_id = p.get_birth_id() if b_id: b = self.db.find_event_from_id(b_id).get_date_object().get_year() @@ -321,7 +321,7 @@ class TimeLine: size = 0 for p_id in self.plist: - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) n = p.get_primary_name().get_name() size = max(FontScale.string_width(font,n),size) return pt2cm(size) @@ -641,7 +641,7 @@ def write_book_item(database,person,doc,options,newpage=0): filters = _get_report_filters(person) afilter = filters[filter_num] sort_func_num = int(options[2]) - sort_functions = _get_sort_functions() + sort_functions = _get_sort_functions(Sort.Sort(database)) sort_func = sort_functions[sort_func_num][1] title_str = options[3] return TimeLine(database, person, diff --git a/src/plugins/Verify.py b/src/plugins/Verify.py index e95487718..3ae1c2ee1 100644 --- a/src/plugins/Verify.py +++ b/src/plugins/Verify.py @@ -147,7 +147,7 @@ class Verify: warn = cStringIO.StringIO() for person_id in personList: - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) idstr = "%s (%s)" % (person.get_primary_name().get_name(),person_id) # individual checks @@ -278,9 +278,9 @@ class Verify: mother_id = family.get_mother_id() father_id = family.get_father_id() if mother_id: - mother = self.db.find_person_from_id(mother_id) + mother = self.db.try_to_find_person_from_id(mother_id) if father_id: - father = self.db.find_person_from_id(father_id) + father = self.db.try_to_find_person_from_id(father_id) if mother_id and father_id: if ( mother.get_gender() == father.get_gender() ) and mother.get_gender() != RelLib.Person.unknown: warn.write( _("Homosexual marriage: %s in family %s.\n") % ( idstr, family.get_id() ) ) @@ -293,7 +293,7 @@ class Verify: else: spouse_id = father_id if spouse_id: - spouse = self.db.find_person_from_id(spouse_id) + spouse = self.db.try_to_find_person_from_id(spouse_id) if person.get_gender() == RelLib.Person.male and \ person.get_primary_name().get_surname() == spouse.get_primary_name().get_surname(): warn.write( _("Husband and wife with the same surname: %s in family %s, and %s.\n") % ( @@ -323,7 +323,7 @@ class Verify: for child_id in family.get_child_id_list(): cnum = cnum + 1 if maryear == 0: - child = self.db.find_person_from_id(child_id) + child = self.db.try_to_find_person_from_id(child_id) birthyear = self.get_year( child.get_birth_id() ) if birthyear > 0: maryear = birthyear-cnum @@ -391,7 +391,7 @@ class Verify: cbyears = [] for child_id in family.get_child_id_list(): nkids = nkids+1 - child = self.db.find_person_from_id(child_id) + child = self.db.try_to_find_person_from_id(child_id) cbyear = self.get_year( child.get_birth_id() ) if cbyear: cbyears.append(cbyear) diff --git a/src/plugins/WebPage.py b/src/plugins/WebPage.py index 961890b61..fa0325b1d 100644 --- a/src/plugins/WebPage.py +++ b/src/plugins/WebPage.py @@ -226,7 +226,7 @@ class IndividualPage: self.doc.start_cell("NormalCell") self.doc.start_paragraph("Data") if person_id: - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) if self.list.has_key(person_id): self.doc.start_link("%s.%s" % (person_id,self.ext)) self.doc.write_text(person.get_primary_name().get_regular_name()) @@ -250,7 +250,7 @@ class IndividualPage: self.doc.write_text('%d. ' % index) index = index + 1 base_id = sref.get_base_id() - base = self.db.find_source_from_id(base_id) + base = self.db.try_to_find_source_from_id(base_id) self.write_info(base.get_title()) self.write_info(base.get_author()) self.write_info(base.get_publication_info()) @@ -314,7 +314,7 @@ class IndividualPage: if self.photos and len(media_list) > 0: object_id = media_list[0].get_reference_id() - object = self.db.find_object_from_id(object_id) + object = self.db.try_to_find_object_from_id(object_id) if object.get_mime_type()[0:5] == "image": src = object.get_path() junk,ext = os.path.splitext(src) @@ -403,7 +403,7 @@ class IndividualPage: index = 0 for object_ref in self.person.get_media_list(): obj_id = object_ref.get_reference_id() - obj = self.db.find_object_from_id(obj_id) + obj = self.db.try_to_find_object_from_id(obj_id) if obj.get_mime_type()[0:5] != "image": continue if object_ref.get_privacy(): @@ -500,7 +500,7 @@ class IndividualPage: descr = event.get_description() place_id = event.get_place_id() if place_id: - place = self.db.find_place_from_id(place_id).get_title() + place = self.db.try_to_find_place_from_id(place_id).get_title() else: place = "" srcref = event.get_source_references() @@ -557,7 +557,7 @@ class IndividualPage: date = event.get_date() place_id = event.get_place_id() if place_id: - place = self.db.find_place_from_id(place_id).get_title() + place = self.db.try_to_find_place_from_id(place_id).get_title() else: place = "" descr = event.get_description() @@ -614,7 +614,7 @@ class IndividualPage: self.doc.start_cell("NormalCell",2) self.doc.start_paragraph("Spouse") if spouse_id: - spouse = self.db.find_person_from_id(spouse_id) + spouse = self.db.try_to_find_person_from_id(spouse_id) if self.list.has_key(spouse_id): self.doc.start_link("%s.%s" % (spouse_id,self.ext)) self.doc.write_text(spouse.get_primary_name().get_regular_name()) @@ -649,7 +649,7 @@ class IndividualPage: first = 1 for child_id in family.get_child_id_list(): - child = self.db.find_person_from_id(child_id) + child = self.db.try_to_find_person_from_id(child_id) name = child.get_primary_name().get_regular_name() if first == 1: first = 0 @@ -766,7 +766,7 @@ class WebReport(Report.Report): except: return for p_id in person_id_list: - p = self.db.find_person_from_id(p_id) + p = self.db.try_to_find_person_from_id(p_id) name = p.get_primary_name() firstName = name.get_first_name() surName = name.get_surname() @@ -786,7 +786,7 @@ class WebReport(Report.Report): if e: f.write("%s|" % self.make_date(e.get_date_object())) if e.get_place_id(): - f.write('%s|' % self.db.find_place_from_id(e.get_place_id()).get_title()) + f.write('%s|' % self.db.try_to_find_place_from_id(e.get_place_id()).get_title()) else: f.write('|') else: @@ -810,7 +810,7 @@ class WebReport(Report.Report): a = {} for person_id in person_id_list: - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) n = person.get_primary_name().get_surname() if n: a[n[0]] = 1 @@ -841,8 +841,8 @@ class WebReport(Report.Report): doc.close() for n in link_keys: p_id_list = [ p_id for p_id in person_id_list if \ - (self.db.find_person_from_id(p_id).get_primary_name().get_surname() \ - and (self.db.find_person_from_id(p_id).get_primary_name().get_surname()[0] == n) ) ] + (self.db.try_to_find_person_from_id(p_id).get_primary_name().get_surname() \ + and (self.db.try_to_find_person_from_id(p_id).get_primary_name().get_surname()[0] == n) ) ] doc = HtmlLinkDoc(self.selected_style,None,template,None) doc.set_extension(self.ext) doc.set_title(_("Section %s") % n) @@ -860,10 +860,10 @@ class WebReport(Report.Report): col_len = n_rows for person_id in p_id_list: - name = self.db.find_person_from_id(person_id).get_primary_name().get_name() + name = self.db.try_to_find_person_from_id(person_id).get_primary_name().get_name() if self.birth_dates: - birth_id = self.db.find_person_from_id(person_id).get_birth_id() + birth_id = self.db.try_to_find_person_from_id(person_id).get_birth_id() if birth_id: birth_event = self.db.find_event_from_id(birth_id) if self.year_only: @@ -901,8 +901,8 @@ class WebReport(Report.Report): col_len = n_rows for n in link_keys: p_id_list = [ p_id for p_id in person_id_list if \ - (self.db.find_person_from_id(p_id).get_primary_name().get_surname() \ - and (self.db.find_person_from_id(p_id).get_primary_name().get_surname()[0] == n) ) ] + (self.db.try_to_find_person_from_id(p_id).get_primary_name().get_surname() \ + and (self.db.try_to_find_person_from_id(p_id).get_primary_name().get_surname()[0] == n) ) ] doc.start_paragraph('IndexLabel') if self.include_alpha_links: doc.write_linktarget("%03d" % a[n]) @@ -911,10 +911,10 @@ class WebReport(Report.Report): col_len = col_len - 1 for person_id in p_id_list: - name = self.db.find_person_from_id(person_id).get_primary_name().get_name() + name = self.db.try_to_find_person_from_id(person_id).get_primary_name().get_name() if self.birth_dates: - birth_id = self.db.find_person_from_id(person_id).get_birth_id() + birth_id = self.db.try_to_find_person_from_id(person_id).get_birth_id() if birth_id: birth_event = self.db.find_event_from_id(birth_id) if self.year_only: @@ -997,7 +997,7 @@ class WebReport(Report.Report): for l in ind_list: my_map[l] = l for person_id in ind_list: - person = self.db.find_person_from_id(person_id) + person = self.db.try_to_find_person_from_id(person_id) tdoc = HtmlLinkDoc(self.selected_style,None,None,None,doc) tdoc.set_extension(self.ext) tdoc.set_keywords([person.get_primary_name().get_surname(), @@ -1560,13 +1560,13 @@ class MiniTree: mother_indent = indent[:-1] + ' ' + ' ' * len(name) + '|' if father_id: - father = self.db.find_person_from_id(father_id) + father = self.db.try_to_find_person_from_id(father_id) next_pos = position - offset self.lines_map[position] += '|' self.draw_parents(father,next_pos,father_indent,generations,1) if mother_id: - mother = self.db.find_person_from_id(mother_id) + mother = self.db.try_to_find_person_from_id(mother_id) next_pos = position + offset self.draw_parents(mother,next_pos,mother_indent,generations,0) diff --git a/src/plugins/WriteCD.py b/src/plugins/WriteCD.py index 7fc3e425f..f2f29d36d 100644 --- a/src/plugins/WriteCD.py +++ b/src/plugins/WriteCD.py @@ -146,7 +146,7 @@ class PackageWriter: return for obj_id in self.db.get_object_keys(): - obj = self.db.find_object_from_id(obj_id) + obj = self.db.try_to_find_object_from_id(obj_id) oldfile = obj.get_path() root = os.path.basename(oldfile) if os.path.isfile(oldfile): @@ -210,21 +210,21 @@ class PackageWriter: p.set_media_list(nl) for key in self.db.get_person_keys(): - p = self.db.find_person_from_id(key) + p = self.db.try_to_find_person_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: nl.remove(o) p.set_media_list(nl) for key in self.db.get_source_keys(): - p = self.db.find_source_from_id(key) + p = self.db.try_to_find_source_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: nl.remove(o) p.set_media_list(nl) for key in self.db.get_place_id_keys(): - p = self.db.find_place_from_id(key) + p = self.db.try_to_find_place_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: @@ -262,7 +262,7 @@ class PackageWriter: # during the process (i.e. when removing object) for obj_id in self.db.get_object_keys(): - obj = self.db.find_object_from_id(obj_id) + obj = self.db.try_to_find_object_from_id(obj_id) oldfile = obj.get_path() root = os.path.basename(oldfile) if os.path.isfile(oldfile): diff --git a/src/plugins/WritePkg.py b/src/plugins/WritePkg.py index 2b6d7bcc6..6f9d18c52 100644 --- a/src/plugins/WritePkg.py +++ b/src/plugins/WritePkg.py @@ -117,21 +117,21 @@ class PackageWriter: nl.remove(o) p.set_media_list(nl) for key in self.db.get_person_keys(): - p = self.db.find_person_from_id(key) + p = self.db.try_to_find_person_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: nl.remove(o) p.set_media_list(nl) for key in self.db.get_source_keys(): - p = self.db.find_person_from_source(key) + p = self.db.try_to_find_source_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: nl.remove(o) p.set_media_list(nl) for key in self.db.get_place_id_keys(): - p = self.db.find_place_from_id(key) + p = self.db.try_to_find_place_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: @@ -170,7 +170,7 @@ class PackageWriter: # Write media files first, since the database may be modified # during the process (i.e. when removing object) for ObjectId in self.db.get_object_keys(): - oldfile = self.db.find_object_from_id(ObjectId).get_path() + oldfile = self.db.try_to_find_object_from_id(ObjectId).get_path() base = os.path.basename(oldfile) if os.path.isfile(oldfile): g = open(oldfile,"rb")