* 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
This commit is contained in:
Alex Roitman
2004-05-26 02:05:02 +00:00
parent 60a6973bbf
commit 8ddbce94f0
39 changed files with 377 additions and 315 deletions

View File

@@ -1,3 +1,27 @@
2004-05-25 Alex Roitman <shura@alex.neuro.umn.edu>
* 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 <dallingham@users.sourceforge.net> 2004-05-24 Don Allingham <dallingham@users.sourceforge.net>
* src/PeopleModel.py: temporary fix for add person update * src/PeopleModel.py: temporary fix for add person update
* src/PeopleView.py: temporary fix for add person update * src/PeopleView.py: temporary fix for add person update

View File

@@ -167,7 +167,7 @@ class RelationshipPathBetween(Rule):
if not first: if not first:
map[p_id] = 1 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(): for fam_id in p.get_family_id_list():
if fam_id: if fam_id:
fam = self.db.find_family_from_id(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') return _('Matches all people whose records are complete')
def apply(self,db,p_id): 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') return _('Matches all females')
def apply(self,db,p_id): 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: if not first:
self.map[p_id] = 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(): for fam_id in p.get_family_id_list():
if fam_id: if fam_id:
fam = self.db.find_family_from_id(fam_id) fam = self.db.find_family_from_id(fam_id)
@@ -440,7 +440,7 @@ class IsLessThanNthGenerationDescendantOf(Rule):
if gen >= int(self.list[1]): if gen >= int(self.list[1]):
return 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(): for fam_id in p.get_family_id_list():
fam = self.db.find_family_from_id(fam_id) fam = self.db.find_family_from_id(fam_id)
for child_id in fam.get_child_id_list(): for child_id in fam.get_child_id_list():
@@ -486,7 +486,7 @@ class IsMoreThanNthGenerationDescendantOf(Rule):
if gen >= int(self.list[1]): if gen >= int(self.list[1]):
self.map[p_id] = 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(): for fam_id in p.get_family_id_list():
fam = self.db.find_family_from_id(fam_id) fam = self.db.find_family_from_id(fam_id)
for child_id in fam.get_child_id_list(): for child_id in fam.get_child_id_list():
@@ -530,7 +530,7 @@ class IsChildOfFilterMatch(Rule):
return self.map.has_key(p_id) return self.map.has_key(p_id)
def init_list(self,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(): for fam_id in p.get_family_id_list():
fam = self.db.find_family_from_id(fam_id) fam = self.db.find_family_from_id(fam_id)
for child_id in fam.get_child_id_list(): for child_id in fam.get_child_id_list():
@@ -568,7 +568,7 @@ class IsDescendantFamilyOf(Rule):
self.map[p_id] = 1 self.map[p_id] = 1
return 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(): for (f,r1,r2) in p.get_parent_family_id_list():
family = self.db.find_family_from_id(f) family = self.db.find_family_from_id(f)
for person_id in [family.get_mother_id(),family.get_father_id()]: for person_id in [family.get_mother_id(),family.get_father_id()]:
@@ -633,7 +633,7 @@ class IsAncestorOf(Rule):
if not first: if not first:
self.map[p_id] = 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() fam_id = p.get_main_parents_family_id()
if fam_id: if fam_id:
fam = self.db.find_family_from_id(fam_id) fam = self.db.find_family_from_id(fam_id)
@@ -730,7 +730,7 @@ class IsLessThanNthGenerationAncestorOf(Rule):
if gen >= int(self.list[1]): if gen >= int(self.list[1]):
return 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() fam_id = p.get_main_parents_family_id()
if fam_id: if fam_id:
fam = self.db.find_family_from_id(fam_id) fam = self.db.find_family_from_id(fam_id)
@@ -783,7 +783,7 @@ class IsMoreThanNthGenerationAncestorOf(Rule):
if gen >= int(self.list[1]): if gen >= int(self.list[1]):
self.map[p_id] = 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() fam_id = p.get_main_parents_family_id()
if fam_id: if fam_id:
fam = self.db.find_family_from_id(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) return self.map.has_key(p_id)
def init_list(self,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(): for fam_id in p.get_main_parents_family_id():
fam = self.db.find_family_from_id(fam_id) fam = self.db.find_family_from_id(fam_id)
for parent_id in [fam.get_father_id (), fam.get_mother_id ()]: for parent_id in [fam.get_father_id (), fam.get_mother_id ()]:
@@ -937,7 +937,7 @@ class IsMale(Rule):
return _('Matches all males') return _('Matches all males')
def apply(self,db,p_id): 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') return _('Event filters')
def apply(self,db,p_id): 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(): for event_id in p.get_event_list():
if not event_id: if not event_id:
continue continue
@@ -984,7 +984,7 @@ class HasEvent(Rule):
if self.list[2]: if self.list[2]:
pl_id = event.get_place_id() pl_id = event.get_place_id()
if pl_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() pn = pl.get_title()
if string.find(pn.upper(),self.list[2].upper()) == -1: if string.find(pn.upper(),self.list[2].upper()) == -1:
val = 0 val = 0
@@ -1021,7 +1021,7 @@ class HasFamilyEvent(Rule):
return _('Event filters') return _('Event filters')
def apply(self,db,p_id): 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(): for f_id in p.get_family_id_list():
f = db.find_family_from_id(f_id) f = db.find_family_from_id(f_id)
for event_id in f.get_event_list(): for event_id in f.get_event_list():
@@ -1039,7 +1039,7 @@ class HasFamilyEvent(Rule):
val = 0 val = 0
pl_id = event.get_place_id() pl_id = event.get_place_id()
if pl_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() pn = pl.get_title()
if self.list[2] and string.find(pn,self.list[2].upper()) == -1: if self.list[2] and string.find(pn,self.list[2].upper()) == -1:
val = 0 val = 0
@@ -1071,7 +1071,7 @@ class HasRelationship(Rule):
def apply(self,db,p_id): def apply(self,db,p_id):
rel_type = 0 rel_type = 0
cnt = 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()) num_rel = len(p.get_family_id_list())
# count children and look for a relationship type match # count children and look for a relationship type match
@@ -1133,7 +1133,7 @@ class HasBirth(Rule):
return _('Event filters') return _('Event filters')
def apply(self,db,p_id): 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() event_id = p.get_birth_id()
if not event_id: if not event_id:
return 0 return 0
@@ -1146,7 +1146,7 @@ class HasBirth(Rule):
return 0 return 0
pl_id = event.get_place_id() pl_id = event.get_place_id()
if pl_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() pn = pl.get_title()
if len(self.list) > 1 and string.find(pn,self.list[1].upper()) == -1: if len(self.list) > 1 and string.find(pn,self.list[1].upper()) == -1:
return 0 return 0
@@ -1180,7 +1180,7 @@ class HasDeath(Rule):
return _('Event filters') return _('Event filters')
def apply(self,db,p_id): 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() event_id = p.get_death_id()
if not event_id: if not event_id:
return 0 return 0
@@ -1193,7 +1193,7 @@ class HasDeath(Rule):
return 0 return 0
pl_id = event.get_place_id() pl_id = event.get_place_id()
if pl_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() pn = pl.get_title()
if self.list[1] and string.find(pn,self.list[1].upper()) == -1: if self.list[1] and string.find(pn,self.list[1].upper()) == -1:
return 0 return 0
@@ -1213,7 +1213,7 @@ class HasAttribute(Rule):
return 'Has the personal attribute' return 'Has the personal attribute'
def apply(self,db,p_id): 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(): for event in p.getAttributes():
if self.list[0] and event.get_type() != self.list[0]: if self.list[0] and event.get_type() != self.list[0]:
return 0 return 0
@@ -1236,7 +1236,7 @@ class HasFamilyAttribute(Rule):
return 'Has the family attribute' return 'Has the family attribute'
def apply(self,db,p_id): 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(): for f_id in p.get_family_id_list():
f = db.find_family_from_id(f_id) f = db.find_family_from_id(f_id)
for event in f.getAttributes(): for event in f.getAttributes():
@@ -1274,7 +1274,7 @@ class HasNameOf(Rule):
self.l = self.list[1] self.l = self.list[1]
self.s = self.list[2] self.s = self.list[2]
self.t = self.list[3] 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(): for name in [p.get_primary_name()] + p.get_alternate_names():
val = 1 val = 1
if self.f and string.find(name.get_first_name().upper(),self.f.upper()) == -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): def apply(self,db,p_id):
self.f = self.list[0] 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 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): def apply(self,db,p_id):
filter = MatchesFilter (self.list) 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 (): for family_id in p.get_family_id_list ():
family = db.find_family_from_id(family_id) family = db.find_family_from_id(family_id)
for spouse_id in [family.get_father_id (), family.get_mother_id ()]: for spouse_id in [family.get_father_id (), family.get_mother_id ()]:

View File

@@ -54,7 +54,7 @@ class DescendLine(GraphLayout):
if pos > self.maxy: if pos > self.maxy:
self.maxy = pos 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(): for family_id in person.get_family_id_list():
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
for child_id in family.get_child_id_list(): for child_id in family.get_child_id_list():
@@ -65,7 +65,7 @@ class DescendLine(GraphLayout):
self.elist.pop() self.elist.pop()
def depth(self,person_id,val=0): 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(): for family_id in person.get_family_id_list():
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
clist = family.get_child_id_list() clist = family.get_child_id_list()

View File

@@ -2958,14 +2958,14 @@ class GrampsDB:
def has_family_id(self,val): def has_family_id(self,val):
return self.family_map.get(str(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. """finds a Person in the database from the passed gramps' ID.
If no such Person exists, a new Person is added to the database.""" If no such Person exists, a new Person is added to the database."""
person = Person()
data = self.person_map.get(str(val)) data = self.person_map.get(str(val))
if data: if data:
person = Person()
person.unserialize(data) person.unserialize(data)
return person return person
else: else:
@@ -3084,6 +3084,18 @@ class GrampsDB:
map[gid] = self.add_event(event,trans) map[gid] = self.add_event(event,trans)
return event 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): def find_source_from_id(self,val,trans):
"""finds a Source in the database from the passed gramps' ID. """finds a Source in the database from the passed gramps' ID.
If no such Source exists, a new Source is added to the database.""" If no such Source exists, a new Source is added to the database."""
@@ -3172,9 +3184,21 @@ class GrampsDB:
self.added_files.append(object) self.added_files.append(object)
return index 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): def find_object_from_id(self,gid,trans):
"""finds an Object in the database from the passed gramps' ID. """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() object = MediaObject()
if self.media_map.get(str(gid)): if self.media_map.get(str(gid)):
@@ -3272,6 +3296,19 @@ class GrampsDB:
place.unserialize(data) place.unserialize(data)
return place 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): def sortbyplace(self,f,s):
fp = self.place_map[f][1].upper() fp = self.place_map[f][1].upper()
sp = self.place_map[s][1].upper() sp = self.place_map[s][1].upper()

View File

@@ -172,8 +172,8 @@ class RelationshipCalculator:
family_id = person.get_main_parents_family_id() family_id = person.get_main_parents_family_id()
family = self.db.find_family_from_id(family_id) family = self.db.find_family_from_id(family_id)
if family != None: if family != None:
father = self.db.find_person_from_id(family.get_father_id()) father = self.db.try_to_find_person_from_id(family.get_father_id())
mother = self.db.find_person_from_id(family.get_mother_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(father,index+1,plist,pmap)
self.apply_filter(mother,index+1,plist,pmap) self.apply_filter(mother,index+1,plist,pmap)

View File

@@ -79,8 +79,8 @@ class Sort:
def by_last_name(self,first_id,second_id): def by_last_name(self,first_id,second_id):
"""Sort routine for comparing two last names. If last names are equal, """Sort routine for comparing two last names. If last names are equal,
uses the given name and suffix""" uses the given name and suffix"""
first = self.database.find_person_from_id(first_id) first = self.database.try_to_find_person_from_id(first_id)
second = self.database.find_person_from_id(second_id) second = self.database.try_to_find_person_from_id(second_id)
name1 = first.get_primary_name() name1 = first.get_primary_name()
name2 = second.get_primary_name() name2 = second.get_primary_name()
@@ -101,8 +101,8 @@ class Sort:
def by_birthdate(self,first_id,second_id): def by_birthdate(self,first_id,second_id):
"""Sort routine for comparing two people by birth dates. If the birth dates """Sort routine for comparing two people by birth dates. If the birth dates
are equal, sorts by name""" are equal, sorts by name"""
first = self.database.find_person_from_id(first_id) first = self.database.try_to_find_person_from_id(first_id)
second = self.database.find_person_from_id(second_id) second = self.database.try_to_find_person_from_id(second_id)
birth_id1 = first.get_birth_id() birth_id1 = first.get_birth_id()
if birth_id1: if birth_id1:

View File

@@ -68,7 +68,7 @@ class SubstKeywords:
def __init__(self,database,person_id): def __init__(self,database,person_id):
"""Creates a new object and associates a person with it.""" """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_regular_name()
self.N = person.get_primary_name().get_name() self.N = person.get_primary_name().get_name()
self.b = "" self.b = ""
@@ -86,14 +86,14 @@ class SubstKeywords:
self.b = birth.get_date() self.b = birth.get_date()
bplace_id = birth.get_place_id() bplace_id = birth.get_place_id()
if bplace_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() death_id = person.get_death_id()
if death_id: if death_id:
death = database.find_event_from_id(death_id) death = database.find_event_from_id(death_id)
self.d = death.get_date() self.d = death.get_date()
dplace_id = death.get_place_id() dplace_id = death.get_place_id()
if dplace_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) self.i = str(person_id)
if person.get_family_id_list(): if person.get_family_id_list():
@@ -103,12 +103,12 @@ class SubstKeywords:
mother_id = f.get_mother_id() mother_id = f.get_mother_id()
if father_id == person_id: if father_id == person_id:
if mother_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_regular_name()
self.S = mother.get_primary_name().get_name() self.S = mother.get_primary_name().get_name()
else: else:
if father_id: 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_regular_name()
self.S = father.get_primary_name().get_name() self.S = father.get_primary_name().get_name()
for e_id in f.get_event_list(): for e_id in f.get_event_list():
@@ -119,7 +119,7 @@ class SubstKeywords:
self.m = e.get_date() self.m = e.get_date()
mplace_id = e.get_place_id() mplace_id = e.get_place_id()
if mplace_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): def replace(self,line):
"""Returns a new line of text with the substitutions performed.""" """Returns a new line of text with the substitutions performed."""

View File

@@ -112,7 +112,7 @@ class AncestorChart:
self.lines = max(self.lines,len(self.text[index])) 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() family_id = person.get_main_parents_family_id()
if family_id: if family_id:
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)

View File

@@ -226,7 +226,7 @@ class AncestorChart:
self.lines = max(self.lines,len(self.text[index])) 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() family_id = person.get_main_parents_family_id()
if family_id: if family_id:
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)

View File

@@ -69,7 +69,7 @@ class AncestorReport(Report.Report):
return return
self.map[index] = person_id 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() family_id = person.get_main_parents_family_id()
if family_id: if family_id:
family = self.database.find_family_from_id(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)) self.doc.start_paragraph("AHN-Entry","%s." % str(key))
person_id = self.map[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() name = person.get_primary_name().get_regular_name()
self.doc.start_bold() self.doc.start_bold()
@@ -124,7 +124,7 @@ class AncestorReport(Report.Report):
date = birth.get_date_object().get_start_date() date = birth.get_date_object().get_start_date()
place_id = birth.get_place_id() place_id = birth.get_place_id()
if 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: else:
place = u'' place = u''
if place[-1:] == '.': if place[-1:] == '.':
@@ -159,7 +159,7 @@ class AncestorReport(Report.Report):
date = death.get_date_object().get_start_date() date = death.get_date_object().get_start_date()
place_id = death.get_place_id() place_id = death.get_place_id()
if 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: else:
place = u'' place = u''
if place[-1:] == '.': if place[-1:] == '.':
@@ -204,7 +204,7 @@ class AncestorReport(Report.Report):
date = buried.get_date_object().get_start_date() date = buried.get_date_object().get_start_date()
place_id = buried.get_place_id() place_id = buried.get_place_id()
if 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: else:
place = u'' place = u''
if place[-1:] == '.': if place[-1:] == '.':

View File

@@ -138,7 +138,7 @@ class ComprehensiveAncestorsReport (Report.Report):
i = 1 i = 1
for source_id in self.sources: 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.start_paragraph ("AR-Entry")
self.doc.write_text ("[%d] %s" % (i, source.get_title ())) self.doc.write_text ("[%d] %s" % (i, source.get_title ()))
author = source.get_author () author = source.get_author ()
@@ -186,8 +186,8 @@ class ComprehensiveAncestorsReport (Report.Report):
return ret return ret
father_id = family.get_father_id () father_id = family.get_father_id ()
mother_id = family.get_mother_id () mother_id = family.get_mother_id ()
father = self.database.find_person_from_id(father_id) father = self.database.try_to_find_person_from_id(father_id)
mother = self.database.find_person_from_id(mother_id) mother = self.database.try_to_find_person_from_id(mother_id)
if father: if father:
ret.extend (self.person (father_id, ret.extend (self.person (father_id,
short_form = father_id in already_described, short_form = father_id in already_described,
@@ -209,7 +209,7 @@ class ComprehensiveAncestorsReport (Report.Report):
ret.append ((self.doc.end_paragraph, [])) ret.append ((self.doc.end_paragraph, []))
for child_id in children_ids: 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, ret.extend (self.person (child_id, suppress_children = 1,
short_form=child_id in already_described, short_form=child_id in already_described,
already_described = already_described, already_described = already_described,
@@ -232,7 +232,7 @@ class ComprehensiveAncestorsReport (Report.Report):
break break
relstring = self.relationship.get_grandparents_string (self.start, 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") % \ heading = _("%(name)s's maternal %(grandparents)s") % \
{ 'name': self.first_name_or_nick (self.start), { 'name': self.first_name_or_nick (self.start),
'grandparents': relstring } 'grandparents': relstring }
@@ -255,7 +255,7 @@ class ComprehensiveAncestorsReport (Report.Report):
break break
relstring = self.relationship.get_grandparents_string (self.start, 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: if thisgen == 2:
heading = _("%(name)s's %(parents)s") % \ heading = _("%(name)s's %(parents)s") % \
{ 'name': self.first_name_or_nick (self.start), { 'name': self.first_name_or_nick (self.start),
@@ -274,7 +274,7 @@ class ComprehensiveAncestorsReport (Report.Report):
for family_id in family_ids: for family_id in family_ids:
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
father_id = family.get_father_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: if father:
already_described.append (father_id) already_described.append (father_id)
father_family_id = father.get_main_parents_family_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) next_pfamily_ids.append (father_family_id)
mother_id = family.get_mother_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: if mother:
already_described.append (mother_id) already_described.append (mother_id)
mother_family_id = mother.get_main_parents_family_id () mother_family_id = mother.get_main_parents_family_id ()
@@ -302,7 +302,7 @@ class ComprehensiveAncestorsReport (Report.Report):
needs_name = 0, needs_name = 0,
from_family = None): from_family = None):
ret = [] 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) name = self.person_name (person_id)
if name: if name:
photos = person.get_media_list () photos = person.get_media_list ()
@@ -311,7 +311,7 @@ class ComprehensiveAncestorsReport (Report.Report):
bits += self.short_occupation (person) bits += self.short_occupation (person)
bits += self.long_born_died (person) bits += self.long_born_died (person)
if not suppress_children: if not suppress_children:
bits += self.parents_of (person) bits += self.parents_of (person_id)
else: else:
bits += '.' bits += '.'
bits += self.married_whom (person, from_family, suppress_children) 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) family = self.database.find_family_from_id(family_id)
for partner_id in [family.get_father_id (), for partner_id in [family.get_father_id (),
family.get_mother_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: if partner_id == person_id or not partner:
continue continue
@@ -344,7 +344,7 @@ class ComprehensiveAncestorsReport (Report.Report):
partner != from_family_mother)): partner != from_family_mother)):
for media_ref in partner.get_media_list ()[:1]: for media_ref in partner.get_media_list ()[:1]:
object_id = media_ref.get_reference_id() 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": if mobject.get_mime_type()[0:5] == "image":
spouse.append ((self.doc.add_media_object, spouse.append ((self.doc.add_media_object,
[mobject.get_path (), [mobject.get_path (),
@@ -377,7 +377,7 @@ class ComprehensiveAncestorsReport (Report.Report):
ret.append ((self.doc.start_cell, ["AR-Photo"])) ret.append ((self.doc.start_cell, ["AR-Photo"]))
for media_ref in photos[:1]: for media_ref in photos[:1]:
object_id = media_ref.get_reference_id() 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": if mobject.get_mime_type()[0:5] == "image":
ret.append ((self.doc.add_media_object, ret.append ((self.doc.add_media_object,
[mobject.get_path (), 'left', 2, 2])) [mobject.get_path (), 'left', 2, 2]))
@@ -452,7 +452,7 @@ class ComprehensiveAncestorsReport (Report.Report):
info += _(' in %(month_or_year)s') % \ info += _(' in %(month_or_year)s') % \
{'month_or_year': dateobj.get_date ()} {'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: if placename:
info += _(' in %(place)s') % {'place': placename} info += _(' in %(place)s') % {'place': placename}
note = event.get_note () note = event.get_note ()
@@ -530,32 +530,33 @@ class ComprehensiveAncestorsReport (Report.Report):
return ret return ret
def parents_of (self, person_id): 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 () gender = person.get_gender ()
family = person.get_main_parents_family_id () family_id = person.get_main_parents_family_id ()
ret = '. ' if family_id:
if family: family = self.database.find_family_from_id(family_id)
fathername = mothername = None fathername = mothername = None
father_id = family.get_father_id () father_id = family.get_father_id ()
father = self.database.find_person_from_id(father_id) if father_id:
if father: #father = self.database.try_to_find_person_from_id(father_id)
fathername = self.person_name (father_id) fathername = self.person_name (father_id)
mother_id = family.get_mother_id () mother_id = family.get_mother_id ()
mother = self.database.find_person_from_id(mother_id) if mother_id:
if mother: #mother = self.database.try_to_find_person_from_id(mother_id)
mothername = self.person_name (mother_id) mothername = self.person_name (mother_id)
if not mother and not father: if not mother_id and not father_id:
pass pass
elif not father: elif not father_id:
if gender == RelLib.Person.female: if gender == RelLib.Person.female:
ret += _("She is the daughter of %(mother)s.") % \ ret += _("She is the daughter of %(mother)s.") % \
{'mother': mothername} {'mother': mothername}
else: else:
ret += _("He is the son of %(mother)s.") % \ ret += _("He is the son of %(mother)s.") % \
{'mother': mothername} {'mother': mothername}
elif not mother: elif not mother_id:
if gender == RelLib.Person.female: if gender == RelLib.Person.female:
ret += _("She is the daughter of %(father)s.") % \ ret += _("She is the daughter of %(father)s.") % \
{'father': fathername} {'father': fathername}
@@ -631,7 +632,7 @@ class ComprehensiveAncestorsReport (Report.Report):
return citation return citation
def person_name (self, person_id): 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 () primary = person.get_primary_name ()
name = primary.get_title () name = primary.get_title ()
@@ -682,9 +683,9 @@ class ComprehensiveAncestorsReport (Report.Report):
for family_id in person.get_family_id_list (): for family_id in person.get_family_id_list ():
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
mother_id = family.get_mother_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]: 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: if spouse_id == person.get_id() or not spouse_id:
continue continue
@@ -701,7 +702,7 @@ class ComprehensiveAncestorsReport (Report.Report):
count = 1 count = 1
for child_id in childlist: 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.first_name_or_nick (child)
children += self.cite_sources (child.get_primary_name (). children += self.cite_sources (child.get_primary_name ().
get_source_references ()) get_source_references ())

View File

@@ -680,7 +680,7 @@ class BookReportSelector:
if data[1] == _("Title"): if data[1] == _("Title"):
data.append(_("Not Applicable")) data.append(_("Not Applicable"))
else: 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()) data.append(pname.get_primary_name().get_regular_name())
self.bk_model.add(data) self.bk_model.add(data)

View File

@@ -42,9 +42,9 @@ def runTool(database,person,callback,parent=None):
try: try:
trans = database.start_transaction() trans = database.start_transaction()
ChangeTypes(database,person,parent,trans) ChangeTypes(database,person,parent,trans)
database.add_transaction(trans) database.add_transaction(trans,_('Change types'))
except: except:
database.add_transaction(trans) database.add_transaction(trans,_('Change types'))
database.undo() database.undo()
import DisplayTrace import DisplayTrace
@@ -85,7 +85,7 @@ class ChangeTypes:
new = unicode(self.glade.get_widget("new_text").get_text()) new = unicode(self.glade.get_widget("new_text").get_text())
for person_id in self.db.get_person_keys(): 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(): for event_id in person.get_event_list():
if not event_id: if not event_id:
continue continue

View File

@@ -64,7 +64,7 @@ def runTool(database,active_person,callback,parent=None):
checker.cleanup_missing_photos(0) checker.cleanup_missing_photos(0)
checker.check_parent_relationships() checker.check_parent_relationships()
checker.cleanup_empty_families(0) checker.cleanup_empty_families(0)
database.add_transaction(trans) database.add_transaction(trans, _("Check Integrity"))
errs = checker.build_report(0) errs = checker.build_report(0)
if errs: if errs:
@@ -98,9 +98,9 @@ class CheckIntegrity:
father_id = family.get_father_id() father_id = family.get_father_id()
mother_id = family.get_mother_id() mother_id = family.get_mother_id()
if 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: 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(): if father_id and family_id not in father.get_family_id_list():
self.broken_parent_links.append((father_id,family_id)) self.broken_parent_links.append((father_id,family_id))
@@ -111,7 +111,7 @@ class CheckIntegrity:
mother.add_family_id(family_id) mother.add_family_id(family_id)
self.db.commit_person(mother,self.trans) self.db.commit_person(mother,self.trans)
for child_id in family.get_child_id_list(): 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(): if family_id == child.get_main_parents_family_id():
continue continue
for family_type in child.get_parent_family_id_list(): for family_type in child.get_parent_family_id_list():
@@ -128,7 +128,7 @@ class CheckIntegrity:
def remove_clicked(): def remove_clicked():
# File is lost => remove all references and the object itself # File is lost => remove all references and the object itself
for person_id in self.db.get_family_keys(): 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() nl = p.get_media_list()
changed = 0 changed = 0
for o in nl: for o in nl:
@@ -140,7 +140,7 @@ class CheckIntegrity:
self.db.commit_person(p,self.trans) self.db.commit_person(p,self.trans)
for key in self.db.get_person_keys(): 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() nl = p.get_media_list()
changed = 0 changed = 0
for o in nl: for o in nl:
@@ -152,7 +152,7 @@ class CheckIntegrity:
self.db.commit_person(p,self.trans) self.db.commit_person(p,self.trans)
for key in self.db.get_source_keys(): 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() nl = p.get_media_list()
changed = 0 changed = 0
for o in nl: for o in nl:
@@ -207,7 +207,7 @@ class CheckIntegrity:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
for ObjectId in self.db.get_object_keys(): 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() photo_name = obj.get_path()
if not os.path.isfile(photo_name): if not os.path.isfile(photo_name):
if cl: if cl:
@@ -240,7 +240,7 @@ class CheckIntegrity:
def delete_empty_family(self,family_id): def delete_empty_family(self,family_id):
for key in self.db.get_person_keys(): 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_parent_family_id(family_id)
child.remove_family_id(family_id) child.remove_family_id(family_id)
self.db.delete_family(family_id,self.trans) self.db.delete_family(family_id,self.trans)
@@ -251,9 +251,9 @@ class CheckIntegrity:
mother_id = family.get_mother_id() mother_id = family.get_mother_id()
father_id = family.get_father_id() father_id = family.get_father_id()
if 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: 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() type = family.get_relationship()
if not father_id and not mother_id: if not father_id and not mother_id:
@@ -316,11 +316,11 @@ class CheckIntegrity:
else: else:
self.text.write(_("%d broken child/family links were found\n") % blink) self.text.write(_("%d broken child/family links were found\n") % blink)
for (person_id,family_id) in self.broken_links: 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) family = self.db.find_family_from_id(family_id)
cn = person.get_primary_name().get_name() cn = person.get_primary_name().get_name()
f = self.db.find_person_from_id(family.get_father_id()) f = self.db.try_to_find_person_from_id(family.get_father_id())
m = self.db.find_person_from_id(family.get_mother_id()) m = self.db.try_to_find_person_from_id(family.get_mother_id())
if f and m: if f and m:
pn = _("%s and %s") % (f.get_primary_name().get_name(),\ pn = _("%s and %s") % (f.get_primary_name().get_name(),\
m.get_primary_name().get_name()) m.get_primary_name().get_name())
@@ -339,11 +339,11 @@ class CheckIntegrity:
else: else:
self.text.write(_("%d broken spouse/family links were found\n") % plink) self.text.write(_("%d broken spouse/family links were found\n") % plink)
for (person_id,family_id) in self.broken_parent_links: 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) family = self.db.find_family_from_id(family_id)
cn = person.get_primary_name().get_name() cn = person.get_primary_name().get_name()
f = self.db.find_person_from_id(family.get_father_id()) f = self.db.try_to_find_person_from_id(family.get_father_id())
m = self.db.find_person_from_id(family.get_mother_id()) m = self.db.try_to_find_person_from_id(family.get_mother_id())
if f and m: if f and m:
pn = _("%s and %s") % (f.get_primary_name().get_name(),\ pn = _("%s and %s") % (f.get_primary_name().get_name(),\
m.get_primary_name().get_name()) m.get_primary_name().get_name())

View File

@@ -67,7 +67,7 @@ class CountAncestors:
temp = thisgen temp = thisgen
thisgen = [] thisgen = []
for person_id in temp: 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() family_id = person.get_main_parents_family_id()
if family_id: if family_id:
family = database.find_family_from_id(family_id) family = database.find_family_from_id(family_id)

View File

@@ -118,7 +118,7 @@ class DesBrowse:
def add_to_tree(self,parent_id,sib_id,person_id): def add_to_tree(self,parent_id,sib_id,person_id):
item_id = self.model.insert_after(parent_id,sib_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,0,GrampsCfg.nameof(person))
self.model.set(item_id,1,person_id) self.model.set(item_id,1,person_id)
prev_id = None prev_id = None
@@ -135,7 +135,7 @@ class DesBrowse:
store,iter = self.tree.get_selection().get_selected() store,iter = self.tree.get_selection().get_selected()
if iter: if iter:
person_id = store.get_value(iter,1) 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) EditPerson.EditPerson(self.parent,person,self.db,self.callback)
#------------------------------------------------------------------------ #------------------------------------------------------------------------

View File

@@ -133,7 +133,7 @@ class DescendantReport:
childlist.sort(self.by_birthdate) childlist.sort(self.by_birthdate)
for child_id in childlist: 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) self.dump(level+1,child)
#------------------------------------------------------------------------ #------------------------------------------------------------------------

View File

@@ -79,7 +79,7 @@ class DetAncestorReport(Report.Report):
return return
self.map[index] = person_id 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() family_id = person.get_main_parents_family_id()
if family_id: if family_id:
family = self.database.find_family_from_id(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") self.doc.start_paragraph("DAR-ChildTitle")
mother_id = family.get_mother_id() mother_id = family.get_mother_id()
if 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() mother = mother_obj.get_primary_name().get_regular_name()
else: else:
mother = _("unknown") mother = _("unknown")
father_id = family.get_father_id() father_id = family.get_father_id()
if 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() father = father_obj.get_primary_name().get_regular_name()
else: else:
father = _("unknown") father = _("unknown")
@@ -137,7 +137,7 @@ class DetAncestorReport(Report.Report):
for child_id in family.get_child_id_list(): for child_id in family.get_child_id_list():
self.doc.start_paragraph("DAR-ChildList") 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() name = child.get_primary_name().get_regular_name()
birth_id = child.get_birth_id() birth_id = child.get_birth_id()
death_id = child.get_death_id() death_id = child.get_death_id()
@@ -157,10 +157,10 @@ class DetAncestorReport(Report.Report):
if birth and birth.get_date(): if birth and birth.get_date():
if birth.get_place_id(): 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 and death.get_date():
if death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \
(name, birth.get_date(), bplace, (name, birth.get_date(), bplace,
death.get_date(), dplace)) # f death.get_date(), dplace)) # f
@@ -169,7 +169,7 @@ class DetAncestorReport(Report.Report):
(name, birth.get_date(), bplace, (name, birth.get_date(), bplace,
death.get_date())) # e death.get_date())) # e
elif death and death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
(name, birth.get_date(), bplace, (name, birth.get_date(), bplace,
dplace)) # d dplace)) # d
@@ -179,7 +179,7 @@ class DetAncestorReport(Report.Report):
else: else:
if death and death.get_date(): if death and death.get_date():
if death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
(name, birth.get_date(), death.get_date(), \ (name, birth.get_date(), death.get_date(), \
dplace)) # b dplace)) # b
@@ -187,7 +187,7 @@ class DetAncestorReport(Report.Report):
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.get_date(), death.get_date())) # a (name, birth.get_date(), death.get_date())) # a
elif death and death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.get_date(), dplace)) # 9 (name, birth.get_date(), dplace)) # 9
else: else:
@@ -195,10 +195,10 @@ class DetAncestorReport(Report.Report):
(name, birth.get_date())) # 8 (name, birth.get_date())) # 8
else: else:
if birth and birth.get_place_id(): 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 and death.get_date():
if death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
(name, bplace, \ (name, bplace, \
death.get_date(), dplace)) # 7 death.get_date(), dplace)) # 7
@@ -206,7 +206,7 @@ class DetAncestorReport(Report.Report):
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, bplace, death.get_date())) # 6 (name, bplace, death.get_date())) # 6
elif death and death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, bplace, dplace)) # 5 (name, bplace, dplace)) # 5
else: else:
@@ -215,14 +215,14 @@ class DetAncestorReport(Report.Report):
else: else:
if death and death.get_date(): if death and death.get_date():
if death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Died: %s %s") % \
(name, death.get_date(), dplace)) # 3 (name, death.get_date(), dplace)) # 3
else: else:
self.doc.write_text(_("- %s Died: %s") % \ self.doc.write_text(_("- %s Died: %s") % \
(name, death.get_date())) # 2 (name, death.get_date())) # 2
elif death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Died: %s") % \
(name, dplace)) # 1 (name, dplace)) # 1
else: else:
@@ -234,7 +234,7 @@ class DetAncestorReport(Report.Report):
"""Output birth, death, parentage, marriage and notes information """ """Output birth, death, parentage, marriage and notes information """
person_id = self.map[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)
if rptOptions.addImages == reportOptions.Yes: if rptOptions.addImages == reportOptions.Yes:
self.insert_images(person) self.insert_images(person)
@@ -305,7 +305,7 @@ class DetAncestorReport(Report.Report):
birth = self.database.find_event_from_id(birth_id) birth = self.database.find_event_from_id(birth_id)
date = birth.get_date_object().get_start_date() date = birth.get_date_object().get_start_date()
if birth.get_place_id(): 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:] == '.': if place[-1:] == '.':
place = place[:-1] place = place[:-1]
elif rptOptions.blankDate == reportOptions.Yes: elif rptOptions.blankDate == reportOptions.Yes:
@@ -364,7 +364,7 @@ class DetAncestorReport(Report.Report):
death = self.database.find_event_from_id(death_id) death = self.database.find_event_from_id(death_id)
date = death.get_date_object().get_start_date() date = death.get_date_object().get_start_date()
if death.get_place_id(): 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:] == '.': if place[-1:] == '.':
place = place[:-1] place = place[:-1]
elif rptOptions.blankPlace == reportOptions.Yes: elif rptOptions.blankPlace == reportOptions.Yes:
@@ -447,12 +447,12 @@ class DetAncestorReport(Report.Report):
if ext_family_id: if ext_family_id:
ext_family = self.database.find_family_from_id(ext_family_id) ext_family = self.database.find_family_from_id(ext_family_id)
if ext_family.get_father_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() father = father_obj.get_primary_name().get_regular_name()
else: else:
father= "" father= ""
if ext_family.get_mother_id(): 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() mother = mother_obj.get_primary_name().get_regular_name()
else: else:
mother= "" mother= ""
@@ -503,7 +503,7 @@ class DetAncestorReport(Report.Report):
t= "" t= ""
if person.get_gender() == RelLib.Person.male: if person.get_gender() == RelLib.Person.male:
if fam.get_mother_id(): 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() spouse = mother.get_primary_name().get_regular_name()
if fam_num == 1: if fam_num == 1:
heshe= _("He") heshe= _("He")
@@ -518,7 +518,7 @@ class DetAncestorReport(Report.Report):
else: heshe= _("and she") else: heshe= _("and she")
if fam.get_father_id(): 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() spouse = father.get_primary_name().get_regular_name()
for event_id in fam.get_event_list(): for event_id in fam.get_event_list():
@@ -534,7 +534,7 @@ class DetAncestorReport(Report.Report):
place = "" place = ""
if marriage: if marriage:
if marriage.get_place_id(): 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: elif rptOptions.blankPlace == reportOptions.Yes:
place= "____________" place= "____________"
@@ -584,7 +584,7 @@ class DetAncestorReport(Report.Report):
if mate.get_gender() == RelLib.Person.male: if mate.get_gender() == RelLib.Person.male:
if fam.get_mother_id(): if fam.get_mother_id():
ind_id= 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() person = ind.get_primary_name().get_regular_name()
firstName = ind.get_primary_name().get_first_name() firstName = ind.get_primary_name().get_first_name()
heshe = _("She") heshe = _("She")
@@ -592,7 +592,7 @@ class DetAncestorReport(Report.Report):
heshe= _("He") heshe= _("He")
if fam.get_father_id(): if fam.get_father_id():
ind_id = 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() person = ind.get_primary_name().get_regular_name()
firstName = ind.get_primary_name().get_first_name() firstName = ind.get_primary_name().get_first_name()
@@ -629,7 +629,7 @@ class DetAncestorReport(Report.Report):
photos = person.get_media_list() photos = person.get_media_list()
for photo in photos : for photo in photos :
object_id = photo.get_reference_id() 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": if object.get_mime_type()[0:5] == "image":
file = object.get_path() file = object.get_path()
self.doc.add_media_object(file,"row",4.0,4.0) self.doc.add_media_object(file,"row",4.0,4.0)
@@ -672,7 +672,7 @@ class DetAncestorReport(Report.Report):
self.genIDs.clear() self.genIDs.clear()
person_id = self.map[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)
self.genIDs[person_id]= key self.genIDs[person_id]= key
dupPerson= self.write_person(key, rptOpt) dupPerson= self.write_person(key, rptOpt)
if dupPerson == 0: # Is this a duplicate ind record if dupPerson == 0: # Is this a duplicate ind record

View File

@@ -85,7 +85,7 @@ class DetDescendantReport(Report.Report):
else: else:
self.genKeys[cur_gen-1].append(index) 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(): for family_id in person.get_family_id_list():
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
for child_id in family.get_child_id_list(): for child_id in family.get_child_id_list():
@@ -122,12 +122,12 @@ class DetDescendantReport(Report.Report):
self.doc.start_paragraph("DDR-ChildTitle") self.doc.start_paragraph("DDR-ChildTitle")
mother_id = family.get_mother_id() mother_id = family.get_mother_id()
if 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: else:
mother = _("unknown") mother = _("unknown")
father_id = family.get_father_id() father_id = family.get_father_id()
if 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: else:
father = _("unknown") father = _("unknown")
self.doc.start_bold() self.doc.start_bold()
@@ -139,7 +139,7 @@ class DetDescendantReport(Report.Report):
self.doc.end_paragraph() self.doc.end_paragraph()
for child_id in family.get_child_id_list(): 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") self.doc.start_paragraph("DDR-ChildList")
name = child.get_primary_name().get_regular_name() name = child.get_primary_name().get_regular_name()
birth_id = child.get_birth_id() birth_id = child.get_birth_id()
@@ -160,10 +160,10 @@ class DetDescendantReport(Report.Report):
if birth and birth.get_date(): if birth and birth.get_date():
if birth.get_place_id(): 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 and death.get_date():
if death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \
(name, birth.get_date(), bplace, (name, birth.get_date(), bplace,
death.get_date(), dplace)) # f death.get_date(), dplace)) # f
@@ -172,7 +172,7 @@ class DetDescendantReport(Report.Report):
(name, birth.get_date(), bplace, (name, birth.get_date(), bplace,
death.get_date())) # e death.get_date())) # e
elif death and death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
(name, birth.get_date(), bplace, (name, birth.get_date(), bplace,
dplace)) # d dplace)) # d
@@ -181,7 +181,7 @@ class DetDescendantReport(Report.Report):
else: else:
if death and death.get_date(): if death and death.get_date():
if death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
(name, birth.get_date(), death.get_date(), \ (name, birth.get_date(), death.get_date(), \
dplace)) # b dplace)) # b
@@ -189,7 +189,7 @@ class DetDescendantReport(Report.Report):
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.get_date(), death.get_date())) # a (name, birth.get_date(), death.get_date())) # a
elif death and death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, birth.get_date(), dplace)) # 9 (name, birth.get_date(), dplace)) # 9
else: else:
@@ -197,10 +197,10 @@ class DetDescendantReport(Report.Report):
(name, birth.get_date())) # 8 (name, birth.get_date())) # 8
else: else:
if birth and birth.get_place_id(): 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 and death.get_date():
if death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
(name, bplace, \ (name, bplace, \
death.get_date(), dplace)) # 7 death.get_date(), dplace)) # 7
@@ -208,7 +208,7 @@ class DetDescendantReport(Report.Report):
self.doc.write_text(_("- %s Born: %s Died: %s") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, bplace, death.get_date())) # 6 (name, bplace, death.get_date())) # 6
elif death and death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Born: %s Died: %s") % \
(name, bplace, dplace)) # 5 (name, bplace, dplace)) # 5
else: else:
@@ -217,14 +217,14 @@ class DetDescendantReport(Report.Report):
else: else:
if death and death.get_date(): if death and death.get_date():
if death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Died: %s %s") % \
(name, death.get_date(), dplace)) # 3 (name, death.get_date(), dplace)) # 3
else: else:
self.doc.write_text(_("- %s Died: %s") % \ self.doc.write_text(_("- %s Died: %s") % \
(name, death.get_date())) # 2 (name, death.get_date())) # 2
elif death and death.get_place_id(): 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") % \ self.doc.write_text(_("- %s Died: %s") % \
(name, dplace)) # 1 (name, dplace)) # 1
else: else:
@@ -236,7 +236,7 @@ class DetDescendantReport(Report.Report):
"""Output birth, death, parentage, marriage and notes information """ """Output birth, death, parentage, marriage and notes information """
person_id = self.map[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)
if rptOptions.addImages == reportOptions.Yes: if rptOptions.addImages == reportOptions.Yes:
self.insert_images(person) self.insert_images(person)
@@ -306,7 +306,7 @@ class DetDescendantReport(Report.Report):
birth = self.database.find_event_from_id(birth_id) birth = self.database.find_event_from_id(birth_id)
date = birth.get_date_object().get_start_date() date = birth.get_date_object().get_start_date()
if birth.get_place_id(): 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:] == '.': if place[-1:] == '.':
place = place[:-1] place = place[:-1]
elif rptOptions.blankDate == reportOptions.Yes: elif rptOptions.blankDate == reportOptions.Yes:
@@ -363,7 +363,7 @@ class DetDescendantReport(Report.Report):
date = death.get_date_object().get_start_date() date = death.get_date_object().get_start_date()
place_id = death.get_place_id() place_id = death.get_place_id()
if 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:] == '.': if place[-1:] == '.':
place = place[:-1] place = place[:-1]
elif rptOptions.blankPlace == reportOptions.Yes: elif rptOptions.blankPlace == reportOptions.Yes:
@@ -450,12 +450,12 @@ class DetDescendantReport(Report.Report):
ext_family = self.database.find_family_from_id(ext_family_id) ext_family = self.database.find_family_from_id(ext_family_id)
father_id = ext_family.get_father_id() father_id = ext_family.get_father_id()
if 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: else:
father = "" father = ""
mother_id = ext_family.get_father_id() mother_id = ext_family.get_father_id()
if 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: else:
mother = "" mother = ""
@@ -501,7 +501,7 @@ class DetDescendantReport(Report.Report):
if person.get_gender() == RelLib.Person.male: if person.get_gender() == RelLib.Person.male:
mother_id = fam.get_mother_id() mother_id = fam.get_mother_id()
if 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: if fam_num == 1:
heshe = _("He") heshe = _("He")
elif fam_num < len(famList): elif fam_num < len(famList):
@@ -518,7 +518,7 @@ class DetDescendantReport(Report.Report):
father_id = fam.get_father_id() father_id = fam.get_father_id()
if 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(): for event_id in fam.get_event_list():
if event_id: if event_id:
@@ -533,7 +533,7 @@ class DetDescendantReport(Report.Report):
place = "" place = ""
if marriage: if marriage:
if marriage.get_place_id(): 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: elif rptOptions.blankPlace == reportOptions.Yes:
place= "____________" place= "____________"
@@ -582,14 +582,14 @@ class DetDescendantReport(Report.Report):
heshe = _("She") heshe = _("She")
mother_id = fam.get_mother_id() mother_id = fam.get_mother_id()
if 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() mateName = mate.get_primary_name().get_regular_name()
mateFirstName = mate.get_primary_name().get_first_name() mateFirstName = mate.get_primary_name().get_first_name()
else: else:
heshe = _("He") heshe = _("He")
father_id = fam.get_father_id() father_id = fam.get_father_id()
if 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() mateName = mate.get_primary_name().get_regular_name()
mateFirstName = mate.get_primary_name().get_first_name() mateFirstName = mate.get_primary_name().get_first_name()
@@ -622,7 +622,7 @@ class DetDescendantReport(Report.Report):
photos = person.get_media_list() photos = person.get_media_list()
for photo in photos : for photo in photos :
object_id = photo.get_reference_id() 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": if object.get_mime_type()[0:5] == "image":
file = object.get_path() file = object.get_path()
self.doc.add_media_object(file,"row",4.0,4.0) 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: if self.start.get_gender() == RelLib.Person.male:
mother_id = fam.get_mother_id() mother_id = fam.get_mother_id()
if 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: else:
father_id = fam.get_father_id() father_id = fam.get_father_id()
if 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") self.doc.start_paragraph("DDR-Title")
if spouseName: if spouseName:
@@ -684,7 +684,7 @@ class DetDescendantReport(Report.Report):
for key in self.genKeys[generation]: for key in self.genKeys[generation]:
person_id = self.map[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)
self.genIDs[person_id]= key self.genIDs[person_id]= key
dupPerson= self.write_person(key, rptOpt) dupPerson= self.write_person(key, rptOpt)
if dupPerson == 0: # Is this a duplicate ind record if dupPerson == 0: # Is this a duplicate ind record

View File

@@ -316,7 +316,7 @@ class DisplayChart:
def build_row_data(self): def build_row_data(self):
for individual_id in self.my_list: 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() name = individual.get_primary_name().get_name()
birth_id = individual.get_birth_id() birth_id = individual.get_birth_id()
bdate = "" bdate = ""
@@ -326,7 +326,7 @@ class DisplayChart:
bdate = birth.get_date() bdate = birth.get_date()
bplace_id = birth.get_place_id() bplace_id = birth.get_place_id()
if bplace_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() death_id = individual.get_death_id()
ddate = "" ddate = ""
dplace = "" dplace = ""
@@ -335,7 +335,7 @@ class DisplayChart:
ddate = death.get_date() ddate = death.get_date()
dplace_id = death.get_place_id() dplace_id = death.get_place_id()
if dplace_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 = {} map = {}
elist = individual.get_event_list()[:] elist = individual.get_event_list()[:]
for ievent_id in elist: for ievent_id in elist:
@@ -368,7 +368,7 @@ class DisplayChart:
date = event.get_date() date = event.get_date()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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)) tlist.append("%s\n%s" % (date, place))
added = 1 added = 1
else: else:
@@ -387,7 +387,7 @@ class DisplayChart:
name, birth, and death. This should be the column titles of the report""" name, birth, and death. This should be the column titles of the report"""
map = {} map = {}
for individual_id in self.my_list: 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() elist = individual.get_event_list()
for event_id in elist: for event_id in elist:
if not event_id: if not event_id:

View File

@@ -135,7 +135,7 @@ class FamilyGroup:
if not person_id: if not person_id:
return 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: if person.get_gender() == RelLib.Person.male:
id = _("Husband") id = _("Husband")
@@ -160,7 +160,7 @@ class FamilyGroup:
bdate = birth.get_date() bdate = birth.get_date()
bplace_id = birth.get_place_id() bplace_id = birth.get_place_id()
if bplace_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() death_id = person.get_death_id()
ddate = "" ddate = ""
@@ -170,7 +170,7 @@ class FamilyGroup:
ddate = death.get_date() ddate = death.get_date()
dplace_id = death.get_place_id() dplace_id = death.get_place_id()
if dplace_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_row()
self.doc.start_cell("FGR-TextContents") self.doc.start_cell("FGR-TextContents")
@@ -215,10 +215,10 @@ class FamilyGroup:
family = self.db.find_family_from_id(family_id) family = self.db.find_family_from_id(family_id)
father_id = family.get_father_id() father_id = family.get_father_id()
if 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() mother_id = family.get_mother_id()
if 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_row()
self.doc.start_cell("FGR-TextContents") self.doc.start_cell("FGR-TextContents")
@@ -255,7 +255,7 @@ class FamilyGroup:
date = event.get_date() date = event.get_date()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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_row()
self.doc.start_cell(text) self.doc.start_cell(text)
@@ -281,7 +281,7 @@ class FamilyGroup:
def dump_child(self,index,person_id): 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_row()
self.doc.start_cell('FGR-TextChild1') self.doc.start_cell('FGR-TextChild1')
self.doc.start_paragraph('FGR-ChildText') self.doc.start_paragraph('FGR-ChildText')
@@ -344,7 +344,7 @@ class FamilyGroup:
self.doc.start_cell('FGR-TextContentsEnd',2) self.doc.start_cell('FGR-TextContentsEnd',2)
self.doc.start_paragraph('FGR-Normal') self.doc.start_paragraph('FGR-Normal')
if spouse_id: 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.write_text(spouse.get_primary_name().get_regular_name())
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
@@ -547,7 +547,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog):
return 1 return 1
def get_report_extra_menu_info(self): 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) return (_("Spouse"), self.spouse_map, None, None)
def on_center_person_change_clicked(self,obj): def on_center_person_change_clicked(self,obj):
@@ -556,7 +556,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog):
new_person = sel_person.run() new_person = sel_person.run()
if new_person: if new_person:
self.new_person = 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 self.new_spouse_map:
if not self.extra_menu: if not self.extra_menu:
@@ -577,7 +577,7 @@ class FamilyGroupBareDialog(Report.BareReportDialog):
self.extra_menu = None self.extra_menu = None
new_name = new_person.get_primary_name().get_regular_name() new_name = new_person.get_primary_name().get_regular_name()
if new_name: if new_name:
self.person_label.set_text( "<i>%s</i>" % new_name ) self.person_label.set_text( "<i>%s</i>" % new_name )
self.person_label.set_use_markup(gtk.TRUE) 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]: if options[0]:
person = database.get_person(options[0]) person = database.get_person(options[0])
spouse_name = options[1] spouse_name = options[1]
spouse_map = _build_spouse_map(person) spouse_map = _build_spouse_map(database,person)
if spouse_map: if spouse_map:
if spouse_map.has_key(spouse_name): if spouse_map.has_key(spouse_name):
family = spouse_map[spouse_name] family = spouse_map[spouse_name]
@@ -704,7 +704,7 @@ def _build_spouse_map(database,person):
else: else:
spouse_id = family.get_father_id() spouse_id = family.get_father_id()
if spouse_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() name = spouse.get_primary_name().get_name()
else: else:
name= _("unknown") name= _("unknown")

View File

@@ -165,7 +165,7 @@ class FanChart:
self.lines = max(self.lines,len(self.text[index-1])) 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() family_id = person.get_main_parents_family_id()
if family_id: if family_id:
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
@@ -202,7 +202,7 @@ class FanChart:
self.doc.close() self.doc.close()
def get_info(self,person_id): 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() pn = person.get_primary_name()
birth_id = person.get_birth_id() birth_id = person.get_birth_id()

View File

@@ -534,7 +534,7 @@ class EditRule:
self.add_places = [] self.add_places = []
for p_id in self.db.get_place_ids(): 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.pmap[p.get_title()] = p_id
self.active_rule = val self.active_rule = val
@@ -764,7 +764,7 @@ class ShowResults:
n = [] n = []
for p_id in id_list: 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.append ("%s [%s]\n" % (p.get_primary_name().get_name(),p.get_id()))
n.sort () n.sort ()

View File

@@ -69,7 +69,7 @@ class FtmAncestorReport(Report.Report):
return return
self.map[index] = (person_id,generation) 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() family_id = person.get_main_parents_family_id()
if family_id: if family_id:
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
@@ -103,7 +103,7 @@ class FtmAncestorReport(Report.Report):
self.doc.end_paragraph() self.doc.end_paragraph()
old_gen = generation 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() pri_name = person.get_primary_name()
self.doc.start_paragraph("FTA-Entry","%d." % key) self.doc.start_paragraph("FTA-Entry","%d." % key)
name = pri_name.get_regular_name() name = pri_name.get_regular_name()
@@ -119,7 +119,7 @@ class FtmAncestorReport(Report.Report):
birth = self.database.find_event_from_id(birth_id) birth = self.database.find_event_from_id(birth_id)
place_id = birth.get_place_id() place_id = birth.get_place_id()
if 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: else:
bplace = u'' bplace = u''
bdate = birth.get_date() bdate = birth.get_date()
@@ -134,7 +134,7 @@ class FtmAncestorReport(Report.Report):
death = self.database.find_event_from_id(death_id) death = self.database.find_event_from_id(death_id)
place_id = death.get_place_id() place_id = death.get_place_id()
if 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: else:
dplace = u'' dplace = u''
ddate = death.get_date() ddate = death.get_date()
@@ -448,7 +448,7 @@ class FtmAncestorReport(Report.Report):
keys.sort() keys.sort()
for key in keys: for key in keys:
srcref = self.sref_map[key] 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.start_paragraph('FTA-Endnotes',"%d." % key)
self.doc.write_text(base.get_title()) self.doc.write_text(base.get_title())
@@ -537,7 +537,7 @@ class FtmAncestorReport(Report.Report):
date = event.get_date() date = event.get_date()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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: else:
place = u'' place = u''
@@ -584,7 +584,7 @@ class FtmAncestorReport(Report.Report):
spouse_id = family.get_father_id() spouse_id = family.get_father_id()
if not spouse_id: if not spouse_id:
return 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() spouse_name = spouse.get_primary_name().get_regular_name()
for event_id in family.get_event_list(): for event_id in family.get_event_list():
@@ -598,7 +598,7 @@ class FtmAncestorReport(Report.Report):
date = event.get_date() date = event.get_date()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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: else:
place = u'' place = u''
@@ -657,7 +657,7 @@ class FtmAncestorReport(Report.Report):
ddate = death.get_date() ddate = death.get_date()
place_id = death.get_place_id() place_id = death.get_place_id()
if 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: else:
dplace = u'' dplace = u''
else: else:
@@ -672,7 +672,7 @@ class FtmAncestorReport(Report.Report):
bdate = birth.get_date() bdate = birth.get_date()
place_id = birth.get_place_id() place_id = birth.get_place_id()
if 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: else:
bplace = u'' bplace = u''
else: else:
@@ -962,10 +962,10 @@ class FtmAncestorReport(Report.Report):
mother_id = family.get_mother_id() mother_id = family.get_mother_id()
father_id = family.get_father_id() father_id = family.get_father_id()
if 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)
mother_name = mother.get_primary_name().get_regular_name() mother_name = mother.get_primary_name().get_regular_name()
if 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)
father_name = father.get_primary_name().get_regular_name() father_name = father.get_primary_name().get_regular_name()
if person.get_gender() == RelLib.Person.male: if person.get_gender() == RelLib.Person.male:

View File

@@ -97,7 +97,7 @@ class FtmDescendantReport(Report.Report):
self.gen_map[generation] = [] self.gen_map[generation] = []
self.gen_map[generation].append(index) 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(): for family_id in person.get_family_id_list():
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
for child_id in family.get_child_id_list(): for child_id in family.get_child_id_list():
@@ -133,7 +133,7 @@ class FtmDescendantReport(Report.Report):
indexlist.sort() indexlist.sort()
for key in indexlist: for key in indexlist:
person_id = self.anc_map[key] 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() pri_name = person.get_primary_name()
self.doc.start_paragraph("FTD-Entry","%d." % key) self.doc.start_paragraph("FTD-Entry","%d." % key)
@@ -152,7 +152,7 @@ class FtmDescendantReport(Report.Report):
bdate = birth.get_date() bdate = birth.get_date()
bplace_id = birth.get_place_id() bplace_id = birth.get_place_id()
if bplace_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() death_id = person.get_death_id()
dplace = "" dplace = ""
@@ -162,7 +162,7 @@ class FtmDescendantReport(Report.Report):
ddate = death.get_date() ddate = death.get_date()
dplace_id = death.get_place_id() dplace_id = death.get_place_id()
if dplace_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 birth_valid = bdate or bplace
death_valid = ddate or dplace death_valid = ddate or dplace
@@ -476,7 +476,7 @@ class FtmDescendantReport(Report.Report):
for key in keys: for key in keys:
srcref = self.sref_map[key] srcref = self.sref_map[key]
base_id = srcref.get_base_id() 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.start_paragraph('FTD-Endnotes',"%d." % key)
self.doc.write_text(base.get_title()) self.doc.write_text(base.get_title())
@@ -567,7 +567,7 @@ class FtmDescendantReport(Report.Report):
date = event.get_date() date = event.get_date()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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: else:
place = None place = None
@@ -612,8 +612,8 @@ class FtmDescendantReport(Report.Report):
father_id = family.get_father_id() father_id = family.get_father_id()
mother_id = family.get_mother_id() mother_id = family.get_mother_id()
if father_id and mother_id: if father_id and mother_id:
husband = self.database.find_person_from_id(father_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.find_person_from_id(mother_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: else:
continue continue
for event_id in family.get_event_list(): for event_id in family.get_event_list():
@@ -623,7 +623,7 @@ class FtmDescendantReport(Report.Report):
date = event.get_date() date = event.get_date()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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: else:
place = None place = None
@@ -672,11 +672,11 @@ class FtmDescendantReport(Report.Report):
spouse_id = mother_id spouse_id = mother_id
else: else:
spouse_id = father_id 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 child_index = 0
for child_id in family.get_child_id_list(): 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_index = child_index + 1
child_name = child.get_primary_name().get_regular_name() child_name = child.get_primary_name().get_regular_name()
for (ind,p_id) in self.anc_map.items(): for (ind,p_id) in self.anc_map.items():
@@ -718,7 +718,7 @@ class FtmDescendantReport(Report.Report):
bdate = birth.get_date() bdate = birth.get_date()
bplace_id = birth.get_place_id() bplace_id = birth.get_place_id()
if bplace_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() death_id = child.get_death_id()
dplace = "" dplace = ""
@@ -728,7 +728,7 @@ class FtmDescendantReport(Report.Report):
ddate = death.get_date() ddate = death.get_date()
dplace_id = death.get_place_id() dplace_id = death.get_place_id()
if dplace_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 child.get_gender() == RelLib.Person.male:
if bdate: if bdate:
@@ -1007,7 +1007,7 @@ class FtmDescendantReport(Report.Report):
spouse_id = family.get_father_id() spouse_id = family.get_father_id()
if not spouse_id: if not spouse_id:
return 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(): for event_id in family.get_event_list():
if event_id: if event_id:
@@ -1022,7 +1022,7 @@ class FtmDescendantReport(Report.Report):
date = event.get_date() date = event.get_date()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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: else:
place = "" place = ""
@@ -1080,7 +1080,7 @@ class FtmDescendantReport(Report.Report):
bdate = birth.get_date() bdate = birth.get_date()
bplace_id = birth.get_place_id() bplace_id = birth.get_place_id()
if bplace_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() death_id = spouse.get_death_id()
dplace = "" dplace = ""
@@ -1090,7 +1090,7 @@ class FtmDescendantReport(Report.Report):
ddate = death.get_date() ddate = death.get_date()
dplace_id = death.get_place_id() dplace_id = death.get_place_id()
if dplace_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 death_valid = ddate or dplace
birth_valid = bdate or bplace birth_valid = bdate or bplace
@@ -1384,12 +1384,12 @@ class FtmDescendantReport(Report.Report):
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
mother_id = family.get_mother_id() mother_id = family.get_mother_id()
if 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: else:
mother = None mother = None
father_id = family.get_father_id() father_id = family.get_father_id()
if 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: else:
father = None father = None
if person.get_gender() == RelLib.Person.male: if person.get_gender() == RelLib.Person.male:

View File

@@ -396,7 +396,7 @@ def dump_person(database,person_list,file,adoptionsdashed,arrowheadstyle,
for person_id in person_list: for person_id in person_list:
pid = string.replace(person_id,'-','_') 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(): for family_id, mrel, frel in person.get_parent_family_id_list():
family = database.find_family_from_id(family_id) family = database.find_family_from_id(family_id)
father_id = family.get_father_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. # don't do it twice.
families_done = [] families_done = []
for person_id in person_list: 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. # Output the person's node.
label = person.get_primary_name().get_name() label = person.get_primary_name().get_name()
id = string.replace(person_id,'-','_') id = string.replace(person_id,'-','_')

View File

@@ -110,7 +110,7 @@ class IndivComplete(Report.Report):
self.d.add_cell_style("IDS-NormalCell",cell) self.d.add_cell_style("IDS-NormalCell",cell)
cell = BaseDoc.TableCellStyle() cell = BaseDoc.TableCellStyle()
cell.set_longlist(1) cell.set_longlist(1)
self.d.add_cell_style("IDS-ListCell",cell) self.d.add_cell_style("IDS-ListCell",cell)
def end(self): def end(self):
@@ -124,7 +124,7 @@ class IndivComplete(Report.Report):
date = event.get_date() date = event.get_date()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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: else:
place = "" place = ""
description = event.get_description() description = event.get_description()
@@ -206,9 +206,9 @@ class IndivComplete(Report.Report):
continue continue
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
father_id = family.get_father_id() father_id = family.get_father_id()
if 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() fname = father.get_primary_name().get_regular_name()
frel = const.child_relations.find_value(frel) frel = const.child_relations.find_value(frel)
self.write_p_entry(_('Father'),fname,frel) self.write_p_entry(_('Father'),fname,frel)
@@ -217,7 +217,7 @@ class IndivComplete(Report.Report):
mother_id = family.get_mother_id() mother_id = family.get_mother_id()
if 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() fname = mother.get_primary_name().get_regular_name()
frel = const.child_relations.find_value(frel) frel = const.child_relations.find_value(frel)
self.write_p_entry(_('Mother'),fname,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_cell("IDS-NormalCell",2)
self.d.start_paragraph("IDS-Spouse") self.d.start_paragraph("IDS-Spouse")
if spouse_id: 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() text = spouse.get_primary_name().get_regular_name()
else: else:
text = _("unknown") text = _("unknown")
@@ -309,7 +309,7 @@ class IndivComplete(Report.Report):
first = 0 first = 0
else: else:
self.d.write_text('\n') 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.write_text(child.get_primary_name().get_regular_name())
self.d.end_paragraph() self.d.end_paragraph()
self.d.end_cell() self.d.end_cell()
@@ -336,7 +336,7 @@ class IndivComplete(Report.Report):
self.d.start_row() self.d.start_row()
s_id = source.get_base_id() s_id = source.get_base_id()
self.normal_cell(s_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.normal_cell(src.get_title())
self.d.end_row() self.d.end_row()
self.d.end_table() self.d.end_table()
@@ -356,7 +356,7 @@ class IndivComplete(Report.Report):
for event_id in event_id_list: for event_id in event_id_list:
if event_id: if event_id:
event = self.database.find_event_from_id(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.end_table()
self.d.start_paragraph("IDS-Normal") self.d.start_paragraph("IDS-Normal")
self.d.end_paragraph() self.d.end_paragraph()
@@ -381,7 +381,7 @@ class IndivComplete(Report.Report):
count = 0 count = 0
for person_id in ind_list: 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) self.write_person(count)
count = count + 1 count = count + 1
self.end() self.end()
@@ -402,7 +402,7 @@ class IndivComplete(Report.Report):
if len(media_list) > 0: if len(media_list) > 0:
object_id = media_list[0].get_reference_id() 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": if object.get_mime_type()[0:5] == "image":
file = object.get_path() file = object.get_path()
self.d.start_paragraph("IDS-Normal") self.d.start_paragraph("IDS-Normal")
@@ -435,13 +435,13 @@ class IndivComplete(Report.Report):
family = self.database.find_family_from_id(family_id) family = self.database.find_family_from_id(family_id)
father_inst_id = family.get_father_id() father_inst_id = family.get_father_id()
if father_inst_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() father = father_inst.get_primary_name().get_regular_name()
else: else:
father = "" father = ""
mother_inst_id = family.get_mother_id() mother_inst_id = family.get_mother_id()
if mother_inst_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() mother = mother_inst.get_primary_name().get_regular_name()
else: else:
mother = "" mother = ""

View File

@@ -118,7 +118,7 @@ class IndivSummary(Report.Report):
date = event.get_date() date = event.get_date()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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() place = place_obj.get_title()
else: else:
place = "" place = ""
@@ -178,7 +178,7 @@ class IndivSummary(Report.Report):
self.d.start_cell("IVS-NormalCell",2) self.d.start_cell("IVS-NormalCell",2)
self.d.start_paragraph("IVS-Spouse") self.d.start_paragraph("IVS-Spouse")
if spouse_id: 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()) self.d.write_text(spouse.get_primary_name().get_regular_name())
else: else:
self.d.write_text(_("unknown")) self.d.write_text(_("unknown"))
@@ -208,7 +208,7 @@ class IndivSummary(Report.Report):
first = 0 first = 0
else: else:
self.d.write_text('\n') 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.write_text(child.get_primary_name().get_regular_name())
self.d.end_paragraph() self.d.end_paragraph()
self.d.end_cell() self.d.end_cell()
@@ -232,7 +232,7 @@ class IndivSummary(Report.Report):
if len(media_list) > 0: if len(media_list) > 0:
object_id = media_list[0].get_reference_id() 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": if object.get_mime_type()[0:5] == "image":
file = object.get_path() file = object.get_path()
self.d.start_paragraph("IVS-Normal") self.d.start_paragraph("IVS-Normal")
@@ -277,13 +277,13 @@ class IndivSummary(Report.Report):
family = self.database.find_family_from_id(fam_id) family = self.database.find_family_from_id(fam_id)
father_id = family.get_father_id() father_id = family.get_father_id()
if 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() father = dad.get_primary_name().get_regular_name()
else: else:
father = "" father = ""
mother_id = family.get_mother_id() mother_id = family.get_mother_id()
if 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() mother = mom.get_primary_name().get_regular_name()
else: else:
mother = "" mother = ""

View File

@@ -147,7 +147,7 @@ class Merge:
if (not p1_id) or (p1_id in id_list): if (not p1_id) or (p1_id in id_list):
return return
id_list.append(p1_id) 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() f1_id = p1.get_main_parents_family_id()
if f1_id: if f1_id:
f1 = self.db.find_family_from_id(f1_id) f1 = self.db.find_family_from_id(f1_id)
@@ -179,7 +179,7 @@ class Merge:
males = {} males = {}
females = {} females = {}
for p1_id in self.person_list: 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()) key = self.gen_key(p1.get_primary_name().get_surname())
if p1.get_gender() == RelLib.Person.male: if p1.get_gender() == RelLib.Person.male:
if males.has_key(key): if males.has_key(key):
@@ -196,7 +196,7 @@ class Merge:
num = 0 num = 0
for p1key in self.person_list: 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: if num % 25 == 0:
self.progress_update((float(num)/float(length))*100) self.progress_update((float(num)/float(length))*100)
num = num + 1 num = num + 1
@@ -212,7 +212,7 @@ class Merge:
index = index + 1 index = index + 1
if p1key == p2key: if p1key == p2key:
continue 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): if self.map.has_key(p2key):
(v,c) = self.map[p2key] (v,c) = self.map[p2key]
if v == p1key: if v == p1key:
@@ -292,8 +292,8 @@ class Merge:
for (c,p1key,p2key) in list: for (c,p1key,p2key) in list:
c1 = "%5.2f" % c c1 = "%5.2f" % c
c2 = "%5.2f" % (100-c) c2 = "%5.2f" % (100-c)
pn1 = self.db.find_person_from_id(p1key).get_primary_name().get_name() pn1 = self.db.try_to_find_person_from_id(p1key).get_primary_name().get_name()
pn2 = self.db.find_person_from_id(p2key).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)) self.list.add([c, pn1, pn2,c2],(p1key,p2key))
def on_do_merge_clicked(self,obj): def on_do_merge_clicked(self,obj):
@@ -302,8 +302,8 @@ class Merge:
return return
(p1,p2) = self.list.get_object(iter) (p1,p2) = self.list.get_object(iter)
pn1 = self.db.find_person_from_id(p1) pn1 = self.db.try_to_find_person_from_id(p1)
pn2 = self.db.find_person_from_id(p2) pn2 = self.db.try_to_find_person_from_id(p2)
MergeData.MergePeople(self.parent,self.db,pn1,pn2,self.on_update) MergeData.MergePeople(self.parent,self.db,pn1,pn2,self.on_update)
def on_update(self,p1_id,p2_id,old_id): def on_update(self,p1_id,p2_id,old_id):
@@ -438,13 +438,13 @@ class Merge:
if not p1_id: if not p1_id:
name1 = "" name1 = ""
else: 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() name1 = p1.get_title()
if not p2_id: if not p2_id:
name2 = "" name2 = ""
else: 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() name2 = p2.get_title()
if not (name1 and name2): if not (name1 and name2):
@@ -540,12 +540,12 @@ class Merge:
f2 = self.db.find_family_from_id(f2_id) f2 = self.db.find_family_from_id(f2_id)
dad1_id = f1.get_father_id() dad1_id = f1.get_father_id()
if dad1_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: else:
dad1 = None dad1 = None
dad2_id = f2.get_father_id() dad2_id = f2.get_father_id()
if dad2_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: else:
dad2 = None dad2 = None
@@ -558,12 +558,12 @@ class Merge:
mom1_id = f1.get_mother_id() mom1_id = f1.get_mother_id()
if mom1_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: else:
mom1 = None mom1 = None
mom2_id = f2.get_mother_id() mom2_id = f2.get_mother_id()
if mom2_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: else:
mom2 = None mom2 = None
@@ -584,8 +584,8 @@ class Merge:
if father1_id == father2_id: if father1_id == father2_id:
chance = chance + 1 chance = chance + 1
else: else:
father1 = self.db.find_person_from_id(father1_id) father1 = self.db.try_to_find_person_from_id(father1_id)
father2 = self.db.find_person_from_id(father2_id) father2 = self.db.try_to_find_person_from_id(father2_id)
fname1 = get_name_obj(father1) fname1 = get_name_obj(father1)
fname2 = get_name_obj(father2) fname2 = get_name_obj(father2)
value = self.name_match(fname1,fname2) value = self.name_match(fname1,fname2)
@@ -598,8 +598,8 @@ class Merge:
if mother1_id == mother2_id: if mother1_id == mother2_id:
chance = chance + 1 chance = chance + 1
else: else:
mother1 = self.db.find_person_from_id(mother1_id) mother1 = self.db.try_to_find_person_from_id(mother1_id)
mother2 = self.db.find_person_from_id(mother2_id) mother2 = self.db.try_to_find_person_from_id(mother2_id)
mname1 = get_name_obj(mother1) mname1 = get_name_obj(mother1)
mname2 = get_name_obj(mother2) mname2 = get_name_obj(mother2)
value = self.name_match(mname1,mname2) value = self.name_match(mname1,mname2)

View File

@@ -89,7 +89,7 @@ class PatchNames:
for key in self.db.get_person_keys(): 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() first = person.get_primary_name().get_first_name()
match = _title_re.match(first) match = _title_re.match(first)
if match: if match:
@@ -157,7 +157,7 @@ class PatchNames:
self.title_hash = {} self.title_hash = {}
for (id,name,nick) in self.nick_list: 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() iter = self.model.append()
self.model.set_value(iter,0,1) self.model.set_value(iter,0,1)
self.model.set_value(iter,1,id) self.model.set_value(iter,1,id)
@@ -167,7 +167,7 @@ class PatchNames:
self.nick_hash[id] = iter self.nick_hash[id] = iter
for (id,title,nick) in self.title_list: 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() iter = self.model.append()
self.model.set_value(iter,0,1) self.model.set_value(iter,0,1)
self.model.set_value(iter,1,id) self.model.set_value(iter,1,id)
@@ -215,7 +215,7 @@ class PatchNames:
iter = self.title_hash[grp[0]] iter = self.title_hash[grp[0]]
val = self.model.get_value(iter,0) val = self.model.get_value(iter,0)
if val: 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 = p.get_primary_name()
name.set_first_name(grp[2].strip()) name.set_first_name(grp[2].strip())
name.set_title(grp[1].strip()) name.set_title(grp[1].strip())

View File

@@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # 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 # 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 # it under the terms of the GNU General Public License as published by
@@ -144,12 +144,12 @@ class RelCalc:
length = len(common) length = len(common)
if length == 1: 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() name = person.get_primary_name().get_regular_name()
commontext = " " + _("Their common ancestor is %s.") % name commontext = " " + _("Their common ancestor is %s.") % name
elif length == 2: elif length == 2:
p1 = self.db.find_person_from_id(common[0]) p1 = self.db.try_to_find_person_from_id(common[0])
p2 = self.db.find_person_from_id(common[1]) p2 = self.db.try_to_find_person_from_id(common[1])
commontext = " " + _("Their common ancestors are %s and %s.") % \ commontext = " " + _("Their common ancestors are %s and %s.") % \
(p1.get_primary_name().get_regular_name(),\ (p1.get_primary_name().get_regular_name(),\
p2.get_primary_name().get_regular_name()) p2.get_primary_name().get_regular_name())
@@ -157,7 +157,7 @@ class RelCalc:
index = 0 index = 0
commontext = " " + _("Their common ancestors are : ") commontext = " " + _("Their common ancestors are : ")
for person_id in common: 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: if index != 0:
commontext = commontext + ", " commontext = commontext + ", "
commontext = commontext + person.get_primary_name().get_regular_name() commontext = commontext + person.get_primary_name().get_regular_name()

View File

@@ -506,7 +506,7 @@ def _write_graph_box (self):
_write_node(self.File, shape='ellipse', color='black', _write_node(self.File, shape='ellipse', color='black',
fontname=self.FontStyle) fontname=self.FontStyle)
for individual_id in individual_nodes: 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(): for family_id in individual.get_family_id_list():
if family_id not in family_nodes: if family_id not in family_nodes:
family_nodes.add(family_id) family_nodes.add(family_id)
@@ -518,7 +518,7 @@ def _write_graph_box (self):
_write_edge(self.File, style="solid", _write_edge(self.File, style="solid",
arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle) arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle)
for individual_id in individual_nodes: 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\ for family_id, mother_rel_ship, father_rel_ship\
in individual.get_parent_family_id_list(): in individual.get_parent_family_id_list():
family = self.db.find_family_from_id(family_id) family = self.db.find_family_from_id(family_id)
@@ -554,7 +554,7 @@ def _write_graph_box (self):
females = 0 females = 0
unknowns = 0 unknowns = 0
for individual_id in individual_nodes: 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: if individual.get_gender() == individual.male:
males = males + 1 males = males + 1
elif individual.get_gender() == individual.female: elif individual.get_gender() == individual.female:
@@ -596,7 +596,7 @@ def _write_graph_record (self):
for individual_id in natural_relatives: for individual_id in natural_relatives:
# If both husband and wife are members of the IndividualSet, # If both husband and wife are members of the IndividualSet,
# only one record, with the husband first, is displayed. # 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: if individual.get_gender() == individual.female:
# There are exactly three cases where a female node is added: # There are exactly three cases where a female node is added:
family_id = None # no family family_id = None # no family
@@ -633,7 +633,7 @@ def _write_graph_record (self):
arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle) arrowHead=self.ArrowHeadStyle,arrowTail=self.ArrowTailStyle)
for family_from_id, family_from_id2 in family_nodes.items(): for family_from_id, family_from_id2 in family_nodes.items():
for individual_from_id in family_from_id2: 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\ for family_id, mother_rel_ship, father_rel_ship\
in individual_from.get_parent_family_id_list(): in individual_from.get_parent_family_id_list():
family = self.db.find_family_from_id(family_id) 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(): for family_id, family_id2 in family_nodes.items():
marriages = marriages + (len(family_id2) - 1) marriages = marriages + (len(family_id2) - 1)
for individual_id in family_id2: 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\ if individual.get_gender() == individual.male\
and individual_id not in males: and individual_id not in males:
males.add(individual_id) males.add(individual_id)
@@ -692,7 +692,7 @@ def _get_individual_data (self, individual_id):
"""Returns a tuple of individual data""" """Returns a tuple of individual data"""
# color # color
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: if self.Colorize:
gender = individual.get_gender() gender = individual.get_gender()
if gender == individual.male: if gender == individual.male:
@@ -724,7 +724,7 @@ def _get_event_label (self, event_id):
elif self.PlaceCause: elif self.PlaceCause:
place_id = event.get_place_id() place_id = event.get_place_id()
if 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() return place.get_title()
else: else:
return event.get_cause() 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. individual's and family's IDs.
""" """
# Get data ready # 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() name = individual.get_primary_name().get_name()
if self.IncludeDates: if self.IncludeDates:
birth = _get_event_label(self, individual.get_birth_id()) 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""" """Returns a formatted string of a family record suitable for a label"""
labels = [] labels = []
spouse_id = record[0] 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: 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: if spouse_id == individual_id:
label = _get_individual_label(self, individual_id) label = _get_individual_label(self, individual_id)
else: else:

View File

@@ -68,7 +68,7 @@ class SoundGen:
names = [] names = []
for person_id in self.db.get_person_keys(): 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() lastname = person.get_primary_name().get_surname()
if lastname not in names: if lastname not in names:
names.append(lastname) names.append(lastname)

View File

@@ -71,7 +71,7 @@ def build_report(database,person):
pobjects = len(database.get_object_keys()) pobjects = len(database.get_object_keys())
for photo_id in 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: try:
bytes = bytes + posixpath.getsize(photo.get_path()) bytes = bytes + posixpath.getsize(photo.get_path())
except: except:
@@ -83,7 +83,7 @@ def build_report(database,person):
with_photos = with_photos + 1 with_photos = with_photos + 1
total_photos = total_photos + length 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() name = person.get_primary_name()
if name.get_first_name() == "" or name.get_surname() == "": if name.get_first_name() == "" or name.get_surname() == "":
incomp_names = incomp_names + 1 incomp_names = incomp_names + 1

View File

@@ -184,7 +184,7 @@ class TimeLine:
self.plist.sort(self.sort_func) self.plist.sort(self.sort_func)
for p_id in self.plist: 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() b_id = p.get_birth_id()
if b_id: if b_id:
b = self.db.find_event_from_id(b_id).get_date_object().get_year() 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()) self.plist = self.filter.apply(self.db,self.db.get_person_keys())
for p_id in self.plist: 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() b_id = p.get_birth_id()
if b_id: if b_id:
b = self.db.find_event_from_id(b_id).get_date_object().get_year() b = self.db.find_event_from_id(b_id).get_date_object().get_year()
@@ -321,7 +321,7 @@ class TimeLine:
size = 0 size = 0
for p_id in self.plist: 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() n = p.get_primary_name().get_name()
size = max(FontScale.string_width(font,n),size) size = max(FontScale.string_width(font,n),size)
return pt2cm(size) return pt2cm(size)
@@ -641,7 +641,7 @@ def write_book_item(database,person,doc,options,newpage=0):
filters = _get_report_filters(person) filters = _get_report_filters(person)
afilter = filters[filter_num] afilter = filters[filter_num]
sort_func_num = int(options[2]) 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] sort_func = sort_functions[sort_func_num][1]
title_str = options[3] title_str = options[3]
return TimeLine(database, person, return TimeLine(database, person,

View File

@@ -147,7 +147,7 @@ class Verify:
warn = cStringIO.StringIO() warn = cStringIO.StringIO()
for person_id in personList: 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) idstr = "%s (%s)" % (person.get_primary_name().get_name(),person_id)
# individual checks # individual checks
@@ -278,9 +278,9 @@ class Verify:
mother_id = family.get_mother_id() mother_id = family.get_mother_id()
father_id = family.get_father_id() father_id = family.get_father_id()
if mother_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: 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_id and father_id:
if ( mother.get_gender() == father.get_gender() ) and mother.get_gender() != RelLib.Person.unknown: 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() ) ) warn.write( _("Homosexual marriage: %s in family %s.\n") % ( idstr, family.get_id() ) )
@@ -293,7 +293,7 @@ class Verify:
else: else:
spouse_id = father_id spouse_id = father_id
if spouse_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 \ if person.get_gender() == RelLib.Person.male and \
person.get_primary_name().get_surname() == spouse.get_primary_name().get_surname(): 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") % ( 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(): for child_id in family.get_child_id_list():
cnum = cnum + 1 cnum = cnum + 1
if maryear == 0: 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() ) birthyear = self.get_year( child.get_birth_id() )
if birthyear > 0: if birthyear > 0:
maryear = birthyear-cnum maryear = birthyear-cnum
@@ -391,7 +391,7 @@ class Verify:
cbyears = [] cbyears = []
for child_id in family.get_child_id_list(): for child_id in family.get_child_id_list():
nkids = nkids+1 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() ) cbyear = self.get_year( child.get_birth_id() )
if cbyear: if cbyear:
cbyears.append(cbyear) cbyears.append(cbyear)

View File

@@ -226,7 +226,7 @@ class IndividualPage:
self.doc.start_cell("NormalCell") self.doc.start_cell("NormalCell")
self.doc.start_paragraph("Data") self.doc.start_paragraph("Data")
if person_id: 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): if self.list.has_key(person_id):
self.doc.start_link("%s.%s" % (person_id,self.ext)) self.doc.start_link("%s.%s" % (person_id,self.ext))
self.doc.write_text(person.get_primary_name().get_regular_name()) self.doc.write_text(person.get_primary_name().get_regular_name())
@@ -250,7 +250,7 @@ class IndividualPage:
self.doc.write_text('%d. ' % index) self.doc.write_text('%d. ' % index)
index = index + 1 index = index + 1
base_id = sref.get_base_id() 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_title())
self.write_info(base.get_author()) self.write_info(base.get_author())
self.write_info(base.get_publication_info()) self.write_info(base.get_publication_info())
@@ -314,7 +314,7 @@ class IndividualPage:
if self.photos and len(media_list) > 0: if self.photos and len(media_list) > 0:
object_id = media_list[0].get_reference_id() 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": if object.get_mime_type()[0:5] == "image":
src = object.get_path() src = object.get_path()
junk,ext = os.path.splitext(src) junk,ext = os.path.splitext(src)
@@ -403,7 +403,7 @@ class IndividualPage:
index = 0 index = 0
for object_ref in self.person.get_media_list(): for object_ref in self.person.get_media_list():
obj_id = object_ref.get_reference_id() 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": if obj.get_mime_type()[0:5] != "image":
continue continue
if object_ref.get_privacy(): if object_ref.get_privacy():
@@ -500,7 +500,7 @@ class IndividualPage:
descr = event.get_description() descr = event.get_description()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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: else:
place = "" place = ""
srcref = event.get_source_references() srcref = event.get_source_references()
@@ -557,7 +557,7 @@ class IndividualPage:
date = event.get_date() date = event.get_date()
place_id = event.get_place_id() place_id = event.get_place_id()
if 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: else:
place = "" place = ""
descr = event.get_description() descr = event.get_description()
@@ -614,7 +614,7 @@ class IndividualPage:
self.doc.start_cell("NormalCell",2) self.doc.start_cell("NormalCell",2)
self.doc.start_paragraph("Spouse") self.doc.start_paragraph("Spouse")
if spouse_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 self.list.has_key(spouse_id): if self.list.has_key(spouse_id):
self.doc.start_link("%s.%s" % (spouse_id,self.ext)) self.doc.start_link("%s.%s" % (spouse_id,self.ext))
self.doc.write_text(spouse.get_primary_name().get_regular_name()) self.doc.write_text(spouse.get_primary_name().get_regular_name())
@@ -649,7 +649,7 @@ class IndividualPage:
first = 1 first = 1
for child_id in family.get_child_id_list(): 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() name = child.get_primary_name().get_regular_name()
if first == 1: if first == 1:
first = 0 first = 0
@@ -766,7 +766,7 @@ class WebReport(Report.Report):
except: except:
return return
for p_id in person_id_list: 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() name = p.get_primary_name()
firstName = name.get_first_name() firstName = name.get_first_name()
surName = name.get_surname() surName = name.get_surname()
@@ -786,7 +786,7 @@ class WebReport(Report.Report):
if e: if e:
f.write("%s|" % self.make_date(e.get_date_object())) f.write("%s|" % self.make_date(e.get_date_object()))
if e.get_place_id(): 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: else:
f.write('|') f.write('|')
else: else:
@@ -810,7 +810,7 @@ class WebReport(Report.Report):
a = {} a = {}
for person_id in person_id_list: 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() n = person.get_primary_name().get_surname()
if n: if n:
a[n[0]] = 1 a[n[0]] = 1
@@ -841,8 +841,8 @@ class WebReport(Report.Report):
doc.close() doc.close()
for n in link_keys: for n in link_keys:
p_id_list = [ p_id for p_id in person_id_list if \ 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() \ (self.db.try_to_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) ) ] 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 = HtmlLinkDoc(self.selected_style,None,template,None)
doc.set_extension(self.ext) doc.set_extension(self.ext)
doc.set_title(_("Section %s") % n) doc.set_title(_("Section %s") % n)
@@ -860,10 +860,10 @@ class WebReport(Report.Report):
col_len = n_rows col_len = n_rows
for person_id in p_id_list: 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: 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: if birth_id:
birth_event = self.db.find_event_from_id(birth_id) birth_event = self.db.find_event_from_id(birth_id)
if self.year_only: if self.year_only:
@@ -901,8 +901,8 @@ class WebReport(Report.Report):
col_len = n_rows col_len = n_rows
for n in link_keys: for n in link_keys:
p_id_list = [ p_id for p_id in person_id_list if \ 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() \ (self.db.try_to_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) ) ] and (self.db.try_to_find_person_from_id(p_id).get_primary_name().get_surname()[0] == n) ) ]
doc.start_paragraph('IndexLabel') doc.start_paragraph('IndexLabel')
if self.include_alpha_links: if self.include_alpha_links:
doc.write_linktarget("%03d" % a[n]) doc.write_linktarget("%03d" % a[n])
@@ -911,10 +911,10 @@ class WebReport(Report.Report):
col_len = col_len - 1 col_len = col_len - 1
for person_id in p_id_list: 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: 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: if birth_id:
birth_event = self.db.find_event_from_id(birth_id) birth_event = self.db.find_event_from_id(birth_id)
if self.year_only: if self.year_only:
@@ -997,7 +997,7 @@ class WebReport(Report.Report):
for l in ind_list: for l in ind_list:
my_map[l] = l my_map[l] = l
for person_id in ind_list: 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 = HtmlLinkDoc(self.selected_style,None,None,None,doc)
tdoc.set_extension(self.ext) tdoc.set_extension(self.ext)
tdoc.set_keywords([person.get_primary_name().get_surname(), tdoc.set_keywords([person.get_primary_name().get_surname(),
@@ -1560,13 +1560,13 @@ class MiniTree:
mother_indent = indent[:-1] + ' ' + ' ' * len(name) + '|' mother_indent = indent[:-1] + ' ' + ' ' * len(name) + '|'
if 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)
next_pos = position - offset next_pos = position - offset
self.lines_map[position] += '|' self.lines_map[position] += '|'
self.draw_parents(father,next_pos,father_indent,generations,1) self.draw_parents(father,next_pos,father_indent,generations,1)
if mother_id: 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 next_pos = position + offset
self.draw_parents(mother,next_pos,mother_indent,generations,0) self.draw_parents(mother,next_pos,mother_indent,generations,0)

View File

@@ -146,7 +146,7 @@ class PackageWriter:
return return
for obj_id in self.db.get_object_keys(): 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() oldfile = obj.get_path()
root = os.path.basename(oldfile) root = os.path.basename(oldfile)
if os.path.isfile(oldfile): if os.path.isfile(oldfile):
@@ -210,21 +210,21 @@ class PackageWriter:
p.set_media_list(nl) p.set_media_list(nl)
for key in self.db.get_person_keys(): 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() nl = p.get_media_list()
for o in nl: for o in nl:
if o.get_reference() == mobj: if o.get_reference() == mobj:
nl.remove(o) nl.remove(o)
p.set_media_list(nl) p.set_media_list(nl)
for key in self.db.get_source_keys(): 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() nl = p.get_media_list()
for o in nl: for o in nl:
if o.get_reference() == mobj: if o.get_reference() == mobj:
nl.remove(o) nl.remove(o)
p.set_media_list(nl) p.set_media_list(nl)
for key in self.db.get_place_id_keys(): 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() nl = p.get_media_list()
for o in nl: for o in nl:
if o.get_reference() == mobj: if o.get_reference() == mobj:
@@ -262,7 +262,7 @@ class PackageWriter:
# during the process (i.e. when removing object) # during the process (i.e. when removing object)
for obj_id in self.db.get_object_keys(): 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() oldfile = obj.get_path()
root = os.path.basename(oldfile) root = os.path.basename(oldfile)
if os.path.isfile(oldfile): if os.path.isfile(oldfile):

View File

@@ -117,21 +117,21 @@ class PackageWriter:
nl.remove(o) nl.remove(o)
p.set_media_list(nl) p.set_media_list(nl)
for key in self.db.get_person_keys(): 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() nl = p.get_media_list()
for o in nl: for o in nl:
if o.get_reference() == mobj: if o.get_reference() == mobj:
nl.remove(o) nl.remove(o)
p.set_media_list(nl) p.set_media_list(nl)
for key in self.db.get_source_keys(): 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() nl = p.get_media_list()
for o in nl: for o in nl:
if o.get_reference() == mobj: if o.get_reference() == mobj:
nl.remove(o) nl.remove(o)
p.set_media_list(nl) p.set_media_list(nl)
for key in self.db.get_place_id_keys(): 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() nl = p.get_media_list()
for o in nl: for o in nl:
if o.get_reference() == mobj: if o.get_reference() == mobj:
@@ -170,7 +170,7 @@ class PackageWriter:
# Write media files first, since the database may be modified # Write media files first, since the database may be modified
# during the process (i.e. when removing object) # during the process (i.e. when removing object)
for ObjectId in self.db.get_object_keys(): 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) base = os.path.basename(oldfile)
if os.path.isfile(oldfile): if os.path.isfile(oldfile):
g = open(oldfile,"rb") g = open(oldfile,"rb")