* src/plugins/RelCalc.py: Handle IDs properly
* src/Relationship.py: Handle IDs properly * src/home.png: added new default person icon svn: r2838
This commit is contained in:
parent
d9f25a4987
commit
3fef3dd32e
@ -265,19 +265,19 @@ class RelationshipCalculator:
|
||||
return ("spouse",[])
|
||||
|
||||
try:
|
||||
self.apply_filter(orig_person,0,firstList,firstMap)
|
||||
self.apply_filter(other_person,0,secondList,secondMap)
|
||||
self.apply_filter(orig_person.get_id(),0,firstList,firstMap)
|
||||
self.apply_filter(other_person.get_id(),0,secondList,secondMap)
|
||||
except RuntimeError,msg:
|
||||
return (_("Relationship loop detected"),None)
|
||||
|
||||
for person in firstList:
|
||||
if person in secondList:
|
||||
new_rank = firstMap[person.get_id()]
|
||||
for person_id in firstList:
|
||||
if person_id in secondList:
|
||||
new_rank = firstMap[person_id]
|
||||
if new_rank < rank:
|
||||
rank = new_rank
|
||||
common = [ person ]
|
||||
common = [ person_id ]
|
||||
elif new_rank == rank:
|
||||
common.append(person)
|
||||
common.append(person_id)
|
||||
|
||||
firstRel = -1
|
||||
secondRel = -1
|
||||
@ -285,17 +285,17 @@ class RelationshipCalculator:
|
||||
length = len(common)
|
||||
|
||||
if length == 1:
|
||||
person = common[0]
|
||||
secondRel = firstMap[person.get_id()]
|
||||
firstRel = secondMap[person.get_id()]
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
elif length == 2:
|
||||
p1 = common[0]
|
||||
secondRel = firstMap[p1.get_id()]
|
||||
firstRel = secondMap[p1.get_id()]
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
elif length > 2:
|
||||
person = common[0]
|
||||
secondRel = firstMap[person.get_id()]
|
||||
firstRel = secondMap[person.get_id()]
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
|
||||
if firstRel == -1:
|
||||
return ("",[])
|
||||
@ -348,14 +348,14 @@ class RelationshipCalculator:
|
||||
self.apply_filter(orig_person,0,firstList,firstMap)
|
||||
self.apply_filter(other_person,0,secondList,secondMap)
|
||||
|
||||
for person in firstList:
|
||||
if person in secondList:
|
||||
new_rank = firstMap[person.get_id()]
|
||||
for person_id in firstList:
|
||||
if person_id in secondList:
|
||||
new_rank = firstMap[person_id]
|
||||
if new_rank < rank:
|
||||
rank = new_rank
|
||||
common = [ person ]
|
||||
common = [ person_id ]
|
||||
elif new_rank == rank:
|
||||
common.append(person)
|
||||
common.append(person_id)
|
||||
|
||||
firstRel = -1
|
||||
secondRel = -1
|
||||
@ -363,17 +363,17 @@ class RelationshipCalculator:
|
||||
length = len(common)
|
||||
|
||||
if length == 1:
|
||||
person = common[0]
|
||||
secondRel = firstMap[person.get_id()]
|
||||
firstRel = secondMap[person.get_id()]
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
elif length == 2:
|
||||
p1 = common[0]
|
||||
secondRel = firstMap[p1.get_id()]
|
||||
firstRel = secondMap[p1.get_id()]
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
elif length > 2:
|
||||
person = common[0]
|
||||
secondRel = firstMap[person.get_id()]
|
||||
firstRel = secondMap[person.get_id()]
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
|
||||
if firstRel == 0:
|
||||
if secondRel == 0:
|
||||
|
@ -69,8 +69,8 @@ class RelCalc:
|
||||
def __init__(self,database,person):
|
||||
self.person = person
|
||||
self.db = database
|
||||
self.RelClass = Plugins.relationship_class(database)
|
||||
self.relationship = self.RelClass.get_relationship
|
||||
self.RelClass = Plugins.relationship_class
|
||||
self.relationship = self.RelClass(database)
|
||||
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = "%s/relcalc.glade" % base
|
||||
@ -112,23 +112,24 @@ class RelCalc:
|
||||
id = self.clist.get_object(iter)
|
||||
other_person = self.db.get_person(id)
|
||||
|
||||
(rel_string,common) = self.relationship(self.person,other_person)
|
||||
(rel_string,common) = self.relationship.get_relationship(self.person,other_person)
|
||||
length = len(common)
|
||||
|
||||
if length == 1:
|
||||
person = common[0]
|
||||
person = self.db.find_person_from_id(common[0])
|
||||
name = person.get_primary_name().get_regular_name()
|
||||
commontext = " " + _("Their common ancestor is %s.") % name
|
||||
elif length == 2:
|
||||
p1 = common[0]
|
||||
p2 = common[1]
|
||||
p1 = self.db.find_person_from_id(common[0])
|
||||
p2 = self.db.find_person_from_id(common[1])
|
||||
commontext = " " + _("Their common ancestors are %s and %s.") % \
|
||||
(p1.get_primary_name().get_regular_name(),\
|
||||
p2.get_primary_name().get_regular_name())
|
||||
elif length > 2:
|
||||
index = 0
|
||||
commontext = " " + _("Their common ancestors are : ")
|
||||
for person in common:
|
||||
for person_id in common:
|
||||
person = self.db.find_person_form_id(person_id)
|
||||
if index != 0:
|
||||
commontext = commontext + ", "
|
||||
commontext = commontext + person.get_primary_name().get_regular_name()
|
||||
|
Loading…
Reference in New Issue
Block a user