pylint
svn: r13998
This commit is contained in:
parent
d664fa4aa2
commit
2f7f7ac5f8
@ -25,7 +25,9 @@
|
||||
|
||||
# Written by Alex Roitman, largely based on Relationship.py by Don Allingham
|
||||
# and on valuable input from Eero Tamminen
|
||||
|
||||
"""
|
||||
Specific classes for relationships.
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -50,11 +52,14 @@ _parents_level = [ "", "vanhemmat", "isovanhemmat", "isoisovanhemmat",
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
RelationshipCalculator Class
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
Relationship.RelationshipCalculator.__init__(self)
|
||||
|
||||
def get_cousin(self,level):
|
||||
def get_cousin(self, level):
|
||||
if level == 0:
|
||||
return ""
|
||||
elif level == 1:
|
||||
@ -64,7 +69,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
elif level > 2:
|
||||
return "%d. serkku" % level
|
||||
|
||||
def get_cousin_genitive(self,level):
|
||||
def get_cousin_genitive(self, level):
|
||||
if level == 0:
|
||||
return ""
|
||||
elif level == 1:
|
||||
@ -74,13 +79,13 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
elif level > 2:
|
||||
return "%d. serkun" % level
|
||||
|
||||
def get_parents(self,level):
|
||||
if level>len(_parents_level)-1:
|
||||
def get_parents(self, level):
|
||||
if level > len(_parents_level)-1:
|
||||
return "kaukaiset esivanhemmat"
|
||||
else:
|
||||
return _parents_level[level]
|
||||
|
||||
def get_direct_ancestor(self,person,rel_string):
|
||||
def get_direct_ancestor(self, person, rel_string):
|
||||
result = []
|
||||
for ix in range(len(rel_string)-1):
|
||||
if rel_string[ix] == 'f':
|
||||
@ -93,9 +98,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('äiti')
|
||||
return ' '.join(result)
|
||||
|
||||
def get_direct_descendant(self,person,rel_string):
|
||||
def get_direct_descendant(self, person, rel_string):
|
||||
result = []
|
||||
for ix in range(len(rel_string)-2,-1,-1):
|
||||
for ix in range(len(rel_string)-2, -1, -1):
|
||||
if rel_string[ix] == 'f':
|
||||
result.append('pojan')
|
||||
elif rel_string[ix] == 'm':
|
||||
@ -110,7 +115,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('lapsi')
|
||||
return ' '.join(result)
|
||||
|
||||
def get_ancestors_cousin(self,rel_string_long,rel_string_short):
|
||||
def get_ancestors_cousin(self, rel_string_long, rel_string_short):
|
||||
result = []
|
||||
removed = len(rel_string_long)-len(rel_string_short)
|
||||
level = len(rel_string_short)-1
|
||||
@ -122,7 +127,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append(self.get_cousin(level))
|
||||
return ' '.join(result)
|
||||
|
||||
def get_cousins_descendant(self,person,rel_string_long,rel_string_short):
|
||||
def get_cousins_descendant(self, person, rel_string_long, rel_string_short):
|
||||
result = []
|
||||
removed = len(rel_string_long)-len(rel_string_short)-1
|
||||
level = len(rel_string_short)-1
|
||||
@ -132,7 +137,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('veljen')
|
||||
else:
|
||||
result.append('sisaren')
|
||||
for ix in range(removed-1,-1,-1):
|
||||
for ix in range(removed-1, -1, -1):
|
||||
if rel_string_long[ix] == 'f':
|
||||
result.append('pojan')
|
||||
elif rel_string_long[ix] == 'm':
|
||||
@ -147,7 +152,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('lapsi')
|
||||
return ' '.join(result)
|
||||
|
||||
def get_ancestors_brother(self,rel_string):
|
||||
def get_ancestors_brother(self, rel_string):
|
||||
result = []
|
||||
for ix in range(len(rel_string)-1):
|
||||
if rel_string[ix] == 'f':
|
||||
@ -157,7 +162,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('veli')
|
||||
return ' '.join(result)
|
||||
|
||||
def get_ancestors_sister(self,rel_string):
|
||||
def get_ancestors_sister(self, rel_string):
|
||||
result = []
|
||||
for ix in range(len(rel_string)-1):
|
||||
if rel_string[ix] == 'f':
|
||||
@ -174,26 +179,26 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
common = ""
|
||||
if not firstRel:
|
||||
if not secondRel:
|
||||
return ('',common)
|
||||
return ('', common)
|
||||
else:
|
||||
return (self.get_direct_ancestor(other_person,secondRel),common)
|
||||
return (self.get_direct_ancestor(other_person, secondRel), common)
|
||||
elif not secondRel:
|
||||
return (self.get_direct_descendant(other_person,firstRel),common)
|
||||
return (self.get_direct_descendant(other_person, firstRel), common)
|
||||
elif len(firstRel) == 1:
|
||||
if other_person == gen.lib.Person.MALE:
|
||||
return (self.get_ancestors_brother(secondRel),common)
|
||||
return (self.get_ancestors_brother(secondRel), common)
|
||||
else:
|
||||
return (self.get_ancestors_sister(secondRel),common)
|
||||
return (self.get_ancestors_sister(secondRel), common)
|
||||
elif len(secondRel) >= len(firstRel):
|
||||
return (self.get_ancestors_cousin(secondRel,firstRel),common)
|
||||
return (self.get_ancestors_cousin(secondRel, firstRel), common)
|
||||
else:
|
||||
return (self.get_cousins_descendant(other_person,firstRel,secondRel),common)
|
||||
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];
|
||||
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):
|
||||
|
@ -24,7 +24,9 @@
|
||||
|
||||
#
|
||||
# Written by Egyeki Gergely <egeri@elte.hu>, 2004
|
||||
#
|
||||
"""
|
||||
Specific classes for relationships.
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -40,7 +42,7 @@ import Relationship
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
_level =\
|
||||
_level = \
|
||||
["", "", "másod", "harmad", "negyed", "ötöd", "hatod",
|
||||
"heted", "nyolcad", "kilenced", "tized", "tizenegyed", "tizenketted",
|
||||
"tizenharmad", "tizennegyed", "tizenötöd", "tizenhatod",
|
||||
@ -53,12 +55,15 @@ _level =\
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
RelationshipCalculator Class
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
Relationship.RelationshipCalculator.__init__(self)
|
||||
|
||||
|
||||
def get_parents (self,level):
|
||||
def get_parents (self, level):
|
||||
if level == 0: return ""
|
||||
elif level == 1: return "szülei"
|
||||
elif level == 2: return "nagyszülei"
|
||||
@ -66,9 +71,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
elif level == 4: return "ükszülei"
|
||||
else : return "%s szülei" % _level[level]
|
||||
|
||||
|
||||
|
||||
def get_father (self,level):
|
||||
def get_father (self, level):
|
||||
if level == 0: return ""
|
||||
elif level == 1: return "apja"
|
||||
elif level == 2: return "nagyapja"
|
||||
@ -76,7 +79,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
elif level == 4: return "ükapja"
|
||||
else : return "%s ükapja" % (_level[level])
|
||||
|
||||
def get_mother (self,level):
|
||||
def get_mother (self, level):
|
||||
if level == 0: return ""
|
||||
elif level == 1: return "anyja"
|
||||
elif level == 2: return "nagyanyja"
|
||||
@ -84,9 +87,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
elif level == 4: return "ükanyja"
|
||||
else : return "%s ükanyja" % (_level[level])
|
||||
|
||||
|
||||
|
||||
def get_son (self,level):
|
||||
def get_son (self, level):
|
||||
if level == 0: return ""
|
||||
elif level == 1: return "fia"
|
||||
elif level == 2: return "unokája"
|
||||
@ -94,49 +95,37 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
elif level == 4: return "ükunokája"
|
||||
else : return "%s unokája" % (_level[level])
|
||||
|
||||
|
||||
def get_daughter (self,level):
|
||||
def get_daughter (self, level):
|
||||
if level == 0: return ""
|
||||
elif level == 1: return "lánya"
|
||||
else : return self.get_son(level)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def get_uncle (self,level):
|
||||
def get_uncle (self, level):
|
||||
if level == 0: return ""
|
||||
elif level == 1: return "testvére"
|
||||
elif level == 2: return "nagybátyja"
|
||||
else : return "%s nagybátyja" % (_level[level])
|
||||
|
||||
|
||||
def get_aunt (self,level):
|
||||
def get_aunt (self, level):
|
||||
if level == 0: return ""
|
||||
elif level == 1: return "testvére"
|
||||
elif level == 2: return "nagynénje"
|
||||
else : return "%s nagynénje" % (_level[level])
|
||||
|
||||
|
||||
|
||||
|
||||
def get_nephew (self,level):
|
||||
def get_nephew (self, level):
|
||||
if level == 0: return ""
|
||||
elif level == 1: return "unokája"
|
||||
else : return "%s unokája" % (_level[level])
|
||||
|
||||
def get_niece(self,level):
|
||||
def get_niece(self, level):
|
||||
return self.get_nephew(level)
|
||||
|
||||
|
||||
|
||||
|
||||
def get_male_cousin (self,level):
|
||||
def get_male_cousin (self, level):
|
||||
if level == 0: return ""
|
||||
elif level == 1: return "unokatestvére"
|
||||
else : return "%s unokatestvére" % (_level[level])
|
||||
|
||||
def get_female_cousin (self,level):
|
||||
def get_female_cousin (self, level):
|
||||
return self.get_male_cousin(level)
|
||||
|
||||
#----------------------------------------------
|
||||
@ -152,15 +141,15 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
other_birth_event = other_person.get_birth()
|
||||
other_birth_date = other_birth_event.get_date_object()
|
||||
if (orig_birth_date == "")or(other_birth_date == "") :return 0
|
||||
else :return orig_birth_date>other_birth_date
|
||||
else :return orig_birth_date > other_birth_date
|
||||
|
||||
|
||||
def get_age_brother (self,level):
|
||||
def get_age_brother (self, level):
|
||||
if level == 0 : return "testvére"
|
||||
elif level == 1 : return "öccse"
|
||||
else : return "bátyja"
|
||||
|
||||
def get_age_sister (self,level):
|
||||
def get_age_sister (self, level):
|
||||
if level == 0 : return "testvére"
|
||||
elif level == 1 : return "húga"
|
||||
else : return "nővére"
|
||||
@ -253,91 +242,91 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
def get_relationship(self,db, orig_person, other_person):
|
||||
def get_relationship(self, db, orig_person, other_person):
|
||||
"""
|
||||
returns a string representing the relationshp between the two people,
|
||||
along with a list of common ancestors (typically father,mother)
|
||||
"""
|
||||
|
||||
if orig_person is None:
|
||||
return ("undefined",[])
|
||||
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,[])
|
||||
return (is_spouse, [])
|
||||
|
||||
if self.is_fathermother_in_law(other_person, orig_person):
|
||||
if other_person.getGender() == gen.lib.Person.MALE:
|
||||
return ("apósa",self.get_fathermother_in_law_common(other_person, orig_person))
|
||||
return ("apósa", self.get_fathermother_in_law_common(other_person, orig_person))
|
||||
elif other_person.getGender() == gen.lib.Person.FEMALE:
|
||||
return ("anyósa",self.get_fathermother_in_law_common(other_person, orig_person))
|
||||
return ("anyósa", self.get_fathermother_in_law_common(other_person, orig_person))
|
||||
elif other_person.getGender() == 2 :
|
||||
return ("apósa vagy anyósa",self.get_fathermother_in_law_common(other_person, orig_person))
|
||||
return ("apósa vagy anyósa", self.get_fathermother_in_law_common(other_person, orig_person))
|
||||
|
||||
if self.is_fathermother_in_law(orig_person, other_person):
|
||||
if orig_person.getGender() == gen.lib.Person.MALE:
|
||||
return ("veje",self.get_fathermother_in_law_common(orig_person, other_person))
|
||||
return ("veje", self.get_fathermother_in_law_common(orig_person, other_person))
|
||||
elif orig_person.getGender() == gen.lib.Person.FEMALE:
|
||||
return ("menye",self.get_fathermother_in_law_common(orig_person, other_person))
|
||||
return ("menye", self.get_fathermother_in_law_common(orig_person, other_person))
|
||||
elif orig_person.getGender() == 2 :
|
||||
return ("veje vagy menye",self.get_fathermother_in_law_common(orig_person, other_person))
|
||||
return ("veje vagy menye", self.get_fathermother_in_law_common(orig_person, other_person))
|
||||
|
||||
if self.is_brothersister_in_law(orig_person, other_person):
|
||||
if other_person.getGender() == gen.lib.Person.MALE:
|
||||
return ("sógora",self.get_brothersister_in_law_common(orig_person, other_person))
|
||||
return ("sógora", self.get_brothersister_in_law_common(orig_person, other_person))
|
||||
elif other_person.getGender() == gen.lib.Person.FEMALE:
|
||||
return ("sógornője",self.get_brothersister_in_law_common(orig_person, other_person))
|
||||
return ("sógornője", self.get_brothersister_in_law_common(orig_person, other_person))
|
||||
elif other_person.getGender() == 2 :
|
||||
return ("sógora vagy sógornője",self.get_brothersister_in_law_common(orig_person, other_person))
|
||||
return ("sógora vagy sógornője", self.get_brothersister_in_law_common(orig_person, other_person))
|
||||
|
||||
|
||||
#get_relationship_distance changed, first data is relation to
|
||||
#orig person, apperently secondRel in this function
|
||||
(secondRel,firstRel,common) = \
|
||||
(secondRel, firstRel, common) = \
|
||||
self.get_relationship_distance(db, orig_person, other_person)
|
||||
|
||||
if isinstance(common, basestring):
|
||||
return (common,[])
|
||||
return (common, [])
|
||||
elif common:
|
||||
person_handle = common[0]
|
||||
else:
|
||||
return ("",[])
|
||||
return ("", [])
|
||||
|
||||
firstRel = len(firstRel)
|
||||
secondRel = len(secondRel)
|
||||
|
||||
if firstRel == 0:
|
||||
if secondRel == 0:
|
||||
return ('',common)
|
||||
return ('', common)
|
||||
elif other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_father(secondRel),common)
|
||||
return (self.get_father(secondRel), common)
|
||||
else:
|
||||
return (self.get_mother(secondRel),common)
|
||||
return (self.get_mother(secondRel), common)
|
||||
|
||||
elif secondRel == 0:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_son(firstRel),common)
|
||||
return (self.get_son(firstRel), common)
|
||||
else:
|
||||
return (self.get_daughter(firstRel),common)
|
||||
return (self.get_daughter(firstRel), common)
|
||||
|
||||
elif firstRel == 1:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
if secondRel == 1:
|
||||
return (self.get_age_brother(self.get_age_comp(orig_person, other_person)),common)
|
||||
else :return (self.get_uncle(secondRel),common)
|
||||
return (self.get_age_brother(self.get_age_comp(orig_person, other_person)), common)
|
||||
else :return (self.get_uncle(secondRel), common)
|
||||
else:
|
||||
if secondRel == 1:
|
||||
return (self.get_age_sister(self.get_age_comp(orig_person, other_person)),common)
|
||||
else :return (self.get_aunt(secondRel),common)
|
||||
return (self.get_age_sister(self.get_age_comp(orig_person, other_person)), common)
|
||||
else :return (self.get_aunt(secondRel), common)
|
||||
|
||||
elif secondRel == 1:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_nephew(firstRel-1),common)
|
||||
return (self.get_nephew(firstRel-1), common)
|
||||
else:
|
||||
return (self.get_niece(firstRel-1),common)
|
||||
return (self.get_niece(firstRel-1), common)
|
||||
|
||||
else:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
|
@ -28,7 +28,9 @@
|
||||
# Benny Malengier <benny.malengier@gramps-project.org, 2007
|
||||
# Maria-Cristina Ciocci <see above>, 2007
|
||||
#
|
||||
|
||||
"""
|
||||
Italian-Specific classes for relationships.
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -122,6 +124,9 @@ _niece_level = [ "", "la nipote%(step)s%(inlaw)s",
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
RelationshipCalculator Class
|
||||
"""
|
||||
|
||||
INLAW = ' acquisit%(gen)s'
|
||||
|
||||
@ -145,8 +150,8 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
return 'o'
|
||||
return 'a'
|
||||
|
||||
def get_parents (self,level):
|
||||
if level>len(_level)-1:
|
||||
def get_parents (self, level):
|
||||
if level > len(_level)-1:
|
||||
return "remote ancestors"
|
||||
else:
|
||||
return "%si genitori" % _level[level]
|
||||
@ -311,59 +316,59 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
def get_relationship(self,db, orig_person, other_person):
|
||||
def get_relationship(self, db, orig_person, other_person):
|
||||
"""
|
||||
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:
|
||||
return ("non definito",[])
|
||||
return ("non definito", [])
|
||||
|
||||
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,[])
|
||||
return (is_spouse, [])
|
||||
|
||||
#get_relationship_distance changed, first data is relation to
|
||||
#orig person, apperently secondRel in this function
|
||||
(secondRel,firstRel,common) = \
|
||||
(secondRel, firstRel, common) = \
|
||||
self.get_relationship_distance(db, orig_person, other_person)
|
||||
|
||||
if isinstance(common, basestring):
|
||||
return (common,[])
|
||||
return (common, [])
|
||||
elif common:
|
||||
person_handle = common[0]
|
||||
else:
|
||||
return ("",[])
|
||||
return ("", [])
|
||||
|
||||
firstRel = len(firstRel)
|
||||
secondRel = len(secondRel)
|
||||
|
||||
if firstRel == 0:
|
||||
if secondRel == 0:
|
||||
return ('',common)
|
||||
return ('', common)
|
||||
elif other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_father(secondRel),common)
|
||||
return (self.get_father(secondRel), common)
|
||||
else:
|
||||
return (self.get_mother(secondRel),common)
|
||||
return (self.get_mother(secondRel), common)
|
||||
elif secondRel == 0:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_son(firstRel),common)
|
||||
return (self.get_son(firstRel), common)
|
||||
else:
|
||||
return (self.get_daughter(firstRel),common)
|
||||
return (self.get_daughter(firstRel), common)
|
||||
elif firstRel == 1:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_uncle(secondRel),common)
|
||||
return (self.get_uncle(secondRel), common)
|
||||
else:
|
||||
return (self.get_aunt(secondRel),common)
|
||||
return (self.get_aunt(secondRel), common)
|
||||
elif secondRel == 1:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_nephew(firstRel-1),common)
|
||||
return (self.get_nephew(firstRel-1), common)
|
||||
else:
|
||||
return (self.get_niece(firstRel-1),common)
|
||||
return (self.get_niece(firstRel-1), common)
|
||||
else:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_male_cousin(firstRel-1, secondRel-1), common)
|
||||
@ -507,12 +512,12 @@ if __name__ == "__main__":
|
||||
# Test function. Call it as follows from the command line (so as to find
|
||||
# imported modules):
|
||||
# export PYTHONPATH=/path/to/gramps/src
|
||||
# python src/plugins/rel_it.py
|
||||
# python src/plugins/rel/rel_it.py
|
||||
|
||||
"""TRANSLATORS, copy this if statement at the bottom of your
|
||||
rel_xx.py module, and test your work with:
|
||||
python src/plugins/rel_xx.py
|
||||
python src/plugins/rel/rel_xx.py
|
||||
"""
|
||||
from Relationship import test
|
||||
rc = RelationshipCalculator()
|
||||
test(rc, True)
|
||||
RC = RelationshipCalculator()
|
||||
test(RC, True)
|
||||
|
@ -21,7 +21,9 @@
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Specific classes for relationships.
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -242,12 +244,15 @@ _uncle_level = [ "",
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
RelationshipCalculator Class
|
||||
"""
|
||||
|
||||
#sibling strings
|
||||
STEP= 'stief'
|
||||
STEP = 'stief'
|
||||
HALF = 'half'
|
||||
|
||||
INLAW='aangetrouwde '
|
||||
INLAW = 'aangetrouwde '
|
||||
|
||||
def __init__(self):
|
||||
Relationship.RelationshipCalculator.__init__(self)
|
||||
@ -275,7 +280,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
return "verre %s%sachterkleinzoon (%d generaties)" % (inlaw,
|
||||
step, level)
|
||||
|
||||
def _get_mother(self,level, step='', inlaw=''):
|
||||
def _get_mother(self, level, step='', inlaw=''):
|
||||
"""Internal Dutch method to create relation string
|
||||
"""
|
||||
if level > len(_mother_level)-1:
|
||||
@ -542,12 +547,12 @@ if __name__ == "__main__":
|
||||
# Test function. Call it as follows from the command line (so as to find
|
||||
# imported modules):
|
||||
# export PYTHONPATH=/path/to/gramps/src
|
||||
# python src/plugins/rel_nl.py
|
||||
# python src/plugins/rel/rel_nl.py
|
||||
|
||||
"""TRANSLATORS, copy this if statement at the bottom of your
|
||||
rel_xx.py module, and test your work with:
|
||||
python src/plugins/rel_xx.py
|
||||
python src/plugins/rel/rel_xx.py
|
||||
"""
|
||||
from Relationship import test
|
||||
rc = RelationshipCalculator()
|
||||
test(rc, True)
|
||||
RC = RelationshipCalculator()
|
||||
test(RC, True)
|
||||
|
@ -25,7 +25,9 @@
|
||||
|
||||
# Written by Alex Roitman, largely based on Relationship.py by Don Allingham
|
||||
# and on valuable input from Frode Jemtland
|
||||
|
||||
"""
|
||||
Norwegian-Specific classes for relationships.
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -35,10 +37,6 @@
|
||||
import gen.lib
|
||||
import Relationship
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Norwegian-specific definitions of relationships
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
_cousin_level = [ "", "", #brother/sister, fetter/kusine -- these are taken care of separately
|
||||
@ -49,25 +47,28 @@ _cousin_level = [ "", "", #brother/sister, fetter/kusine -- these are taken care
|
||||
"femtenmenning", "sekstenmenning", "syttenmenning",
|
||||
"attenmenning", "nittenmenning", "tyvemenning" ]
|
||||
|
||||
_cousin_terms = _cousin_level + ["fetter","kusine"]
|
||||
_cousin_terms = _cousin_level + ["fetter", "kusine"]
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
RelationshipCalculator Class
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
Relationship.RelationshipCalculator.__init__(self)
|
||||
|
||||
def get_parents(self,level):
|
||||
def get_parents(self, level):
|
||||
if level == 0:
|
||||
return "forelder"
|
||||
else:
|
||||
return "ane i %d-te generationen" % (level+1)
|
||||
|
||||
def get_cousin(self,level):
|
||||
if level>len(_cousin_level)-1:
|
||||
def get_cousin(self, level):
|
||||
if level > len(_cousin_level)-1:
|
||||
# FIXME: use Norwegian term term here,
|
||||
# UPDATED by Frode: unsure about the expretion "en fjern slektning", should it be just "fjern slektning".
|
||||
# Need to see it used in the program to get the understanding.
|
||||
@ -75,7 +76,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
else:
|
||||
return _cousin_level[level]
|
||||
|
||||
def pair_up(self,rel_list):
|
||||
def pair_up(self, rel_list):
|
||||
result = []
|
||||
item = ""
|
||||
for word in rel_list[:]:
|
||||
@ -99,7 +100,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
gen_result = [ item + 's' for item in result[0:-1] ]
|
||||
return ' '.join(gen_result+result[-1:])
|
||||
|
||||
def get_direct_ancestor(self,person,rel_string):
|
||||
def get_direct_ancestor(self, person, rel_string):
|
||||
result = []
|
||||
for ix in range(len(rel_string)):
|
||||
if rel_string[ix] == 'f':
|
||||
@ -108,9 +109,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('mor')
|
||||
return self.pair_up(result)
|
||||
|
||||
def get_direct_descendant(self,person,rel_string):
|
||||
def get_direct_descendant(self, person, rel_string):
|
||||
result = []
|
||||
for ix in range(len(rel_string)-2,-1,-1):
|
||||
for ix in range(len(rel_string)-2, -1, -1):
|
||||
if rel_string[ix] == 'f':
|
||||
result.append('sønne')
|
||||
else:
|
||||
@ -121,7 +122,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('datter')
|
||||
return self.pair_up(result)
|
||||
|
||||
def get_ancestors_cousin(self,person,rel_string_long,rel_string_short):
|
||||
def get_ancestors_cousin(self, person, rel_string_long, rel_string_short):
|
||||
result = []
|
||||
removed = len(rel_string_long)-len(rel_string_short)
|
||||
level = len(rel_string_short)-1
|
||||
@ -136,11 +137,11 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('fetter')
|
||||
else:
|
||||
result.append('kusine')
|
||||
main_string = self.get_two_way_rel(person,rel_string_short,rel_string_long)
|
||||
main_string = self.get_two_way_rel(person, rel_string_short, rel_string_long)
|
||||
aux_string = self.pair_up(result)
|
||||
return "%s (%s)" % (main_string,aux_string)
|
||||
return "%s (%s)" % (main_string, aux_string)
|
||||
|
||||
def get_cousins_descendant(self,person,rel_string_long,rel_string_short):
|
||||
def get_cousins_descendant(self, person, rel_string_long, rel_string_short):
|
||||
result = []
|
||||
aux_string = ""
|
||||
removed = len(rel_string_long)-len(rel_string_short)-1
|
||||
@ -156,7 +157,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('bror')
|
||||
else:
|
||||
result.append('søster')
|
||||
for ix in range(removed-1,-1,-1):
|
||||
for ix in range(removed-1, -1, -1):
|
||||
if rel_string_long[ix] == 'f':
|
||||
result.append('sønn')
|
||||
else:
|
||||
@ -165,12 +166,12 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('sønn')
|
||||
else:
|
||||
result.append('datter')
|
||||
main_string = self.get_two_way_rel(person,rel_string_long,rel_string_short)
|
||||
main_string = self.get_two_way_rel(person, rel_string_long, rel_string_short)
|
||||
if level:
|
||||
aux_string = " (%s)" % self.pair_up(result)
|
||||
return "%s%s" % (main_string,aux_string)
|
||||
return "%s%s" % (main_string, aux_string)
|
||||
|
||||
def get_ancestors_brother(self,rel_string):
|
||||
def get_ancestors_brother(self, rel_string):
|
||||
result = []
|
||||
for ix in range(len(rel_string)-1):
|
||||
if rel_string[ix] == 'f':
|
||||
@ -180,7 +181,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('bror')
|
||||
return self.pair_up(result)
|
||||
|
||||
def get_ancestors_sister(self,rel_string):
|
||||
def get_ancestors_sister(self, rel_string):
|
||||
result = []
|
||||
for ix in range(len(rel_string)-1):
|
||||
if rel_string[ix] == 'f':
|
||||
@ -190,7 +191,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('søster')
|
||||
return self.pair_up(result)
|
||||
|
||||
def get_two_way_rel(self,person,first_rel_string,second_rel_string):
|
||||
def get_two_way_rel(self, person, first_rel_string, second_rel_string):
|
||||
result = []
|
||||
for ix in range(len(second_rel_string)-1):
|
||||
if second_rel_string[ix] == 'f':
|
||||
@ -202,7 +203,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
result.append('bror')
|
||||
else:
|
||||
result.append('søster')
|
||||
for ix in range(len(first_rel_string)-3,-1,-1):
|
||||
for ix in range(len(first_rel_string)-3, -1, -1):
|
||||
if first_rel_string[ix] == 'f':
|
||||
result.append('sønne')
|
||||
else:
|
||||
@ -224,20 +225,20 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
common = ""
|
||||
if not firstRel:
|
||||
if not secondRel:
|
||||
return ('',common)
|
||||
return ('', common)
|
||||
else:
|
||||
return (self.get_direct_ancestor(other_person,secondRel),common)
|
||||
return (self.get_direct_ancestor(other_person, secondRel), common)
|
||||
elif not secondRel:
|
||||
return (self.get_direct_descendant(other_person,firstRel),common)
|
||||
return (self.get_direct_descendant(other_person, firstRel), common)
|
||||
elif len(firstRel) == 1:
|
||||
if other_person == gen.lib.Person.MALE:
|
||||
return (self.get_ancestors_brother(secondRel),common)
|
||||
return (self.get_ancestors_brother(secondRel), common)
|
||||
else:
|
||||
return (self.get_ancestors_sister(secondRel),common)
|
||||
return (self.get_ancestors_sister(secondRel), common)
|
||||
elif len(secondRel) >= len(firstRel):
|
||||
return (self.get_ancestors_cousin(other_person,secondRel,firstRel),common)
|
||||
return (self.get_ancestors_cousin(other_person, secondRel, firstRel), common)
|
||||
else:
|
||||
return (self.get_cousins_descendant(other_person,firstRel,secondRel),common)
|
||||
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,
|
||||
@ -247,7 +248,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
|
||||
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,"","")
|
||||
return self.get_two_way_rel(gender_b, "", "")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
@ -26,9 +26,9 @@
|
||||
# PL: Po objaśnienia oznaczania relacji zobacz Relationship.py
|
||||
# EN: For more information see Relationship.py
|
||||
#
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Polish-specific definitions of relationships.
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -39,10 +39,6 @@ import gen.lib
|
||||
import Relationship
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Polish-specific definitions of relationships
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
||||
# określa liczebnik porządkowy
|
||||
@ -254,17 +250,13 @@ _niece_level_of_sisters_daughter = [ "", "siostrzenica",
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
RelationshipCalculator Class
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self):
|
||||
Relationship.RelationshipCalculator.__init__(self)
|
||||
|
||||
|
||||
#--------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------
|
||||
def get_son(self, level, inlaw=''):
|
||||
"""
|
||||
Podaje tekst zawierający informację, jak bardzo potomek męski
|
||||
@ -273,9 +265,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
|
||||
# Określ, czy osoba jest przybraną, czy rodzoną
|
||||
if inlaw == '':
|
||||
t_inlaw =""
|
||||
t_inlaw = ""
|
||||
else:
|
||||
t_inlaw ="przybrany "
|
||||
t_inlaw = "przybrany "
|
||||
|
||||
# TODO: dodać rozpoznawanie pasierb/pasierbica
|
||||
if level >= 0 and level < len(_son_level):
|
||||
@ -301,11 +293,11 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
# Określ, czy osoba jest przybraną, czy rodzoną
|
||||
# + stwórz obie formy (męską i żeńską)
|
||||
if inlaw == '':
|
||||
t_inlaw =""
|
||||
t_inlawM =""
|
||||
t_inlaw = ""
|
||||
t_inlawM = ""
|
||||
else:
|
||||
t_inlaw ="przybrana "
|
||||
t_inlawM ="przybrany "
|
||||
t_inlaw = "przybrana "
|
||||
t_inlawM = "przybrany "
|
||||
|
||||
# TODO: dodać rozpoznawanie pasierb/pasierbica
|
||||
if level >= 0 and level < len(_daughter_level):
|
||||
@ -328,9 +320,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
|
||||
# Określ, czy osoba jest przybraną, czy rodzoną
|
||||
if inlaw == '':
|
||||
t_inlaw =""
|
||||
t_inlaw = ""
|
||||
else:
|
||||
t_inlaw ="przybrany "
|
||||
t_inlaw = "przybrany "
|
||||
|
||||
if level == 1:
|
||||
if inlaw == '' :
|
||||
@ -350,7 +342,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
PL: Generuje relację po mieczu/po kądzieli
|
||||
EN: Generate relation 'by sword' or 'by distaff', polish specific
|
||||
"""
|
||||
if level <=1:
|
||||
if level <= 1:
|
||||
return ""
|
||||
|
||||
elif level == 2:
|
||||
@ -422,9 +414,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
(np. ojciec) jest spokrewniony do danej osoby
|
||||
"""
|
||||
if inlaw == '':
|
||||
t_inlaw =""
|
||||
t_inlaw = ""
|
||||
else:
|
||||
t_inlaw ="przybrany "
|
||||
t_inlaw = "przybrany "
|
||||
|
||||
if level >= 0 and level < len(_father_level):
|
||||
# Jeśli znasz bezpośrednią nazwę relacji, to ją zastosuj
|
||||
@ -460,9 +452,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
|
||||
if inlaw == '':
|
||||
t_inlaw =""
|
||||
t_inlaw = ""
|
||||
else:
|
||||
t_inlaw ="przybrana "
|
||||
t_inlaw = "przybrana "
|
||||
|
||||
if level >= 0 and level < len(_mother_level):
|
||||
# Jeśli znasz bezpośrednią nazwę relacji, to ją zastosuj
|
||||
@ -498,9 +490,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
|
||||
if inlaw == '':
|
||||
t_inlaw =""
|
||||
t_inlaw = ""
|
||||
else:
|
||||
t_inlaw ="przybrany "
|
||||
t_inlaw = "przybrany "
|
||||
|
||||
if level == 1:
|
||||
return t_inlaw + "rodzic"
|
||||
@ -785,26 +777,26 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
|
||||
elif Ga > 1 and Gb > 1:
|
||||
if (gender_b == gen.lib.Person.MALE):
|
||||
if Ga==2 and Gb==2:
|
||||
if Ga == 2 and Gb == 2:
|
||||
rel_str = "kuzyn"
|
||||
else:
|
||||
rel_str = "daleki kuzyn (%d. stopień pokrewieństwa)" % (Ga+Gb)
|
||||
|
||||
elif (gender_b == gen.lib.Person.FEMALE):
|
||||
if Ga==2 and Gb==2:
|
||||
if Ga == 2 and Gb == 2:
|
||||
rel_str = "kuzynka"
|
||||
else:
|
||||
rel_str = "daleka kuzynka (%d. stopień pokrewieństwa)" % (Ga+Gb)
|
||||
|
||||
else:
|
||||
if Ga==2 and Gb==2:
|
||||
if Ga == 2 and Gb == 2:
|
||||
rel_str = "kuzyn(ka)"
|
||||
else:
|
||||
rel_str = "daleki członek rodziny (%d. stopień pokrewieństwa)" % (Ga+Gb)
|
||||
|
||||
else:
|
||||
# A program should never goes there, but...
|
||||
rel_str ="nieokreślony stopień pokrewieństwa"
|
||||
rel_str = "nieokreślony stopień pokrewieństwa"
|
||||
|
||||
return rel_str
|
||||
|
||||
@ -883,12 +875,12 @@ if __name__ == "__main__":
|
||||
# Test function. Call it as follows from the command line (so as to find
|
||||
# imported modules):
|
||||
# export PYTHONPATH=/path/to/gramps/src
|
||||
# python src/plugins/rel_pl.py
|
||||
# python src/plugins/rel/rel_pl.py
|
||||
|
||||
"""TRANSLATORS, copy this if statement at the bottom of your
|
||||
rel_xx.py module, and test your work with:
|
||||
python src/plugins/rel_xx.py
|
||||
python src/plugins/rel/rel_xx.py
|
||||
"""
|
||||
from Relationship import test
|
||||
rc = RelationshipCalculator()
|
||||
test(rc, True)
|
||||
RC = RelationshipCalculator()
|
||||
test(RC, True)
|
||||
|
@ -24,7 +24,9 @@
|
||||
# Based on the Spanish version by Julio Sanchez <julio.sanchez@gmail.com>
|
||||
|
||||
# $Id:rel_pt.py 9912 2008-01-22 09:17:46Z acraphae $
|
||||
|
||||
"""
|
||||
Specific classes for relationships.
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -110,133 +112,136 @@ _niece_level = [ "", "sobrinha", "sobrinha neta", "sobrinha bisneta", ]
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
RelationshipCalculator Class
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
Relationship.RelationshipCalculator.__init__(self)
|
||||
|
||||
def get_male_cousin(self,level):
|
||||
if level<len(_level_name_male):
|
||||
def get_male_cousin(self, level):
|
||||
if level < len(_level_name_male):
|
||||
return "%s primo" % (_level_name_male[level])
|
||||
else:
|
||||
return "%dº primo" % level
|
||||
|
||||
def get_female_cousin(self,level):
|
||||
if level<len(_level_name_female):
|
||||
def get_female_cousin(self, level):
|
||||
if level < len(_level_name_female):
|
||||
return "%s prima" % (_level_name_female[level])
|
||||
else:
|
||||
return "%dª prima" % level
|
||||
|
||||
def get_distant_uncle(self,level):
|
||||
if level<len(_level_name_male):
|
||||
def get_distant_uncle(self, level):
|
||||
if level < len(_level_name_male):
|
||||
return "%s tio" % (_level_name_male[level])
|
||||
else:
|
||||
return "%dº tio" % level
|
||||
|
||||
def get_distant_aunt(self,level):
|
||||
if level<len(_level_name_female):
|
||||
def get_distant_aunt(self, level):
|
||||
if level < len(_level_name_female):
|
||||
return "%s tia" % (_level_name_female[level])
|
||||
else:
|
||||
return "%dª tia" % level
|
||||
|
||||
def get_distant_nephew(self,level):
|
||||
if level<len(_level_name_male):
|
||||
def get_distant_nephew(self, level):
|
||||
if level < len(_level_name_male):
|
||||
return "%s sobrinho" % (_level_name_male[level])
|
||||
else:
|
||||
return "%dº sobrinho" % level
|
||||
|
||||
def get_distant_nieve(self,level):
|
||||
if level<len(_level_name_female):
|
||||
def get_distant_nieve(self, level):
|
||||
if level < len(_level_name_female):
|
||||
return "%s sobrinha" % (_level_name_female[level])
|
||||
else:
|
||||
return "%dª sobrinha" % level
|
||||
|
||||
def get_male_relative(self,level1,level2):
|
||||
if level1<len(_level_name_male_a):
|
||||
def get_male_relative(self, level1, level2):
|
||||
if level1 < len(_level_name_male_a):
|
||||
level1_str = _level_name_male_a[level1]
|
||||
else:
|
||||
level1_str = "%dº" % level1
|
||||
if level2<len(_level_name_male_a):
|
||||
if level2 < len(_level_name_male_a):
|
||||
level2_str = _level_name_male_a[level2]
|
||||
else:
|
||||
level2_str = "%dº" % level2
|
||||
level = level1 + level2
|
||||
if level<len(_level_name_male_a):
|
||||
if level < len(_level_name_male_a):
|
||||
level_str = _level_name_male_a[level]
|
||||
else:
|
||||
level_str = "%dº" % level
|
||||
return "parente em %s grau (%s com %s)" % (level_str,level1_str,level2_str)
|
||||
return "parente em %s grau (%s com %s)" % (level_str, level1_str, level2_str)
|
||||
|
||||
def get_female_relative(self,level1,level2):
|
||||
return self.get_male_relative(level1,level2)
|
||||
def get_female_relative(self, level1, level2):
|
||||
return self.get_male_relative(level1, level2)
|
||||
|
||||
def get_parents(self,level):
|
||||
if level<len(_parents_level):
|
||||
def get_parents(self, level):
|
||||
if level < len(_parents_level):
|
||||
return _parents_level[level]
|
||||
elif (level-1)<len(_level_name_plural):
|
||||
elif (level-1) < len(_level_name_plural):
|
||||
return "%s avós" % (_level_name_plural[level-1])
|
||||
else:
|
||||
return "%dº avós" % (level-1)
|
||||
|
||||
def get_father(self,level):
|
||||
if level<len(_father_level):
|
||||
def get_father(self, level):
|
||||
if level < len(_father_level):
|
||||
return _father_level[level]
|
||||
elif (level-1)<len(_level_name_male_a):
|
||||
elif (level-1) < len(_level_name_male_a):
|
||||
return "%s avô" % (_level_name_male_a[level-1])
|
||||
else:
|
||||
return "%dº avô" % (level-1)
|
||||
|
||||
def get_son(self,level):
|
||||
if level<len(_son_level):
|
||||
def get_son(self, level):
|
||||
if level < len(_son_level):
|
||||
return _son_level[level]
|
||||
elif (level-1)<len(_level_name_male_a):
|
||||
elif (level-1) < len(_level_name_male_a):
|
||||
return "%s neto" % (_level_name_male_a[level-1])
|
||||
else:
|
||||
return "%dº neto" % (level-1)
|
||||
|
||||
def get_mother(self,level):
|
||||
if level<len(_mother_level):
|
||||
def get_mother(self, level):
|
||||
if level < len(_mother_level):
|
||||
return _mother_level[level]
|
||||
elif (level-1)<len(_level_name_female):
|
||||
return "%s avó" % (_level_name_female[level-1])
|
||||
else:
|
||||
return "%dª avó" % (level-1)
|
||||
|
||||
def get_daughter(self,level):
|
||||
if level<len(_daughter_level):
|
||||
def get_daughter(self, level):
|
||||
if level < len(_daughter_level):
|
||||
return _daughter_level[level]
|
||||
elif (level-1)<len(_level_name_female):
|
||||
elif (level-1) < len(_level_name_female):
|
||||
return "%s neta" % (_level_name_female[level-1])
|
||||
else:
|
||||
return "%dª neta" % (level-1)
|
||||
|
||||
def get_aunt(self,level):
|
||||
if level<len(_sister_level):
|
||||
def get_aunt(self, level):
|
||||
if level < len(_sister_level):
|
||||
return _sister_level[level]
|
||||
elif (level-2)<len(_level_name_female):
|
||||
elif (level-2) < len(_level_name_female):
|
||||
return "%s tia avó" % (_level_name_female[level-2])
|
||||
else:
|
||||
return "%dª tia avó" % (level-2)
|
||||
|
||||
def get_uncle(self,level):
|
||||
if level<len(_brother_level):
|
||||
def get_uncle(self, level):
|
||||
if level < len(_brother_level):
|
||||
return _brother_level[level]
|
||||
elif (level-2)<len(_level_name_male_a):
|
||||
elif (level-2) < len(_level_name_male_a):
|
||||
return "%s tio avô" % (_level_name_male_a[level-2])
|
||||
else:
|
||||
return "%dº tio avô" % (level-2)
|
||||
|
||||
def get_nephew(self,level):
|
||||
if level<len(_nephew_level):
|
||||
def get_nephew(self, level):
|
||||
if level < len(_nephew_level):
|
||||
return _nephew_level[level]
|
||||
elif (level-1)<len(_level_name_male_a):
|
||||
elif (level-1) < len(_level_name_male_a):
|
||||
return "%s sobrinho neto" % (_level_name_male_a[level-1])
|
||||
else:
|
||||
return "%dº sobrinho neto" % (level-1)
|
||||
|
||||
def get_niece(self,level):
|
||||
if level<len(_niece_level):
|
||||
def get_niece(self, level):
|
||||
if level < len(_niece_level):
|
||||
return _niece_level[level]
|
||||
elif (level-1)<len(_level_name_female):
|
||||
elif (level-1) < len(_level_name_female):
|
||||
return "%s sobrinha neta" % (_level_name_female[level-1])
|
||||
else:
|
||||
return "%dª sobrinha neta" % (level-1)
|
||||
@ -244,80 +249,80 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
def get_relationship(self, orig_person, other_person):
|
||||
"""
|
||||
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:
|
||||
return ("indefinido",[])
|
||||
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,[])
|
||||
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)
|
||||
(secondRel, firstRel, common) = self.get_relationship_distance(orig_person, other_person)
|
||||
|
||||
if isinstance(common, basestring):
|
||||
return (common,[])
|
||||
return (common, [])
|
||||
elif common:
|
||||
person_handle = common[0]
|
||||
else:
|
||||
return ("",[])
|
||||
return ("", [])
|
||||
|
||||
firstRel = len(firstRel)
|
||||
secondRel = len(secondRel)
|
||||
|
||||
if firstRel == 0:
|
||||
if secondRel == 0:
|
||||
return ('',common)
|
||||
return ('', common)
|
||||
elif other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_father(secondRel),common)
|
||||
return (self.get_father(secondRel), common)
|
||||
else:
|
||||
return (self.get_mother(secondRel),common)
|
||||
return (self.get_mother(secondRel), common)
|
||||
elif secondRel == 0:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_son(firstRel),common)
|
||||
return (self.get_son(firstRel), common)
|
||||
else:
|
||||
return (self.get_daughter(firstRel),common)
|
||||
return (self.get_daughter(firstRel), common)
|
||||
elif firstRel == 1:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_uncle(secondRel),common)
|
||||
return (self.get_uncle(secondRel), common)
|
||||
else:
|
||||
return (self.get_aunt(secondRel),common)
|
||||
return (self.get_aunt(secondRel), common)
|
||||
elif secondRel == 1:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_nephew(firstRel-1),common)
|
||||
return (self.get_nephew(firstRel-1), common)
|
||||
else:
|
||||
return (self.get_niece(firstRel-1),common)
|
||||
return (self.get_niece(firstRel-1), common)
|
||||
elif firstRel == secondRel == 2:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return ('primo irmão',common)
|
||||
return ('primo irmão', common)
|
||||
else:
|
||||
return ('prima irmã',common)
|
||||
return ('prima irmã', common)
|
||||
elif firstRel == secondRel:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_male_cousin(firstRel-1),common)
|
||||
return (self.get_male_cousin(firstRel-1), common)
|
||||
else:
|
||||
return (self.get_female_cousin(firstRel-1),common)
|
||||
return (self.get_female_cousin(firstRel-1), common)
|
||||
elif firstRel == secondRel+1:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_distant_nephew(secondRel),common)
|
||||
return (self.get_distant_nephew(secondRel), common)
|
||||
else:
|
||||
return (self.get_distant_niece(secondRel),common)
|
||||
return (self.get_distant_niece(secondRel), common)
|
||||
elif firstRel+1 == secondRel:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_distant_uncle(firstRel),common)
|
||||
return (self.get_distant_uncle(firstRel), common)
|
||||
else:
|
||||
return (self.get_distant_aunt(firstRel),common)
|
||||
return (self.get_distant_aunt(firstRel), common)
|
||||
else:
|
||||
if other_person.get_gender() == gen.lib.Person.MALE:
|
||||
return (self.get_male_relative(firstRel,secondRel),common)
|
||||
return (self.get_male_relative(firstRel, secondRel), common)
|
||||
else:
|
||||
return (self.get_female_relative(firstRel,secondRel),common)
|
||||
return (self.get_female_relative(firstRel, secondRel), common)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
@ -24,7 +24,9 @@
|
||||
# $Id:rel_ru.py 9912 2008-01-22 09:17:46Z acraphae $
|
||||
|
||||
# Written by Alex Roitman, largely based on Relationship.py by Don Allingham.
|
||||
|
||||
"""
|
||||
Russian-specific definitions of relationships
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -34,107 +36,263 @@
|
||||
import gen.lib
|
||||
import Relationship
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Russian-specific definitions of relationships
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
_parents_level = [ u"", u"родители",
|
||||
u"дедушки/бабушки", u"прадедушки/прабабушки", u"прапрадедушки/прапрабабушки (5 поколение)",
|
||||
u"прапрапрадедушки/прапрапрабабушки (6 поколение)", u"прапрапрапрадедушки/прапрапрапрабабушки (7 поколение)",
|
||||
_parents_level = [
|
||||
u"",
|
||||
u"родители",
|
||||
u"дедушки/бабушки",
|
||||
u"прадедушки/прабабушки",
|
||||
u"прапрадедушки/прапрабабушки (5 поколение)",
|
||||
u"прапрапрадедушки/прапрапрабабушки (6 поколение)",
|
||||
u"прапрапрапрадедушки/прапрапрапрабабушки (7 поколение)",
|
||||
u"прапрапрапрапрадедушки/прапрапрапрапрабабушки (8 поколение)",
|
||||
]
|
||||
]
|
||||
|
||||
_male_cousin_level = [
|
||||
u"", u"двоюродный", u"троюродный", u"четвероюродный",
|
||||
u"пятиюродный", u"шестиюродный", u"семиюродный", u"восьмиюродный",
|
||||
u"девятиюродный", u"десятиюродный", u"одиннацатиюродный", u"двенадцатиюродный",
|
||||
u"тринадцатиюродный", u"четырнадцатиюродный", u"пятнадцатиюродный", u"шестнадцатиюродный",
|
||||
u"семнадцатиюродный", u"восемнадцатиюродный", u"девятнадцатиюродный", u"двадцатиюродный" ]
|
||||
u"",
|
||||
u"двоюродный",
|
||||
u"троюродный",
|
||||
u"четвероюродный",
|
||||
u"пятиюродный",
|
||||
u"шестиюродный",
|
||||
u"семиюродный",
|
||||
u"восьмиюродный",
|
||||
u"девятиюродный",
|
||||
u"десятиюродный",
|
||||
u"одиннацатиюродный",
|
||||
u"двенадцатиюродный",
|
||||
u"тринадцатиюродный",
|
||||
u"четырнадцатиюродный",
|
||||
u"пятнадцатиюродный",
|
||||
u"шестнадцатиюродный",
|
||||
u"семнадцатиюродный",
|
||||
u"восемнадцатиюродный",
|
||||
u"девятнадцатиюродный",
|
||||
u"двадцатиюродный",
|
||||
]
|
||||
|
||||
_female_cousin_level = [
|
||||
u"", u"двоюродная", u"троюродная", u"четвероюродная",
|
||||
u"пятиюродная", u"шестиюродная", u"семиюродная", u"восьмиюродная",
|
||||
u"девятиюродная", u"десятиюродная", u"одиннацатиюродная", u"двенадцатиюродная",
|
||||
u"тринадцатиюродная", u"четырнадцатиюродная", u"пятнадцатиюродная", u"шестнадцатиюродная",
|
||||
u"семнадцатиюродная", u"восемнадцатиюродная", u"девятнадцатиюродная", u"двадцатиюродная" ]
|
||||
u"",
|
||||
u"двоюродная",
|
||||
u"троюродная",
|
||||
u"четвероюродная",
|
||||
u"пятиюродная",
|
||||
u"шестиюродная",
|
||||
u"семиюродная",
|
||||
u"восьмиюродная",
|
||||
u"девятиюродная",
|
||||
u"десятиюродная",
|
||||
u"одиннацатиюродная",
|
||||
u"двенадцатиюродная",
|
||||
u"тринадцатиюродная",
|
||||
u"четырнадцатиюродная",
|
||||
u"пятнадцатиюродная",
|
||||
u"шестнадцатиюродная",
|
||||
u"семнадцатиюродная",
|
||||
u"восемнадцатиюродная",
|
||||
u"девятнадцатиюродная",
|
||||
u"двадцатиюродная",
|
||||
]
|
||||
|
||||
_cousin_level = [
|
||||
u"", u"двоюродные", u"троюродные", u"четвероюродные",
|
||||
u"пятиюродные", u"шестиюродные", u"семиюродные", u"восьмиюродные",
|
||||
u"девятиюродные", u"десятиюродные", u"одиннацатиюродные", u"двенадцатиюродные",
|
||||
u"тринадцатиюродные", u"четырнадцатиюродные", u"пятнадцатиюродные", u"шестнадцатиюродные",
|
||||
u"семнадцатиюродные", u"восемнадцатиюродные", u"девятнадцатиюродные", u"двадцатиюродные" ]
|
||||
u"",
|
||||
u"двоюродные",
|
||||
u"троюродные",
|
||||
u"четвероюродные",
|
||||
u"пятиюродные",
|
||||
u"шестиюродные",
|
||||
u"семиюродные",
|
||||
u"восьмиюродные",
|
||||
u"девятиюродные",
|
||||
u"десятиюродные",
|
||||
u"одиннацатиюродные",
|
||||
u"двенадцатиюродные",
|
||||
u"тринадцатиюродные",
|
||||
u"четырнадцатиюродные",
|
||||
u"пятнадцатиюродные",
|
||||
u"шестнадцатиюродные",
|
||||
u"семнадцатиюродные",
|
||||
u"восемнадцатиюродные",
|
||||
u"девятнадцатиюродные",
|
||||
u"двадцатиюродные",
|
||||
]
|
||||
|
||||
_junior_male_removed_level = [
|
||||
u"брат", u"племянник", u"внучатый племянник", u"правнучатый племянник",
|
||||
u"праправнучатый племянник", u"прапраправнучатый племянник",
|
||||
u"прапрапраправнучатый племянник" ]
|
||||
u"брат",
|
||||
u"племянник",
|
||||
u"внучатый племянник",
|
||||
u"правнучатый племянник",
|
||||
u"праправнучатый племянник",
|
||||
u"прапраправнучатый племянник",
|
||||
u"прапрапраправнучатый племянник",
|
||||
]
|
||||
|
||||
_junior_female_removed_level = [
|
||||
u"сестра", u"племянница", u"внучатая племянница", u"правнучатая племянница",
|
||||
u"праправнучатая племянница", u"прапраправнучатая племянница",
|
||||
u"прапрапраправнучатая племянница" ]
|
||||
u"сестра",
|
||||
u"племянница",
|
||||
u"внучатая племянница",
|
||||
u"правнучатая племянница",
|
||||
u"праправнучатая племянница",
|
||||
u"прапраправнучатая племянница",
|
||||
u"прапрапраправнучатая племянница",
|
||||
]
|
||||
|
||||
_juniors_removed_level = [
|
||||
u"братя/сестры", u"племянники", u"внучатые племянники", u"правнучатые племянники",
|
||||
u"праправнучатые племянники", u"прапраправнучатые племянники",
|
||||
u"прапрапраправнучатые племянники" ]
|
||||
u"братя/сестры",
|
||||
u"племянники",
|
||||
u"внучатые племянники",
|
||||
u"правнучатые племянники",
|
||||
u"праправнучатые племянники",
|
||||
u"прапраправнучатые племянники",
|
||||
u"прапрапраправнучатые племянники",
|
||||
]
|
||||
|
||||
_senior_male_removed_level = [
|
||||
u"", u"дядя", u"дед", u"прадед", u"прапрадед", u"прапрапрадед", u"прапрапрапрадед" ]
|
||||
u"",
|
||||
u"дядя",
|
||||
u"дед",
|
||||
u"прадед",
|
||||
u"прапрадед",
|
||||
u"прапрапрадед",
|
||||
u"прапрапрапрадед",
|
||||
]
|
||||
|
||||
_senior_female_removed_level = [
|
||||
u"", u"тётка", u"бабка", u"прабабка", u"прапрабабка", u"прапрапрабабка", u"прапрапрапрабабка" ]
|
||||
u"",
|
||||
u"тётка",
|
||||
u"бабка",
|
||||
u"прабабка",
|
||||
u"прапрабабка",
|
||||
u"прапрапрабабка",
|
||||
u"прапрапрапрабабка",
|
||||
]
|
||||
|
||||
_seniors_removed_level = [
|
||||
u"", u"дядьки/тётки", u"дедушки/бабушки", u"прадеды/прабабушки", u"прапрадеды/прапрабабушки", u"прапрапрадеды/прапрапрабабушки", u"прапрапрапрадеды/прапрапрабабушки" ]
|
||||
u"",
|
||||
u"дядьки/тётки",
|
||||
u"дедушки/бабушки",
|
||||
u"прадеды/прабабушки",
|
||||
u"прапрадеды/прапрабабушки",
|
||||
u"прапрапрадеды/прапрапрабабушки",
|
||||
u"прапрапрапрадеды/прапрапрабабушки",
|
||||
]
|
||||
|
||||
_father_level = [
|
||||
u"", u"отец", u"дед", u"прадед", u"прапрадед", u"прапрапрадед", u"прапрапрапрадед" ]
|
||||
u"",
|
||||
u"отец",
|
||||
u"дед",
|
||||
u"прадед",
|
||||
u"прапрадед",
|
||||
u"прапрапрадед",
|
||||
u"прапрапрапрадед",
|
||||
]
|
||||
|
||||
_mother_level = [
|
||||
u"", u"мать", u"бабка", u"прабабка", u"прапрабабка", u"прапрапрабабка", u"прапрапрапрабабка" ]
|
||||
u"",
|
||||
u"мать",
|
||||
u"бабка",
|
||||
u"прабабка",
|
||||
u"прапрабабка",
|
||||
u"прапрапрабабка",
|
||||
u"прапрапрапрабабка",
|
||||
]
|
||||
|
||||
_son_level = [
|
||||
u"", u"сын", u"внук", u"правнук", u"праправнук", u"прапраправнук", u"прапрапраправнук" ]
|
||||
u"",
|
||||
u"сын",
|
||||
u"внук",
|
||||
u"правнук",
|
||||
u"праправнук",
|
||||
u"прапраправнук",
|
||||
u"прапрапраправнук",
|
||||
]
|
||||
|
||||
_daughter_level = [
|
||||
u"", u"дочь", u"внучка", u"правнучка", u"праправнучка", u"прапраправнучка",
|
||||
u"прапрапраправнучка" ]
|
||||
u"",
|
||||
u"дочь",
|
||||
u"внучка",
|
||||
u"правнучка",
|
||||
u"праправнучка",
|
||||
u"прапраправнучка",
|
||||
u"прапрапраправнучка",
|
||||
]
|
||||
|
||||
_children_level = [ u"", u"дети", u"внуки", u"правнуки", u"праправнуки", u"прапраправнуки", u"прапрапраправнуки",
|
||||
u"прапрапрапраправнуки"]
|
||||
_children_level = [
|
||||
u"",
|
||||
u"дети",
|
||||
u"внуки",
|
||||
u"правнуки",
|
||||
u"праправнуки",
|
||||
u"прапраправнуки",
|
||||
u"прапрапраправнуки",
|
||||
u"прапрапрапраправнуки",
|
||||
]
|
||||
|
||||
_sister_level = [
|
||||
u"", u"сестра", u"тётка", u"двоюродная бабка", u"двоюродная прабабка",
|
||||
u"двоюродная прапрабабка", u"двоюродная прапрапрабабка", u"двоюродная прапрапрапрабабка" ]
|
||||
u"",
|
||||
u"сестра",
|
||||
u"тётка",
|
||||
u"двоюродная бабка",
|
||||
u"двоюродная прабабка",
|
||||
u"двоюродная прапрабабка",
|
||||
u"двоюродная прапрапрабабка",
|
||||
u"двоюродная прапрапрапрабабка",
|
||||
]
|
||||
|
||||
_brother_level = [
|
||||
u"", u"брат", u"дядя", u"двоюродный дед", u"двоюродный прадед",
|
||||
u"двоюродный прапрадед", u"двоюродный прапрапрадед", u"двоюродный прапрапрапрадед" ]
|
||||
u"",
|
||||
u"брат",
|
||||
u"дядя",
|
||||
u"двоюродный дед",
|
||||
u"двоюродный прадед",
|
||||
u"двоюродный прапрадед",
|
||||
u"двоюродный прапрапрадед",
|
||||
u"двоюродный прапрапрапрадед",
|
||||
]
|
||||
|
||||
_siblings_level = [
|
||||
u"", u"братья/сестры", u"дядьки/тётки", u"двоюродные дедушки/бабушки", u"двоюродные прадедеды/прабабушки",
|
||||
u"двоюродные прапрадедушки/прапрабабушки (5 поколение)", u"двоюродные прапрапрадедушки/прапрапрабабушки (6 поколение)",
|
||||
u"",
|
||||
u"братья/сестры",
|
||||
u"дядьки/тётки",
|
||||
u"двоюродные дедушки/бабушки",
|
||||
u"двоюродные прадедеды/прабабушки",
|
||||
u"двоюродные прапрадедушки/прапрабабушки (5 поколение)",
|
||||
u"двоюродные прапрапрадедушки/прапрапрабабушки (6 поколение)",
|
||||
u"двоюродные прапрапрапрадедушки/прапрапрапрабабушки (7 поколение)",
|
||||
u"двоюродные прапрапрапрапрадедушки/прапрапрапрапрабабушки (8 поколение)", ]
|
||||
u"двоюродные прапрапрапрапрадедушки/прапрапрапрапрабабушки (8 поколение)",
|
||||
]
|
||||
|
||||
_nephew_level = [
|
||||
u"", u"племянник", u"внучатый племянник", u"правнучатый племянник",
|
||||
u"праправнучатый племянник", u"прапраправнучатый племянник",
|
||||
u"прапрапраправнучатый племянник" ]
|
||||
u"",
|
||||
u"племянник",
|
||||
u"внучатый племянник",
|
||||
u"правнучатый племянник",
|
||||
u"праправнучатый племянник",
|
||||
u"прапраправнучатый племянник",
|
||||
u"прапрапраправнучатый племянник",
|
||||
]
|
||||
|
||||
_niece_level = [
|
||||
u"", u"племянница", u"внучатая племянница", u"правнучатая племянница",
|
||||
u"праправнучатая племянница", u"прапраправнучатая племянница",
|
||||
u"прапрапраправнучатая племянница" ]
|
||||
u"",
|
||||
u"племянница",
|
||||
u"внучатая племянница",
|
||||
u"правнучатая племянница",
|
||||
u"праправнучатая племянница",
|
||||
u"прапраправнучатая племянница",
|
||||
u"прапрапраправнучатая племянница",
|
||||
]
|
||||
|
||||
_nephews_nieces_level = [
|
||||
u"", u"братья/сестры", u"племянники", u"внучатый племянники", u"правнучатый племянники",
|
||||
u"праправнучатый племянники", u"прапраправнучатый племянники",
|
||||
u"прапрапраправнучатый племянники" ]
|
||||
u"",
|
||||
u"братья/сестры",
|
||||
u"племянники",
|
||||
u"внучатый племянники",
|
||||
u"правнучатый племянники",
|
||||
u"праправнучатый племянники",
|
||||
u"прапраправнучатый племянники",
|
||||
u"прапрапраправнучатый племянники",
|
||||
]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -142,89 +300,97 @@ _nephews_nieces_level = [
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
RelationshipCalculator Class
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
Relationship.RelationshipCalculator.__init__(self)
|
||||
|
||||
def get_parents(self,level):
|
||||
if level>len(_parents_level)-1:
|
||||
def get_parents(self, level):
|
||||
if level > len(_parents_level)-1:
|
||||
return u"дальние родственники"
|
||||
else:
|
||||
return _parents_level[level]
|
||||
|
||||
def get_junior_male_cousin(self,level,removed):
|
||||
if removed > len(_junior_male_removed_level)-1 or level>len(_male_cousin_level)-1:
|
||||
def get_junior_male_cousin(self, level, removed):
|
||||
if removed > len(_junior_male_removed_level)-1 or \
|
||||
level > len(_male_cousin_level)-1:
|
||||
return u"дальний родственник"
|
||||
else:
|
||||
return u"%s %s" % (_male_cousin_level[level],_junior_male_removed_level[removed])
|
||||
return u"%s %s" % (_male_cousin_level[level], _junior_male_removed_level[removed])
|
||||
|
||||
def get_senior_male_cousin(self,level,removed):
|
||||
if removed > len(_senior_male_removed_level)-1 or level>len(_male_cousin_level)-1:
|
||||
def get_senior_male_cousin(self, level, removed):
|
||||
if removed > len(_senior_male_removed_level)-1 or \
|
||||
level > len(_male_cousin_level)-1:
|
||||
return u"дальний родственник"
|
||||
else:
|
||||
return u"%s %s" % (_male_cousin_level[level],_senior_male_removed_level[removed])
|
||||
return u"%s %s" % (_male_cousin_level[level], _senior_male_removed_level[removed])
|
||||
|
||||
def get_junior_female_cousin(self,level,removed):
|
||||
if removed > len(_junior_female_removed_level)-1 or level>len(_male_cousin_level)-1:
|
||||
def get_junior_female_cousin(self, level, removed):
|
||||
if removed > len(_junior_female_removed_level)-1 or \
|
||||
level > len(_male_cousin_level)-1:
|
||||
return u"дальняя родственница"
|
||||
else:
|
||||
return u"%s %s" % (_female_cousin_level[level],_junior_female_removed_level[removed])
|
||||
return u"%s %s" % (_female_cousin_level[level], _junior_female_removed_level[removed])
|
||||
|
||||
def get_senior_female_cousin(self,level,removed):
|
||||
if removed > len(_senior_female_removed_level)-1 or level>len(_male_cousin_level)-1:
|
||||
def get_senior_female_cousin(self, level, removed):
|
||||
if removed > len(_senior_female_removed_level)-1 or \
|
||||
level > len(_male_cousin_level)-1:
|
||||
return u"дальняя родственница"
|
||||
else:
|
||||
return u"%s %s" % (_female_cousin_level[level],_senior_female_removed_level[removed])
|
||||
return u"%s %s" % (_female_cousin_level[level], _senior_female_removed_level[removed])
|
||||
|
||||
def get_father(self,level):
|
||||
if level>len(_father_level)-1:
|
||||
def get_father(self, level):
|
||||
if level > len(_father_level)-1:
|
||||
return u"дальний предок"
|
||||
else:
|
||||
return _father_level[level]
|
||||
|
||||
def get_son(self,level):
|
||||
if level>len(_son_level)-1:
|
||||
def get_son(self, level):
|
||||
if level > len(_son_level)-1:
|
||||
return u"дальний потомок"
|
||||
else:
|
||||
return _son_level[level]
|
||||
|
||||
def get_mother(self,level):
|
||||
if level>len(_mother_level)-1:
|
||||
def get_mother(self, level):
|
||||
if level > len(_mother_level)-1:
|
||||
return u"дальний предок"
|
||||
else:
|
||||
return _mother_level[level]
|
||||
|
||||
def get_daughter(self,level):
|
||||
if level>len(_daughter_level)-1:
|
||||
def get_daughter(self, level):
|
||||
if level > len(_daughter_level)-1:
|
||||
return u"дальний потомок"
|
||||
else:
|
||||
return _daughter_level[level]
|
||||
|
||||
def _get_aunt(self, level, step='', inlaw=''):
|
||||
if level>len(_sister_level)-1:
|
||||
if level > len(_sister_level)-1:
|
||||
return u"дальний предок"
|
||||
else:
|
||||
return _sister_level[level]
|
||||
|
||||
def _get_uncle(self, level, step='', inlaw=''):
|
||||
if level>len(_brother_level)-1:
|
||||
if level > len(_brother_level)-1:
|
||||
return u"дальний предок"
|
||||
else:
|
||||
return _brother_level[level]
|
||||
|
||||
def _get_sibling(self, level, step='', inlaw=''):
|
||||
"""Sibling of unknown gender
|
||||
"""
|
||||
Sibling of unknown gender
|
||||
"""
|
||||
return self._get_uncle(level, step, inlaw) + u" или u" + self._get_aunt(level, step, inlaw)
|
||||
|
||||
def get_nephew(self,level):
|
||||
if level>len(_nephew_level)-1:
|
||||
def get_nephew(self, level):
|
||||
if level > len(_nephew_level)-1:
|
||||
return u"дальний потомок"
|
||||
else:
|
||||
return _nephew_level[level]
|
||||
|
||||
def get_niece(self,level):
|
||||
if level>len(_niece_level)-1:
|
||||
def get_niece(self, level):
|
||||
if level > len(_niece_level)-1:
|
||||
return u"дальний потомок"
|
||||
else:
|
||||
return _niece_level[level]
|
||||
@ -258,14 +424,14 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
return (self.get_niece(Gb-1))
|
||||
elif Ga > Gb:
|
||||
if gender_b == gen.lib.Person.MALE:
|
||||
return (self.get_senior_male_cousin(Gb-1,Ga-Gb))
|
||||
return (self.get_senior_male_cousin(Gb-1, Ga-Gb))
|
||||
else:
|
||||
return (self.get_senior_female_cousin(Gb-1,Ga-Gb))
|
||||
return (self.get_senior_female_cousin(Gb-1, Ga-Gb))
|
||||
else:
|
||||
if gender_b == gen.lib.Person.MALE:
|
||||
return (self.get_junior_male_cousin(Ga-1,Gb-Ga))
|
||||
return (self.get_junior_male_cousin(Ga-1, Gb-Ga))
|
||||
else:
|
||||
return (self.get_junior_female_cousin(Ga-1,Gb-Ga))
|
||||
return (self.get_junior_female_cousin(Ga-1, Gb-Ga))
|
||||
|
||||
|
||||
def get_plural_relationship_string(self, Ga, Gb):
|
||||
@ -316,3 +482,18 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
|
||||
# TODO: def get_sibling_relationship_string for Russian step and inlaw relations
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# Test function. Call it as follows from the command line (so as to find
|
||||
# imported modules):
|
||||
# export PYTHONPATH=/path/to/gramps/src
|
||||
# python src/plugins/rel/rel_ru.py
|
||||
# (Above not needed here)
|
||||
|
||||
"""TRANSLATORS, copy this if statement at the bottom of your
|
||||
rel_xx.py module, and test your work with:
|
||||
python src/plugins/rel/rel_xx.py
|
||||
"""
|
||||
from Relationship import test
|
||||
RC = RelationshipCalculator()
|
||||
test(RC, True)
|
||||
|
@ -19,9 +19,9 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Slovak-specific classes for relationships.
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -75,9 +75,9 @@ _sister_level = [ "", "sestra%s", "teta%s", "prateta%s", "praprateta%s", ]
|
||||
|
||||
_brother_level = [ "", "brat%s", "strýko%s", "prastrýko%s", "praprastrýko%s", ]
|
||||
|
||||
_nephew_level =[ "", "synovec%s", "prasynovec%s", "praprasynovec%s", ]
|
||||
_nephew_level = [ "", "synovec%s", "prasynovec%s", "praprasynovec%s", ]
|
||||
|
||||
_niece_level =[ "", "neter%s", "praneter%s", "prapraneter%s", ]
|
||||
_niece_level = [ "", "neter%s", "praneter%s", "prapraneter%s", ]
|
||||
|
||||
# kinship report
|
||||
|
||||
@ -106,6 +106,9 @@ _nephews_nieces_level = [ "", "synovci a netere",
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
RelationshipCalculator Class
|
||||
"""
|
||||
|
||||
INLAW = ' (m. zväzok)'
|
||||
|
||||
@ -576,13 +579,13 @@ if __name__ == "__main__":
|
||||
# Test function. Call it as follows from the command line (so as to find
|
||||
# imported modules):
|
||||
# export PYTHONPATH=/path/to/gramps/src
|
||||
# python src/plugins/rel_sk.py
|
||||
# python src/plugins/rel/rel_sk.py
|
||||
# (Above not needed here)
|
||||
|
||||
"""TRANSLATORS, copy this if statement at the bottom of your
|
||||
rel_xx.py module, and test your work with:
|
||||
python src/plugins/rel_xx.py
|
||||
python src/plugins/rel/rel_xx.py
|
||||
"""
|
||||
from Relationship import test
|
||||
rc = RelationshipCalculator()
|
||||
test(rc, True)
|
||||
RC = RelationshipCalculator()
|
||||
test(RC, True)
|
||||
|
@ -26,7 +26,10 @@
|
||||
# Written by Alex Roitman, largely based on Relationship.py by Don Allingham
|
||||
# and on valuable input from Jens Arvidsson
|
||||
# Updated to 3.0 by Peter Landgren 2007-12-30.
|
||||
|
||||
#
|
||||
"""
|
||||
Swedish-specific definitions of relationships
|
||||
"""
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -36,10 +39,6 @@
|
||||
import gen.lib
|
||||
import Relationship
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Swedish-specific definitions of relationships
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
_cousin_level = [ "", "kusin",
|
||||
@ -69,6 +68,9 @@ u"artonde", u"nittonde", u"tjugonde" ]
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
||||
"""
|
||||
RelationshipCalculator Class
|
||||
"""
|
||||
|
||||
#sibling strings
|
||||
STEP = 'styv'
|
||||
@ -524,13 +526,13 @@ if __name__ == "__main__":
|
||||
# Test function. Call it as follows from the command line (so as to find
|
||||
# imported modules):
|
||||
# export PYTHONPATH=/path/to/gramps/src
|
||||
# python src/plugins/rel_fr.py
|
||||
# python src/plugins/rel/rel_sv.py
|
||||
# (Above not needed here)
|
||||
|
||||
"""TRANSLATORS, copy this if statement at the bottom of your
|
||||
rel_xx.py module, and test your work with:
|
||||
python src/plugins/rel_xx.py
|
||||
python src/plugins/rel/rel_xx.py
|
||||
"""
|
||||
from Relationship import test
|
||||
rc = RelationshipCalculator()
|
||||
test(rc, True)
|
||||
RC = RelationshipCalculator()
|
||||
test(RC, True)
|
||||
|
Loading…
Reference in New Issue
Block a user