# plugins/rel_fr.py : clean code
svn: r8851
This commit is contained in:
parent
e5c4bf20e1
commit
052c9bc77b
@ -89,20 +89,16 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|||||||
|
|
||||||
|
|
||||||
def get_cousin(self,level,removed):
|
def get_cousin(self,level,removed):
|
||||||
if removed > len(_removed_level)-1 or level>len(_level_name)-1:
|
if removed < len(_removed_level) or level < len(_level_name):
|
||||||
# _level_name[removed] pour avoir un adjectif au masculin ...
|
# _level_name[removed] pour avoir un adjectif au masculin ...
|
||||||
# not certain we need this on rel_fr
|
|
||||||
return "le %s cousin au %s degré" % (_level_name[removed],_removed_level[removed])
|
return "le %s cousin au %s degré" % (_level_name[removed],_removed_level[removed])
|
||||||
else:
|
else:
|
||||||
# TODO working with junior cousin [Gb] > 4
|
|
||||||
return "le cousin éloigné, à la %s génération" % (_level_name[level])
|
return "le cousin éloigné, à la %s génération" % (_level_name[level])
|
||||||
|
|
||||||
def get_cousine(self,level,removed):
|
def get_cousine(self,level,removed):
|
||||||
if removed > len(_removed_level)-1 or level>len(_level_name)-1:
|
if removed < len(_removed_level) or level < len(_level_name):
|
||||||
# not certain we need this on rel_fr
|
|
||||||
return "la %s cousine au %s degré" % (_level_name[level],_removed_level[removed])
|
return "la %s cousine au %s degré" % (_level_name[level],_removed_level[removed])
|
||||||
else:
|
else:
|
||||||
# TODO working with junior cousine [Gb] > 4
|
|
||||||
return "la cousine éloignée, à la %s génération" % (_level_name[level])
|
return "la cousine éloignée, à la %s génération" % (_level_name[level])
|
||||||
|
|
||||||
def get_parents(self,level):
|
def get_parents(self,level):
|
||||||
@ -160,63 +156,6 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|||||||
return _niece_level[level]
|
return _niece_level[level]
|
||||||
|
|
||||||
|
|
||||||
def is_spouse(self,db,orig,other):
|
|
||||||
for f in orig.get_family_handle_list():
|
|
||||||
family = db.get_family_from_handle(f)
|
|
||||||
if family and other.get_handle() in [family.get_father_handle(),
|
|
||||||
family.get_mother_handle()]:
|
|
||||||
family_rel = family.get_relationship()
|
|
||||||
# Determine person's gender
|
|
||||||
if other.get_gender() == RelLib.Person.MALE:
|
|
||||||
gender = RelLib.Person.MALE
|
|
||||||
elif other.get_gender() == RelLib.Person.FEMALE:
|
|
||||||
gender = RelLib.Person.FEMALE
|
|
||||||
# Person's gender is unknown, try guessing from spouse's
|
|
||||||
elif orig.get_gender() == RelLib.Person.MALE:
|
|
||||||
if family_rel == RelLib.FamilyRelType.CIVIL_UNION:
|
|
||||||
gender = RelLib.Person.MALE
|
|
||||||
else:
|
|
||||||
gender = RelLib.Person.FEMALE
|
|
||||||
elif orig.get_gender() == RelLib.Person.FEMALE:
|
|
||||||
if family_rel == RelLib.FamilyRelType.CIVIL_UNION:
|
|
||||||
gender = RelLib.Person.FEMALE
|
|
||||||
else:
|
|
||||||
gender = RelLib.Person.MALE
|
|
||||||
else:
|
|
||||||
gender = RelLib.Person.UNKNOWN
|
|
||||||
|
|
||||||
if family_rel == RelLib.FamilyRelType.MARRIED:
|
|
||||||
if gender == RelLib.Person.MALE:
|
|
||||||
return _("le mari")
|
|
||||||
elif gender == RelLib.Person.FEMALE:
|
|
||||||
return _("la femme")
|
|
||||||
else:
|
|
||||||
return _("le conjoint")
|
|
||||||
elif family_rel == RelLib.FamilyRelType.UNMARRIED:
|
|
||||||
if gender == RelLib.Person.MALE:
|
|
||||||
return _("le conjoint")
|
|
||||||
elif gender == RelLib.Person.FEMALE:
|
|
||||||
return _("la conjointe")
|
|
||||||
else:
|
|
||||||
return _("le conjoint")
|
|
||||||
elif family_rel == RelLib.FamilyRelType.CIVIL_UNION:
|
|
||||||
if gender == RelLib.Person.MALE:
|
|
||||||
return _("le conjoint")
|
|
||||||
elif gender == RelLib.Person.FEMALE:
|
|
||||||
return _("la conjointe")
|
|
||||||
else:
|
|
||||||
return _("le conjoint")
|
|
||||||
else:
|
|
||||||
if gender == RelLib.Person.MALE:
|
|
||||||
return _("le conjoint")
|
|
||||||
elif gender == RelLib.Person.FEMALE:
|
|
||||||
return _("la conjointe")
|
|
||||||
else:
|
|
||||||
return _("le conjoint")
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
return None
|
|
||||||
|
|
||||||
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,
|
Returns a string representing the relationshp between the two people,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user