* src/Relationship.py: More corrections.
* src/plugins/rel_ru.py: Corrections. * src/gramps_main.py: Corrections. svn: r2842
This commit is contained in:
parent
1c94371e33
commit
983186336c
@ -1,3 +1,8 @@
|
||||
2004-02-15 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||
* src/Relationship.py: More corrections.
|
||||
* src/plugins/rel_ru.py: Corrections.
|
||||
* src/gramps_main.py: Corrections.
|
||||
|
||||
2004-02-15 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/plugins/RelCalc.py: Handle IDs properly
|
||||
* src/Relationship.py: Handle IDs properly
|
||||
|
@ -282,17 +282,7 @@ class RelationshipCalculator:
|
||||
firstRel = -1
|
||||
secondRel = -1
|
||||
|
||||
length = len(common)
|
||||
|
||||
if length == 1:
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
elif length == 2:
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
elif length > 2:
|
||||
if common:
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
@ -327,6 +317,7 @@ class RelationshipCalculator:
|
||||
else:
|
||||
return (self.get_cousin(secondRel-1,firstRel-secondRel),common)
|
||||
|
||||
|
||||
def get_grandparents_string(self,orig_person,other_person):
|
||||
"""
|
||||
returns a string representing the relationshp between the two people,
|
||||
@ -345,8 +336,11 @@ class RelationshipCalculator:
|
||||
if orig_person == other_person:
|
||||
return ('', [])
|
||||
|
||||
self.apply_filter(orig_person,0,firstList,firstMap)
|
||||
self.apply_filter(other_person,0,secondList,secondMap)
|
||||
try:
|
||||
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_id in firstList:
|
||||
if person_id in secondList:
|
||||
@ -360,17 +354,7 @@ class RelationshipCalculator:
|
||||
firstRel = -1
|
||||
secondRel = -1
|
||||
|
||||
length = len(common)
|
||||
|
||||
if length == 1:
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
elif length == 2:
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
elif length > 2:
|
||||
if common:
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
|
@ -141,8 +141,8 @@ class Gramps:
|
||||
self.db.set_pprefix(GrampsCfg.pprefix)
|
||||
|
||||
GrampsCfg.loadConfig(self.pref_callback)
|
||||
self.RelClass = Plugins.relationship_class(self.db)
|
||||
self.relationship = self.RelClass.get_relationship
|
||||
self.RelClass = Plugins.relationship_class
|
||||
self.relationship = self.RelClass(self.db)
|
||||
self.init_interface()
|
||||
|
||||
if args:
|
||||
@ -661,8 +661,8 @@ class Gramps:
|
||||
Plugins.build_export_menu(export_menu,self.export_callback)
|
||||
Plugins.build_import_menu(import_menu,self.import_callback)
|
||||
|
||||
self.RelClass = Plugins.relationship_class(self.db)
|
||||
self.relationship = self.RelClass.get_relationship
|
||||
self.RelClass = Plugins.relationship_class
|
||||
self.relationship = self.RelClass(self.db)
|
||||
|
||||
def init_filters(self):
|
||||
|
||||
@ -1397,9 +1397,9 @@ class Gramps:
|
||||
def display_relationship(self):
|
||||
try:
|
||||
pname = GrampsCfg.nameof(self.db.get_default_person())
|
||||
(name,plist) = self.relationship(self.db.get_default_person(),
|
||||
self.active_person)
|
||||
|
||||
(name,plist) = self.relationship.get_relationship(
|
||||
self.db.get_default_person(),
|
||||
self.active_person)
|
||||
if name:
|
||||
if plist == None:
|
||||
return name
|
||||
|
@ -220,41 +220,30 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
if self.is_spouse(orig_person,other_person):
|
||||
return ("spouse",[])
|
||||
|
||||
self.apply_filter(orig_person,0,firstList,firstMap)
|
||||
self.apply_filter(other_person,0,secondList,secondMap)
|
||||
try:
|
||||
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)
|
||||
|
||||
print len(firstList)
|
||||
print len(secondList)
|
||||
|
||||
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
|
||||
|
||||
length = len(common)
|
||||
|
||||
if length == 1:
|
||||
person = common[0]
|
||||
secondRel = firstMap[person.get_id()]
|
||||
firstRel = secondMap[person.get_id()]
|
||||
elif length == 2:
|
||||
p1 = common[0]
|
||||
secondRel = firstMap[p1.get_id()]
|
||||
firstRel = secondMap[p1.get_id()]
|
||||
elif length > 2:
|
||||
person = common[0]
|
||||
secondRel = firstMap[person.get_id()]
|
||||
firstRel = secondMap[person.get_id()]
|
||||
if common:
|
||||
person_id = common[0]
|
||||
secondRel = firstMap[person_id]
|
||||
firstRel = secondMap[person_id]
|
||||
|
||||
if firstRel == -1:
|
||||
print '2'
|
||||
return ("",[])
|
||||
elif firstRel == 0:
|
||||
if secondRel == 0:
|
||||
|
Loading…
Reference in New Issue
Block a user