* 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",[])
|
return ("spouse",[])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.apply_filter(orig_person,0,firstList,firstMap)
|
self.apply_filter(orig_person.get_id(),0,firstList,firstMap)
|
||||||
self.apply_filter(other_person,0,secondList,secondMap)
|
self.apply_filter(other_person.get_id(),0,secondList,secondMap)
|
||||||
except RuntimeError,msg:
|
except RuntimeError,msg:
|
||||||
return (_("Relationship loop detected"),None)
|
return (_("Relationship loop detected"),None)
|
||||||
|
|
||||||
for person in firstList:
|
for person_id in firstList:
|
||||||
if person in secondList:
|
if person_id in secondList:
|
||||||
new_rank = firstMap[person.get_id()]
|
new_rank = firstMap[person_id]
|
||||||
if new_rank < rank:
|
if new_rank < rank:
|
||||||
rank = new_rank
|
rank = new_rank
|
||||||
common = [ person ]
|
common = [ person_id ]
|
||||||
elif new_rank == rank:
|
elif new_rank == rank:
|
||||||
common.append(person)
|
common.append(person_id)
|
||||||
|
|
||||||
firstRel = -1
|
firstRel = -1
|
||||||
secondRel = -1
|
secondRel = -1
|
||||||
@ -285,17 +285,17 @@ class RelationshipCalculator:
|
|||||||
length = len(common)
|
length = len(common)
|
||||||
|
|
||||||
if length == 1:
|
if length == 1:
|
||||||
person = common[0]
|
person_id = common[0]
|
||||||
secondRel = firstMap[person.get_id()]
|
secondRel = firstMap[person_id]
|
||||||
firstRel = secondMap[person.get_id()]
|
firstRel = secondMap[person_id]
|
||||||
elif length == 2:
|
elif length == 2:
|
||||||
p1 = common[0]
|
person_id = common[0]
|
||||||
secondRel = firstMap[p1.get_id()]
|
secondRel = firstMap[person_id]
|
||||||
firstRel = secondMap[p1.get_id()]
|
firstRel = secondMap[person_id]
|
||||||
elif length > 2:
|
elif length > 2:
|
||||||
person = common[0]
|
person_id = common[0]
|
||||||
secondRel = firstMap[person.get_id()]
|
secondRel = firstMap[person_id]
|
||||||
firstRel = secondMap[person.get_id()]
|
firstRel = secondMap[person_id]
|
||||||
|
|
||||||
if firstRel == -1:
|
if firstRel == -1:
|
||||||
return ("",[])
|
return ("",[])
|
||||||
@ -348,14 +348,14 @@ class RelationshipCalculator:
|
|||||||
self.apply_filter(orig_person,0,firstList,firstMap)
|
self.apply_filter(orig_person,0,firstList,firstMap)
|
||||||
self.apply_filter(other_person,0,secondList,secondMap)
|
self.apply_filter(other_person,0,secondList,secondMap)
|
||||||
|
|
||||||
for person in firstList:
|
for person_id in firstList:
|
||||||
if person in secondList:
|
if person_id in secondList:
|
||||||
new_rank = firstMap[person.get_id()]
|
new_rank = firstMap[person_id]
|
||||||
if new_rank < rank:
|
if new_rank < rank:
|
||||||
rank = new_rank
|
rank = new_rank
|
||||||
common = [ person ]
|
common = [ person_id ]
|
||||||
elif new_rank == rank:
|
elif new_rank == rank:
|
||||||
common.append(person)
|
common.append(person_id)
|
||||||
|
|
||||||
firstRel = -1
|
firstRel = -1
|
||||||
secondRel = -1
|
secondRel = -1
|
||||||
@ -363,17 +363,17 @@ class RelationshipCalculator:
|
|||||||
length = len(common)
|
length = len(common)
|
||||||
|
|
||||||
if length == 1:
|
if length == 1:
|
||||||
person = common[0]
|
person_id = common[0]
|
||||||
secondRel = firstMap[person.get_id()]
|
secondRel = firstMap[person_id]
|
||||||
firstRel = secondMap[person.get_id()]
|
firstRel = secondMap[person_id]
|
||||||
elif length == 2:
|
elif length == 2:
|
||||||
p1 = common[0]
|
person_id = common[0]
|
||||||
secondRel = firstMap[p1.get_id()]
|
secondRel = firstMap[person_id]
|
||||||
firstRel = secondMap[p1.get_id()]
|
firstRel = secondMap[person_id]
|
||||||
elif length > 2:
|
elif length > 2:
|
||||||
person = common[0]
|
person_id = common[0]
|
||||||
secondRel = firstMap[person.get_id()]
|
secondRel = firstMap[person_id]
|
||||||
firstRel = secondMap[person.get_id()]
|
firstRel = secondMap[person_id]
|
||||||
|
|
||||||
if firstRel == 0:
|
if firstRel == 0:
|
||||||
if secondRel == 0:
|
if secondRel == 0:
|
||||||
|
@ -69,8 +69,8 @@ class RelCalc:
|
|||||||
def __init__(self,database,person):
|
def __init__(self,database,person):
|
||||||
self.person = person
|
self.person = person
|
||||||
self.db = database
|
self.db = database
|
||||||
self.RelClass = Plugins.relationship_class(database)
|
self.RelClass = Plugins.relationship_class
|
||||||
self.relationship = self.RelClass.get_relationship
|
self.relationship = self.RelClass(database)
|
||||||
|
|
||||||
base = os.path.dirname(__file__)
|
base = os.path.dirname(__file__)
|
||||||
glade_file = "%s/relcalc.glade" % base
|
glade_file = "%s/relcalc.glade" % base
|
||||||
@ -112,23 +112,24 @@ class RelCalc:
|
|||||||
id = self.clist.get_object(iter)
|
id = self.clist.get_object(iter)
|
||||||
other_person = self.db.get_person(id)
|
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)
|
length = len(common)
|
||||||
|
|
||||||
if length == 1:
|
if length == 1:
|
||||||
person = common[0]
|
person = self.db.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 = common[0]
|
p1 = self.db.find_person_from_id(common[0])
|
||||||
p2 = common[1]
|
p2 = self.db.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())
|
||||||
elif length > 2:
|
elif length > 2:
|
||||||
index = 0
|
index = 0
|
||||||
commontext = " " + _("Their common ancestors are : ")
|
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:
|
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()
|
||||||
|
Loading…
Reference in New Issue
Block a user