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