1683 Untranslatable text in Relationship calculator window - no crash on rel_xx tests - get working with current API (contribution by Andrew I Baznikin, lcc)
svn: r14021
This commit is contained in:
parent
04763f50fe
commit
9b7d972c99
@ -149,7 +149,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|||||||
else:
|
else:
|
||||||
return "%dº sobrinho" % level
|
return "%dº sobrinho" % level
|
||||||
|
|
||||||
def get_distant_nieve(self, level):
|
def get_distant_niece(self, level):
|
||||||
if level < len(_level_name_female):
|
if level < len(_level_name_female):
|
||||||
return "%s sobrinha" % (_level_name_female[level])
|
return "%s sobrinha" % (_level_name_female[level])
|
||||||
else:
|
else:
|
||||||
@ -246,84 +246,71 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|||||||
else:
|
else:
|
||||||
return "%dª sobrinha neta" % (level-1)
|
return "%dª sobrinha neta" % (level-1)
|
||||||
|
|
||||||
def get_relationship(self, orig_person, other_person):
|
def get_relationship(self, secondRel, firstRel, orig_person_gender, other_person_gender):
|
||||||
"""
|
"""
|
||||||
returns a string representing the relationshp between the two people,
|
returns a string representing the relationshp between the two people,
|
||||||
along with a list of common ancestors (typically father, mother)
|
along with a list of common ancestors (typically father, mother)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if orig_person is None:
|
common = ""
|
||||||
return ("indefinido", [])
|
|
||||||
|
|
||||||
if orig_person.get_handle() == other_person.get_handle():
|
|
||||||
return ('', [])
|
|
||||||
|
|
||||||
is_spouse = self.is_spouse(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(orig_person, other_person)
|
|
||||||
|
|
||||||
if isinstance(common, basestring):
|
|
||||||
return (common, [])
|
|
||||||
elif common:
|
|
||||||
person_handle = common[0]
|
|
||||||
else:
|
|
||||||
return ("", [])
|
|
||||||
|
|
||||||
firstRel = len(firstRel)
|
|
||||||
secondRel = len(secondRel)
|
|
||||||
|
|
||||||
if firstRel == 0:
|
if firstRel == 0:
|
||||||
if secondRel == 0:
|
if secondRel == 0:
|
||||||
return ('', common)
|
return ('', common)
|
||||||
elif other_person.get_gender() == gen.lib.Person.MALE:
|
elif other_person_gender == gen.lib.Person.MALE:
|
||||||
return (self.get_father(secondRel), common)
|
return (self.get_father(secondRel), common)
|
||||||
else:
|
else:
|
||||||
return (self.get_mother(secondRel), common)
|
return (self.get_mother(secondRel), common)
|
||||||
elif secondRel == 0:
|
elif secondRel == 0:
|
||||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
if other_person_gender == gen.lib.Person.MALE:
|
||||||
return (self.get_son(firstRel), common)
|
return (self.get_son(firstRel), common)
|
||||||
else:
|
else:
|
||||||
return (self.get_daughter(firstRel), common)
|
return (self.get_daughter(firstRel), common)
|
||||||
elif firstRel == 1:
|
elif firstRel == 1:
|
||||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
if other_person_gender == gen.lib.Person.MALE:
|
||||||
return (self.get_uncle(secondRel), common)
|
return (self.get_uncle(secondRel), common)
|
||||||
else:
|
else:
|
||||||
return (self.get_aunt(secondRel), common)
|
return (self.get_aunt(secondRel), common)
|
||||||
elif secondRel == 1:
|
elif secondRel == 1:
|
||||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
if other_person_gender == gen.lib.Person.MALE:
|
||||||
return (self.get_nephew(firstRel-1), common)
|
return (self.get_nephew(firstRel-1), common)
|
||||||
else:
|
else:
|
||||||
return (self.get_niece(firstRel-1), common)
|
return (self.get_niece(firstRel-1), common)
|
||||||
elif firstRel == secondRel == 2:
|
elif firstRel == secondRel == 2:
|
||||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
if other_person_gender == gen.lib.Person.MALE:
|
||||||
return ('primo irmão', common)
|
return ('primo irmão', common)
|
||||||
else:
|
else:
|
||||||
return ('prima irmã', common)
|
return ('prima irmã', common)
|
||||||
elif firstRel == secondRel:
|
elif firstRel == secondRel:
|
||||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
if other_person_gender == gen.lib.Person.MALE:
|
||||||
return (self.get_male_cousin(firstRel-1), common)
|
return (self.get_male_cousin(firstRel-1), common)
|
||||||
else:
|
else:
|
||||||
return (self.get_female_cousin(firstRel-1), common)
|
return (self.get_female_cousin(firstRel-1), common)
|
||||||
elif firstRel == secondRel+1:
|
elif firstRel == secondRel+1:
|
||||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
if other_person_gender == gen.lib.Person.MALE:
|
||||||
return (self.get_distant_nephew(secondRel), common)
|
return (self.get_distant_nephew(secondRel), common)
|
||||||
else:
|
else:
|
||||||
return (self.get_distant_niece(secondRel), common)
|
return (self.get_distant_niece(secondRel), common)
|
||||||
elif firstRel+1 == secondRel:
|
elif firstRel+1 == secondRel:
|
||||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
if other_person_gender == gen.lib.Person.MALE:
|
||||||
return (self.get_distant_uncle(firstRel), common)
|
return (self.get_distant_uncle(firstRel), common)
|
||||||
else:
|
else:
|
||||||
return (self.get_distant_aunt(firstRel), common)
|
return (self.get_distant_aunt(firstRel), common)
|
||||||
else:
|
else:
|
||||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
if other_person_gender == gen.lib.Person.MALE:
|
||||||
return (self.get_male_relative(firstRel, secondRel), common)
|
return (self.get_male_relative(firstRel, secondRel), common)
|
||||||
else:
|
else:
|
||||||
return (self.get_female_relative(firstRel, secondRel), common)
|
return (self.get_female_relative(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(Ga, Gb, 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_relationship(1, 1, gender_a, gender_b)[0];
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
# Test function. Call it as follows from the command line (so as to find
|
# Test function. Call it as follows from the command line (so as to find
|
||||||
|
Loading…
Reference in New Issue
Block a user