* src/Relationship.py: limit search depth to 15 generations.
svn: r5456
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
2005-11-29 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/Relationship.py: limit search depth to 15 generations.
|
||||||
|
|
||||||
2005-11-29 Alex Roitman <shura@gramps-project.org>
|
2005-11-29 Alex Roitman <shura@gramps-project.org>
|
||||||
* doc/xmldocs.make: Revert help path to keep under gramps dir.
|
* doc/xmldocs.make: Revert help path to keep under gramps dir.
|
||||||
* doc/gramps-manual/Makefile.am: Add symlink to keep all gnome
|
* doc/gramps-manual/Makefile.am: Add symlink to keep all gnome
|
||||||
|
@@ -156,6 +156,8 @@ _niece_level = [ "", "niece", "grandniece", "great grandniece", "second great gr
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MAX_DEPTH = 15
|
||||||
|
|
||||||
class RelationshipCalculator:
|
class RelationshipCalculator:
|
||||||
|
|
||||||
def __init__(self,db):
|
def __init__(self,db):
|
||||||
@@ -164,19 +166,27 @@ class RelationshipCalculator:
|
|||||||
def set_db(self,db):
|
def set_db(self,db):
|
||||||
self.db = db
|
self.db = db
|
||||||
|
|
||||||
def apply_filter(self,person,rel_str,plist,pmap):
|
def apply_filter(self,person,rel_str,plist,pmap,current_gen=1):
|
||||||
if person == None:
|
if person == None or current_gen > MAX_DEPTH:
|
||||||
return
|
return
|
||||||
plist.append(person.get_handle())
|
current_gen += 1
|
||||||
pmap[person.get_handle()] = rel_str
|
plist.append(person.handle)
|
||||||
|
pmap[person.handle] = rel_str
|
||||||
|
|
||||||
family_handle = person.get_main_parents_family_handle()
|
family_handle = person.get_main_parents_family_handle()
|
||||||
family = self.db.get_family_from_handle(family_handle)
|
try:
|
||||||
if family_handle != None and family:
|
if family_handle:
|
||||||
father = self.db.get_person_from_handle(family.get_father_handle())
|
family = self.db.get_family_from_handle(family_handle)
|
||||||
mother = self.db.get_person_from_handle(family.get_mother_handle())
|
fhandle = family.father_handle
|
||||||
self.apply_filter(father,rel_str+'f',plist,pmap)
|
if fhandle:
|
||||||
self.apply_filter(mother,rel_str+'m',plist,pmap)
|
father = self.db.get_person_from_handle(fhandle)
|
||||||
|
self.apply_filter(father,rel_str+'f',plist,pmap,current_gen)
|
||||||
|
mhandle = family.mother_handle
|
||||||
|
if mhandle:
|
||||||
|
mother = self.db.get_person_from_handle(mhandle)
|
||||||
|
self.apply_filter(mother,rel_str+'m',plist,pmap,current_gen)
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
def get_cousin(self,level,removed):
|
def get_cousin(self,level,removed):
|
||||||
if removed > len(_removed_level)-1 or level>len(_level_name)-1:
|
if removed > len(_removed_level)-1 or level>len(_level_name)-1:
|
||||||
|
Reference in New Issue
Block a user