1683 Untranslatable text in Relationship calculator window - no crash on rel_xx tests (contribution by Andrew I Baznikin)
svn: r13973
This commit is contained in:
parent
4acca6c7af
commit
7001690176
@ -4,6 +4,7 @@
|
||||
#
|
||||
# Copyright (C) 2003-2005 Donald N. Allingham
|
||||
# Copyright (C) 2008 Brian G. Matherly
|
||||
# Copyright (C) 2010 Andrew I Baznikin
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -123,7 +124,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('sønne')
|
||||
else:
|
||||
result.append('datter')
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
if person == gen.lib.Person.MALE:
|
||||
result.append('søn')
|
||||
else:
|
||||
result.append('datter')
|
||||
@ -146,47 +147,21 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('sønne')
|
||||
else:
|
||||
result.append('datter')
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
if person == gen.lib.Person.MALE:
|
||||
result.append('søn')
|
||||
else:
|
||||
result.append('datter')
|
||||
else:
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
if person == gen.lib.Person.MALE:
|
||||
result.append('bror')
|
||||
else:
|
||||
result.append('søster')
|
||||
return self.pair_up(result)
|
||||
|
||||
def get_relationship(self,db, orig_person, other_person):
|
||||
"""
|
||||
Return a string representing the relationshp between the two people,
|
||||
along with a list of common ancestors (typically father,mother)
|
||||
|
||||
Special cases: relation strings "", "undefined" and "spouse".
|
||||
"""
|
||||
|
||||
if orig_person is None:
|
||||
return ("undefined",[])
|
||||
|
||||
if orig_person.get_handle() == other_person.get_handle():
|
||||
return ('', [])
|
||||
|
||||
is_spouse = self.is_spouse(db, orig_person, other_person)
|
||||
if is_spouse:
|
||||
return (is_spouse,[])
|
||||
|
||||
#get_relationship_distance changed, first data is relation to
|
||||
#orig person, apperently secondRel in this function
|
||||
(secondRel,firstRel,common) = \
|
||||
self.get_relationship_distance(db, orig_person, other_person)
|
||||
|
||||
if isinstance(common, basestring):
|
||||
return (common,[])
|
||||
elif common:
|
||||
person_handle = common[0]
|
||||
else:
|
||||
return ("",[])
|
||||
def get_relationship(self,
|
||||
secondRel, firstRel, orig_person, other_person):
|
||||
|
||||
common = ""
|
||||
if not firstRel:
|
||||
if not secondRel:
|
||||
return ('',common)
|
||||
@ -197,6 +172,16 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
else:
|
||||
return (self.get_two_way_rel(other_person,firstRel,secondRel),common)
|
||||
|
||||
def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b,
|
||||
reltocommon_a, reltocommon_b,
|
||||
only_birth=True,
|
||||
in_law_a=False, in_law_b=False):
|
||||
return self.get_relationship(reltocommon_a, reltocommon_b, gender_a, gender_b)[0];
|
||||
|
||||
def get_sibling_relationship_string(self, sib_type, gender_a, gender_b,
|
||||
in_law_a=False, in_law_b=False):
|
||||
return self.get_two_way_rel(gender_b,"","")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# Test function. Call it as follows from the command line (so as to find
|
||||
|
@ -4,6 +4,7 @@
|
||||
#
|
||||
# Copyright (C) 2003-2005 Donald N. Allingham
|
||||
# Copyright (C) 2008 Brian G. Matherly
|
||||
# Copyright (C) 2010 Andrew I Baznikin
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -86,7 +87,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('isän')
|
||||
else:
|
||||
result.append('äidin')
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
if person == gen.lib.Person.MALE:
|
||||
result.append('isä')
|
||||
else:
|
||||
result.append('äiti')
|
||||
@ -101,9 +102,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('tyttären')
|
||||
else:
|
||||
result.append('lapsen')
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
if person == gen.lib.Person.MALE:
|
||||
result.append('poika')
|
||||
elif person.get_gender() == gen.lib.Person.FEMALE:
|
||||
elif person == gen.lib.Person.FEMALE:
|
||||
result.append('tytär')
|
||||
else:
|
||||
result.append('lapsi')
|
||||
@ -138,9 +139,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('tyttären')
|
||||
else:
|
||||
result.append('lapsen')
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
if person == gen.lib.Person.MALE:
|
||||
result.append('poika')
|
||||
elif person.get_gender() == gen.lib.Person.FEMALE:
|
||||
elif person == gen.lib.Person.FEMALE:
|
||||
result.append('tytär')
|
||||
else:
|
||||
result.append('lapsi')
|
||||
@ -167,36 +168,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
return ' '.join(result)
|
||||
|
||||
|
||||
def get_relationship(self,db, orig_person, other_person):
|
||||
"""
|
||||
Return a string representing the relationshp between the two people,
|
||||
along with a list of common ancestors (typically father,mother)
|
||||
|
||||
Special cases: relation strings "", "undefined" and "spouse".
|
||||
"""
|
||||
|
||||
if orig_person is None:
|
||||
return ("undefined",[])
|
||||
|
||||
if orig_person.get_handle() == other_person.get_handle():
|
||||
return ('', [])
|
||||
|
||||
is_spouse = self.is_spouse(db, orig_person, other_person)
|
||||
if is_spouse:
|
||||
return (is_spouse,[])
|
||||
|
||||
#get_relationship_distance changed, first data is relation to
|
||||
#orig person, apperently secondRel in this function
|
||||
(secondRel,firstRel,common) = \
|
||||
self.get_relationship_distance(db, orig_person, other_person)
|
||||
|
||||
if isinstance(common, basestring):
|
||||
return (common,[])
|
||||
elif common:
|
||||
person_handle = common[0]
|
||||
else:
|
||||
return ("",[])
|
||||
def get_relationship(self,
|
||||
secondRel, firstRel, orig_person, other_person):
|
||||
|
||||
common = ""
|
||||
if not firstRel:
|
||||
if not secondRel:
|
||||
return ('',common)
|
||||
@ -205,7 +180,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
elif not secondRel:
|
||||
return (self.get_direct_descendant(other_person,firstRel),common)
|
||||
elif len(firstRel) == 1:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
if other_person == gen.lib.Person.MALE:
|
||||
return (self.get_ancestors_brother(secondRel),common)
|
||||
else:
|
||||
return (self.get_ancestors_sister(secondRel),common)
|
||||
@ -214,6 +189,19 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
else:
|
||||
return (self.get_cousins_descendant(other_person,firstRel,secondRel),common)
|
||||
|
||||
def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b,
|
||||
reltocommon_a, reltocommon_b,
|
||||
only_birth=True,
|
||||
in_law_a=False, in_law_b=False):
|
||||
return self.get_relationship(reltocommon_a, reltocommon_b, gender_a, gender_b)[0];
|
||||
|
||||
def get_sibling_relationship_string(self, sib_type, gender_a, gender_b,
|
||||
in_law_a=False, in_law_b=False):
|
||||
if gender_b == gen.lib.Person.MALE:
|
||||
return self.get_ancestors_brother("")
|
||||
else:
|
||||
return self.get_ancestors_sister("")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# Test function. Call it as follows from the command line (so as to find
|
||||
|
@ -4,6 +4,7 @@
|
||||
#
|
||||
# Copyright (C) 2003-2005 Donald N. Allingham
|
||||
# Copyright (C) 2008 Brian G. Matherly
|
||||
# Copyright (C) 2010 Andrew I Baznikin
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -114,7 +115,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('sønne')
|
||||
else:
|
||||
result.append('datter')
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
if person == gen.lib.Person.MALE:
|
||||
result.append('sønn')
|
||||
else:
|
||||
result.append('datter')
|
||||
@ -131,7 +132,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('mor')
|
||||
if level > 1:
|
||||
result.append(self.get_cousin(level))
|
||||
elif person.get_gender() == gen.lib.Person.MALE:
|
||||
elif person == gen.lib.Person.MALE:
|
||||
result.append('fetter')
|
||||
else:
|
||||
result.append('kusine')
|
||||
@ -160,7 +161,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('sønn')
|
||||
else:
|
||||
result.append('datter')
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
if person == gen.lib.Person.MALE:
|
||||
result.append('sønn')
|
||||
else:
|
||||
result.append('datter')
|
||||
@ -206,47 +207,21 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('sønne')
|
||||
else:
|
||||
result.append('datter')
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
if person == gen.lib.Person.MALE:
|
||||
result.append('sønn')
|
||||
else:
|
||||
result.append('datter')
|
||||
else:
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
if person == gen.lib.Person.MALE:
|
||||
result.append('bror')
|
||||
else:
|
||||
result.append('søster')
|
||||
return self.pair_up(result)
|
||||
|
||||
def get_relationship(self,db, orig_person, other_person):
|
||||
"""
|
||||
Return a string representing the relationshp between the two people,
|
||||
along with a list of common ancestors (typically father,mother)
|
||||
|
||||
Special cases: relation strings "", "undefined" and "spouse".
|
||||
"""
|
||||
|
||||
if orig_person is None:
|
||||
return ("undefined",[])
|
||||
|
||||
if orig_person.get_handle() == other_person.get_handle():
|
||||
return ('', [])
|
||||
|
||||
is_spouse = self.is_spouse(db, orig_person, other_person)
|
||||
if is_spouse:
|
||||
return (is_spouse,[])
|
||||
|
||||
#get_relationship_distance changed, first data is relation to
|
||||
#orig person, apperently secondRel in this function
|
||||
(secondRel,firstRel,common) = \
|
||||
self.get_relationship_distance(db, orig_person, other_person)
|
||||
|
||||
if isinstance(common, basestring):
|
||||
return (common,[])
|
||||
elif common:
|
||||
person_handle = common[0]
|
||||
else:
|
||||
return ("",[])
|
||||
def get_relationship(self,
|
||||
secondRel, firstRel, orig_person, other_person):
|
||||
|
||||
common = ""
|
||||
if not firstRel:
|
||||
if not secondRel:
|
||||
return ('',common)
|
||||
@ -255,7 +230,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
elif not secondRel:
|
||||
return (self.get_direct_descendant(other_person,firstRel),common)
|
||||
elif len(firstRel) == 1:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
if other_person == gen.lib.Person.MALE:
|
||||
return (self.get_ancestors_brother(secondRel),common)
|
||||
else:
|
||||
return (self.get_ancestors_sister(secondRel),common)
|
||||
@ -263,6 +238,16 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
return (self.get_ancestors_cousin(other_person,secondRel,firstRel),common)
|
||||
else:
|
||||
return (self.get_cousins_descendant(other_person,firstRel,secondRel),common)
|
||||
|
||||
def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b,
|
||||
reltocommon_a, reltocommon_b,
|
||||
only_birth=True,
|
||||
in_law_a=False, in_law_b=False):
|
||||
return self.get_relationship(reltocommon_a, reltocommon_b, gender_a, gender_b)[0];
|
||||
|
||||
def get_sibling_relationship_string(self, sib_type, gender_a, gender_b,
|
||||
in_law_a=False, in_law_b=False):
|
||||
return self.get_two_way_rel(gender_b,"","")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user