* src/GenericFilter.py: fixed find/get_family_from_handle

* src/WriteGedcom.py: fixed find/get_family_from_handle


svn: r3375
This commit is contained in:
Don Allingham 2004-08-11 17:00:38 +00:00
parent 4b8a56bd90
commit 0106660f10
3 changed files with 19 additions and 17 deletions

View File

@ -1,4 +1,6 @@
2004-08-11 Don Allingham <dallingham@users.sourceforge.net> 2004-08-11 Don Allingham <dallingham@users.sourceforge.net>
* src/GenericFilter.py: fixed find/get_family_from_handle
* src/WriteGedcom.py: fixed find/get_family_from_handle
* src/AddrEdit.py: setCountry -> set_country * src/AddrEdit.py: setCountry -> set_country
* src/RelLib.py: Add concept of PrimaryObject * src/RelLib.py: Add concept of PrimaryObject
* src/GrampsDbBase.py: add local constants * src/GrampsDbBase.py: add local constants

View File

@ -170,7 +170,7 @@ class RelationshipPathBetween(Rule):
p = self.db.get_person_from_handle(p_id) p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_family_handle_list(): for fam_id in p.get_family_handle_list():
if fam_id: if fam_id:
fam = self.db.find_family_from_handle(fam_id) fam = self.db.get_family_from_handle(fam_id)
for child_handle in fam.get_child_handle_list(): for child_handle in fam.get_child_handle_list():
if child_handle: if child_handle:
self.desc_list(child_handle,map,0) self.desc_list(child_handle,map,0)
@ -352,7 +352,7 @@ class IsDescendantOf(Rule):
p = self.db.get_person_from_handle(p_id) p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_family_handle_list(): for fam_id in p.get_family_handle_list():
if fam_id: if fam_id:
fam = self.db.find_family_from_handle(fam_id) fam = self.db.get_family_from_handle(fam_id)
for child_handle in fam.get_child_handle_list(): for child_handle in fam.get_child_handle_list():
self.init_list(child_handle,0) self.init_list(child_handle,0)
@ -442,7 +442,7 @@ class IsLessThanNthGenerationDescendantOf(Rule):
p = self.db.get_person_from_handle(p_id) p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_family_handle_list(): for fam_id in p.get_family_handle_list():
fam = self.db.find_family_from_handle(fam_id) fam = self.db.get_family_from_handle(fam_id)
for child_handle in fam.get_child_handle_list(): for child_handle in fam.get_child_handle_list():
self.init_list(child_handle,gen+1) self.init_list(child_handle,gen+1)
@ -488,7 +488,7 @@ class IsMoreThanNthGenerationDescendantOf(Rule):
p = self.db.get_person_from_handle(p_id) p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_family_handle_list(): for fam_id in p.get_family_handle_list():
fam = self.db.find_family_from_handle(fam_id) fam = self.db.get_family_from_handle(fam_id)
for child_handle in fam.get_child_handle_list(): for child_handle in fam.get_child_handle_list():
self.init_list(child_handle,gen+1) self.init_list(child_handle,gen+1)
@ -532,7 +532,7 @@ class IsChildOfFilterMatch(Rule):
def init_list(self,p_id): def init_list(self,p_id):
p = self.db.get_person_from_handle(p_id) p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_family_handle_list(): for fam_id in p.get_family_handle_list():
fam = self.db.find_family_from_handle(fam_id) fam = self.db.get_family_from_handle(fam_id)
for child_handle in fam.get_child_handle_list(): for child_handle in fam.get_child_handle_list():
self.map[child_handle] = 1 self.map[child_handle] = 1
@ -570,14 +570,14 @@ class IsDescendantFamilyOf(Rule):
p = self.db.get_person_from_handle(p_id) p = self.db.get_person_from_handle(p_id)
for (f,r1,r2) in p.get_parent_family_handle_list(): for (f,r1,r2) in p.get_parent_family_handle_list():
family = self.db.find_family_from_handle(f) family = self.db.get_family_from_handle(f)
for person_handle in [family.get_mother_handle(),family.get_father_handle()]: for person_handle in [family.get_mother_handle(),family.get_father_handle()]:
if person_handle: if person_handle:
if self.search(person_handle,0): if self.search(person_handle,0):
return 1 return 1
if val: if val:
for family_handle in p.get_family_handle_list(): for family_handle in p.get_family_handle_list():
family = self.db.find_family_from_handle(family_handle) family = self.db.get_family_from_handle(family_handle)
if p_id == family.get_father_handle(): if p_id == family.get_father_handle():
spouse_id = family.get_mother_handle() spouse_id = family.get_mother_handle()
else: else:
@ -636,7 +636,7 @@ class IsAncestorOf(Rule):
p = self.db.get_person_from_handle(p_id) p = self.db.get_person_from_handle(p_id)
fam_id = p.get_main_parents_family_handle() fam_id = p.get_main_parents_family_handle()
if fam_id: if fam_id:
fam = self.db.find_family_from_handle(fam_id) fam = self.db.get_family_from_handle(fam_id)
f_id = fam.get_father_handle() f_id = fam.get_father_handle()
m_id = fam.get_mother_handle() m_id = fam.get_mother_handle()
@ -733,7 +733,7 @@ class IsLessThanNthGenerationAncestorOf(Rule):
p = self.db.get_person_from_handle(p_id) p = self.db.get_person_from_handle(p_id)
fam_id = p.get_main_parents_family_handle() fam_id = p.get_main_parents_family_handle()
if fam_id: if fam_id:
fam = self.db.find_family_from_handle(fam_id) fam = self.db.get_family_from_handle(fam_id)
f_id = fam.get_father_handle() f_id = fam.get_father_handle()
m_id = fam.get_mother_handle() m_id = fam.get_mother_handle()
@ -786,7 +786,7 @@ class IsMoreThanNthGenerationAncestorOf(Rule):
p = self.db.get_person_from_handle(p_id) p = self.db.get_person_from_handle(p_id)
fam_id = p.get_main_parents_family_handle() fam_id = p.get_main_parents_family_handle()
if fam_id: if fam_id:
fam = self.db.find_family_from_handle(fam_id) fam = self.db.get_family_from_handle(fam_id)
f_id = fam.get_father_handle() f_id = fam.get_father_handle()
m_id = fam.get_mother_handle() m_id = fam.get_mother_handle()
@ -835,7 +835,7 @@ class IsParentOfFilterMatch(Rule):
def init_list(self,p_id): def init_list(self,p_id):
p = self.db.get_person_from_handle(p_id) p = self.db.get_person_from_handle(p_id)
for fam_id in p.get_main_parents_family_handle(): for fam_id in p.get_main_parents_family_handle():
fam = self.db.find_family_from_handle(fam_id) fam = self.db.get_family_from_handle(fam_id)
for parent_id in [fam.get_father_handle (), fam.get_mother_handle ()]: for parent_id in [fam.get_father_handle (), fam.get_mother_handle ()]:
if parent_id: if parent_id:
self.map[parent_id] = 1 self.map[parent_id] = 1
@ -1023,7 +1023,7 @@ class HasFamilyEvent(Rule):
def apply(self,db,p_id): def apply(self,db,p_id):
p = db.get_person_from_handle(p_id) p = db.get_person_from_handle(p_id)
for f_id in p.get_family_handle_list(): for f_id in p.get_family_handle_list():
f = db.find_family_from_handle(f_id) f = db.get_family_from_handle(f_id)
for event_handle in f.get_event_list(): for event_handle in f.get_event_list():
if not event_handle: if not event_handle:
continue continue
@ -1076,7 +1076,7 @@ class HasRelationship(Rule):
# count children and look for a relationship type match # count children and look for a relationship type match
for f_id in p.get_family_handle_list(): for f_id in p.get_family_handle_list():
f = db.find_family_from_handle(f_id) f = db.get_family_from_handle(f_id)
cnt = cnt + len(f.get_child_handle_list()) cnt = cnt + len(f.get_child_handle_list())
if self.list[1] and f.get_relationship() == self.list[1]: if self.list[1] and f.get_relationship() == self.list[1]:
rel_type = 1 rel_type = 1
@ -1238,7 +1238,7 @@ class HasFamilyAttribute(Rule):
def apply(self,db,p_id): def apply(self,db,p_id):
p = db.get_person_from_handle(p_id) p = db.get_person_from_handle(p_id)
for f_id in p.get_family_handle_list(): for f_id in p.get_family_handle_list():
f = db.find_family_from_handle(f_id) f = db.get_family_from_handle(f_id)
for event in f.getAttributes(): for event in f.getAttributes():
val = 1 val = 1
if self.list[0] and event.get_type() != self.list[0]: if self.list[0] and event.get_type() != self.list[0]:
@ -1359,7 +1359,7 @@ class IsSpouseOfFilterMatch(Rule):
filter = MatchesFilter (self.list) filter = MatchesFilter (self.list)
p = db.get_person_from_handle(p_id) p = db.get_person_from_handle(p_id)
for family_handle in p.get_family_handle_list (): for family_handle in p.get_family_handle_list ():
family = db.find_family_from_handle(family_handle) family = db.get_family_from_handle(family_handle)
for spouse_id in [family.get_father_handle (), family.get_mother_handle ()]: for spouse_id in [family.get_father_handle (), family.get_mother_handle ()]:
if not spouse_id: if not spouse_id:
continue continue

View File

@ -111,7 +111,7 @@ _get_int = re.compile('([0-9]+)')
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def add_familys_sources(db,family_handle,slist,private): def add_familys_sources(db,family_handle,slist,private):
family = db.find_family_from_handle(family_handle) family = db.get_family_from_handle(family_handle)
for event_handle in family.get_event_list(): for event_handle in family.get_event_list():
if event_handle: if event_handle:
event = db.find_event_from_handle(event_handle) event = db.find_event_from_handle(event_handle)
@ -742,7 +742,7 @@ class GedcomWriter:
nump = float(len(self.flist)) nump = float(len(self.flist))
index = 0.0 index = 0.0
for family_handle in self.flist.keys(): for family_handle in self.flist.keys():
family = self.db.find_family_from_handle(family_handle) family = self.db.get_family_from_handle(family_handle)
father_alive = mother_alive = 0 father_alive = mother_alive = 0
self.writeln("0 @%s@ FAM" % self.fid(family_handle)) self.writeln("0 @%s@ FAM" % self.fid(family_handle))
self.frefn(family_handle) self.frefn(family_handle)