2007-09-08 03:47:14 +05:30
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2007-10-30 00:54:01 +05:30
|
|
|
# Copyright (C) 2003-2007 Donald N. Allingham
|
2009-04-29 19:57:08 +05:30
|
|
|
# Copyright (C) 2008-2009 Brian G. Matherly
|
2010-01-05 19:12:23 +05:30
|
|
|
# Copyright (C) 2007-2010 Jerome Rapinat
|
2007-09-08 03:47:14 +05:30
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
2009-04-29 19:57:08 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
"""
|
|
|
|
French-specific classes for relationships.
|
|
|
|
"""
|
2007-09-08 03:47:14 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2007-10-08 22:11:39 +05:30
|
|
|
import gen.lib
|
2007-09-08 03:47:14 +05:30
|
|
|
import Relationship
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
# level is used for generation level:
|
|
|
|
# at %th generation
|
2010-01-05 19:12:23 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME = [
|
2010-01-05 19:12:23 +05:30
|
|
|
u"première",
|
|
|
|
u"deuxième",
|
|
|
|
u"troisième",
|
|
|
|
u"quatrième",
|
|
|
|
u"cinquième",
|
|
|
|
u"sixième",
|
|
|
|
u"septième",
|
|
|
|
u"huitième",
|
|
|
|
u"neuvième",
|
|
|
|
u"dixième",
|
|
|
|
u"onzième",
|
|
|
|
u"douzième",
|
|
|
|
u"treizième",
|
|
|
|
u"quatorzième",
|
|
|
|
u"quinzième",
|
|
|
|
u"seizième",
|
|
|
|
u"dix-septième",
|
|
|
|
u"dix-huitième",
|
|
|
|
u"dix-neuvième",
|
|
|
|
u"vingtième",
|
|
|
|
u"vingt-et-unième",
|
|
|
|
u"vingt-deuxième",
|
|
|
|
u"vingt-troisième",
|
|
|
|
u"vingt-quatrième",
|
|
|
|
u"vingt-cinquième",
|
|
|
|
u"vingt-sixième",
|
|
|
|
u"vingt-septième",
|
|
|
|
u"vingt-huitième",
|
|
|
|
u"vingt-neuvième",
|
|
|
|
u"trentième",
|
2009-02-01 22:55:12 +05:30
|
|
|
]
|
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
# for degree (canon et civil), limitation 20+20 also used for
|
|
|
|
# the first [premier] cousin
|
2010-01-05 19:12:23 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_REMOVED_LEVEL = [
|
2010-01-05 19:12:23 +05:30
|
|
|
u"premier",
|
|
|
|
u"deuxième",
|
|
|
|
u"troisième",
|
|
|
|
u"quatrième",
|
|
|
|
u"cinquième",
|
|
|
|
u"sixième",
|
|
|
|
u"septième",
|
|
|
|
u"huitième",
|
|
|
|
u"neuvième",
|
|
|
|
u"dixième",
|
|
|
|
u"onzième",
|
|
|
|
u"douzième",
|
|
|
|
u"treizième",
|
|
|
|
u"quatorzième",
|
|
|
|
u"quinzième",
|
|
|
|
u"seizième",
|
|
|
|
u"dix-septième",
|
|
|
|
u"dix-huitième",
|
|
|
|
u"dix-neuvième",
|
|
|
|
u"vingtième",
|
|
|
|
u"vingt-et-unième",
|
|
|
|
u"vingt-deuxième",
|
|
|
|
u"vingt-troisième",
|
|
|
|
u"vingt-quatrième",
|
|
|
|
u"vingt-cinquième",
|
|
|
|
u"vingt-sixième",
|
|
|
|
u"vingt-septième",
|
|
|
|
u"vingt-huitième",
|
|
|
|
u"vingt-neuvième",
|
|
|
|
u"trentième",
|
|
|
|
u"trente-et-unième",
|
|
|
|
u"trente-deuxième",
|
|
|
|
u"trente-troisième",
|
|
|
|
u"trente-quatrième",
|
|
|
|
u"trente-cinquième",
|
|
|
|
u"trente-sixième",
|
|
|
|
u"trente-septième",
|
|
|
|
u"trente-huitième",
|
|
|
|
u"trente-neuvième",
|
|
|
|
u"quarantième",
|
|
|
|
u"quanrante-et-unième",
|
2009-02-01 22:55:12 +05:30
|
|
|
]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
# small lists, use generation level if > [5]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_FATHER_LEVEL = [u"", u"le père%s", u"le grand-père%s",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"l'arrière-grand-père%s", u"le trisaïeul%s"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_MOTHER_LEVEL = [u"", u"la mère%s", u"la grand-mère%s",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"l'arrière-grand-mère%s", u"la trisaïeule%s"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_SON_LEVEL = [u"", u"le fils%s", u"le petit-fils%s",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"l'arrière-petit-fils%s"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_DAUGHTER_LEVEL = [u"", u"la fille%s", u"la petite-fille%s",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"l'arrière-petite-fille%s"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_SISTER_LEVEL = [u"", u"la sœur%s", u"la tante%s", u"la grand-tante%s",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"l'arrière-grand-tante%s"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_BROTHER_LEVEL = [u"", u"le frère%s", u"l'oncle%s", u"le grand-oncle%s",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"l'arrière-grand-oncle%s"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_NEPHEW_LEVEL = [u"", u"le neveu%s", u"le petit-neveu%s",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"l'arrière-petit-neveu%s"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_NIECE_LEVEL = [u"", u"la nièce%s", u"la petite-nièce%s",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"l'arrière-petite-nièce%s"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
|
|
|
# kinship report
|
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_PARENTS_LEVEL = [u"", u"les parents", u"les grands-parents",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"les arrières-grands-parents", u"les trisaïeux"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_CHILDREN_LEVEL = [u"", u"les enfants", u"les petits-enfants",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"les arrières-petits-enfants",
|
|
|
|
u"les arrières-arrières-petits-enfants"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_SIBLINGS_LEVEL = [u"", u"les frères et les sœurs",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"les oncles et les tantes",
|
|
|
|
u"les grands-oncles et les grands-tantes",
|
|
|
|
u"les arrières-grands-oncles et les arrières-grands-tantes"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
_NEPHEWS_NIECES_LEVEL = [u"", u"les neveux et les nièces",
|
2010-01-05 19:12:23 +05:30
|
|
|
u"les petits-neveux et les petites-nièces",
|
|
|
|
u"les arrière-petits-neveux et les arrières-petites-nièces"]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2007-10-27 00:22:55 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
RelationshipCalculator Class
|
|
|
|
"""
|
|
|
|
|
|
|
|
# RelCalc tool - Status Bar
|
2007-11-11 16:57:29 +05:30
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
INLAW = u' (par alliance)'
|
2007-11-11 16:57:29 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
def __init__(self):
|
|
|
|
Relationship.RelationshipCalculator.__init__(self)
|
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
# from active person to common ancestor Ga=[level]
|
2010-01-05 19:12:23 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
def get_cousin(self, level, removed, inlaw=""):
|
|
|
|
"""
|
|
|
|
cousins = same level, gender = male
|
|
|
|
"""
|
|
|
|
if removed == 0 and level < len(_LEVEL_NAME):
|
|
|
|
return "le %s cousin%s" % (_REMOVED_LEVEL[level - 1], inlaw)
|
2009-02-01 22:55:12 +05:30
|
|
|
elif level < removed:
|
2010-01-05 20:07:10 +05:30
|
|
|
self.get_uncle(level - 1, inlaw)
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level < 30:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-12 20:23:00 +05:30
|
|
|
# limitation gen = 30
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"le cousin lointain, relié à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[removed]
|
2010-01-12 20:23:00 +05:30
|
|
|
else:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"le cousin lointain, relié à la %dème génération" % \
|
|
|
|
(level + 1)
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
def get_cousine(self, level, removed, inlaw=""):
|
|
|
|
"""
|
|
|
|
cousines = same level, gender = female
|
|
|
|
"""
|
|
|
|
if removed == 0 and level < len(_LEVEL_NAME):
|
|
|
|
return "la %s cousine%s" % (_LEVEL_NAME[level - 1], inlaw)
|
2009-02-01 22:55:12 +05:30
|
|
|
elif level < removed:
|
2010-01-05 20:07:10 +05:30
|
|
|
self.get_aunt(level - 1, inlaw)
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"la cousine lointaine, reliée à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[removed]
|
2010-01-12 20:23:00 +05:30
|
|
|
else:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"la cousine lointaine, reliée à la %dème génération" % \
|
|
|
|
(level + 1)
|
2007-09-08 03:47:14 +05:30
|
|
|
|
|
|
|
def get_parents(self, level):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
ancestors
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_PARENTS_LEVEL) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"les ascendants lointains, à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[level]
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level > len(_PARENTS_LEVEL) - 1:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"les ascendants lointains, à la %dème génération" % level
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
return _PARENTS_LEVEL[level]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_father(self, level, inlaw=""):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
ancestor, gender = male
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_FATHER_LEVEL) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"l'ascendant lointain, à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[level]
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level > len(_FATHER_LEVEL) - 1:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"l'ascendant lointain, à la %dème génération" % level
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
return _FATHER_LEVEL[level] % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_mother(self, level, inlaw=""):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
ancestor, gender = female
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_MOTHER_LEVEL) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"l'ascendante lointaine, à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[level]
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level > len(_MOTHER_LEVEL) - 1:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"l'ascendante lointaine, à la %dème génération" % level
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
return _MOTHER_LEVEL[level] % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_parent_unknown(self, level, inlaw=""):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
unknown parent
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_LEVEL_NAME) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"l'ascendant lointain, à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[level]
|
2008-09-13 15:22:28 +05:30
|
|
|
elif level == 1:
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"un parent%s" % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"un parent lointain%s" % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_son(self, level, inlaw=""):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
descendant, gender = male
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_SON_LEVEL) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"le descendant lointain, à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[level + 1]
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level > len(_SON_LEVEL) - 1:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"le descendant lointain, à la %dème génération" % level
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
return _SON_LEVEL[level] % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_daughter(self, level, inlaw=""):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
descendant, gender = female
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_DAUGHTER_LEVEL) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"la descendante lointaine, à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[level + 1]
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level > len(_DAUGHTER_LEVEL) - 1:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"la descendante lointaine, à la %dème génération" % level
|
2007-10-30 23:57:47 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
return _DAUGHTER_LEVEL[level] % inlaw
|
2007-10-30 23:57:47 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_child_unknown(self, level, inlaw=""):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
descendant, gender = unknown
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_LEVEL_NAME) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"le descendant lointain, à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[level + 1]
|
2008-09-13 15:22:28 +05:30
|
|
|
elif level == 1:
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"un enfant%s" % inlaw
|
2007-10-30 23:57:47 +05:30
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"un descendant lointain%s" % inlaw
|
2007-11-11 16:57:29 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
def get_sibling_unknown(self, inlaw=""):
|
|
|
|
"""
|
|
|
|
sibling of an ancestor, gender = unknown
|
|
|
|
"""
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"un parent lointain%s" % inlaw
|
2007-10-30 23:57:47 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_uncle(self, level, inlaw=""):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
sibling of an ancestor, gender = male
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_BROTHER_LEVEL) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"l'oncle lointain, relié à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[level]
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level > len(_BROTHER_LEVEL) - 1:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"l'oncle lointain, relié à la %dème génération" % \
|
|
|
|
(level + 1)
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
return _BROTHER_LEVEL[level] % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_aunt(self, level, inlaw=""):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
sibling of an ancestor, gender = female
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_SISTER_LEVEL) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"la tante lointaine, reliée à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[level]
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level > len(_SISTER_LEVEL) -1:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"la tante lointaine, reliée à la %dème génération" % \
|
|
|
|
(level + 1)
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
return _SISTER_LEVEL[level] % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_nephew(self, level, inlaw=""):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
cousin of a descendant, gender = male
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_NEPHEW_LEVEL) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
return u"le neveu lointain, à la %s génération" % _LEVEL_NAME[level]
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level > len(_NEPHEW_LEVEL) - 1:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"le neveu lointain, à la %dème génération" % (level + 1)
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
return _NEPHEW_LEVEL[level] % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_niece(self, level, inlaw=""):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
cousin of a descendant, gender = female
|
|
|
|
"""
|
2010-01-12 20:23:00 +05:30
|
|
|
if level > len(_NIECE_LEVEL) - 1 and level < 30:
|
|
|
|
|
|
|
|
# limitation gen = 30
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
return u"la nièce lointaine, à la %s génération" % \
|
2010-01-05 20:07:10 +05:30
|
|
|
_LEVEL_NAME[level]
|
2010-01-12 20:23:00 +05:30
|
|
|
elif level > len(_NIECE_LEVEL) - 1:
|
|
|
|
|
|
|
|
# use numerical generation
|
|
|
|
|
|
|
|
return u"la nièce lointaine, à la %dème génération" % (level + 1)
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
return _NIECE_LEVEL[level] % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
|
|
|
|
# kinship report
|
|
|
|
|
|
|
|
def get_plural_relationship_string(self, Ga, Gb):
|
|
|
|
"""
|
2007-10-29 21:50:24 +05:30
|
|
|
voir Relationship.py
|
2007-09-08 03:47:14 +05:30
|
|
|
"""
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"des parents lointains"
|
2010-01-05 20:07:10 +05:30
|
|
|
atgen = " à la %sème génération"
|
2010-01-05 19:12:23 +05:30
|
|
|
bygen = u" par la %sème génération"
|
2010-01-05 20:07:10 +05:30
|
|
|
cmt = u" (frères ou sœurs d'un ascendant" + atgen % Ga + ")"
|
2007-09-08 03:47:14 +05:30
|
|
|
if Ga == 0:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
# These are descendants
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
if Gb < len(_CHILDREN_LEVEL):
|
|
|
|
rel_str = _CHILDREN_LEVEL[Gb]
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
rel_str = u"les descendants" + atgen % (Gb + 1)
|
2007-09-08 03:47:14 +05:30
|
|
|
elif Gb == 0:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
# These are parents/grand parents
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
if Ga < len(_PARENTS_LEVEL):
|
|
|
|
rel_str = _PARENTS_LEVEL[Ga]
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
rel_str = u"les ascendants" + atgen % (Ga + 1)
|
2007-09-08 03:47:14 +05:30
|
|
|
elif Gb == 1:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
# These are siblings/aunts/uncles
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
if Ga < len(_SIBLINGS_LEVEL):
|
|
|
|
rel_str = _SIBLINGS_LEVEL[Ga]
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
rel_str = u"Les enfants d'un ascendant" + atgen % (Ga + 1) + \
|
2009-02-01 22:55:12 +05:30
|
|
|
cmt
|
2007-09-08 03:47:14 +05:30
|
|
|
elif Ga == 1:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
# These are nieces/nephews
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
if Gb < len(_NEPHEWS_NIECES_LEVEL):
|
|
|
|
rel_str = _NEPHEWS_NIECES_LEVEL[Gb - 1]
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2010-01-05 20:07:10 +05:30
|
|
|
rel_str = u"les neveux et les nièces" + atgen % Gb
|
2007-09-08 03:47:14 +05:30
|
|
|
elif Ga > 1 and Ga == Gb:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
# These are cousins in the same generation
|
|
|
|
# use custom level for latin words
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
if Ga == 2:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"les cousins germains et cousines germaines"
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Ga <= len(_LEVEL_NAME):
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-11-22 22:27:32 +05:30
|
|
|
# %ss for plural
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
rel_str = u"les %ss cousins et cousines" % _LEVEL_NAME[Ga -
|
2009-02-01 22:55:12 +05:30
|
|
|
2]
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
# security
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"les cousins et cousines"
|
2007-09-08 03:47:14 +05:30
|
|
|
elif Ga > 1 and Ga > Gb:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
# These are cousins in different generations with the second person
|
|
|
|
# being in a higher generation from the common ancestor than the
|
2007-09-08 03:47:14 +05:30
|
|
|
# first person.
|
|
|
|
# use custom level for latin words and specific relation
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
if Ga == 3 and Gb == 2:
|
2010-01-05 19:12:23 +05:30
|
|
|
desc = u" (cousins germains d'un parent)"
|
|
|
|
rel_str = u"les oncles et tantes à la mode de Bretagne" + \
|
2009-02-01 22:55:12 +05:30
|
|
|
desc
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Gb <= len(_LEVEL_NAME) and Ga - Gb < len(_REMOVED_LEVEL) and \
|
|
|
|
Ga + Gb + 1 < len(_REMOVED_LEVEL):
|
|
|
|
can = u" du %s au %s degré (canon)" % (_REMOVED_LEVEL[Gb],
|
|
|
|
_REMOVED_LEVEL[Ga])
|
|
|
|
civ = u" et au %s degré (civil)" % _REMOVED_LEVEL[Ga + Gb +
|
2009-02-01 22:55:12 +05:30
|
|
|
1]
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"les oncles et tantes" + can + civ
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Ga < len(_LEVEL_NAME):
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"les grands-oncles et grands-tantes" + bygen % \
|
2009-02-01 22:55:12 +05:30
|
|
|
(Ga + 1)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
|
|
|
return rel_str
|
2007-09-08 03:47:14 +05:30
|
|
|
elif Gb > 1 and Gb > Ga:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
# These are cousins in different generations with the second person
|
|
|
|
# being in a lower generation from the common ancestor than the
|
2007-09-08 03:47:14 +05:30
|
|
|
# first person.
|
|
|
|
# use custom level for latin words and specific relation
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
if Ga == 2 and Gb == 3:
|
2010-01-05 19:12:23 +05:30
|
|
|
info = u" (cousins issus d'un germain)"
|
|
|
|
rel_str = u"les neveux et nièces à la mode de Bretagne" + \
|
2009-02-01 22:55:12 +05:30
|
|
|
info
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Ga <= len(_LEVEL_NAME) and Gb - Ga < len(_REMOVED_LEVEL) and \
|
|
|
|
Ga + Gb + 1 < len(_REMOVED_LEVEL):
|
|
|
|
can = u" du %s au %s degré (canon)" % (_REMOVED_LEVEL[Gb],
|
|
|
|
_REMOVED_LEVEL[Ga])
|
|
|
|
civ = u" et au %s degré (civil)" % _REMOVED_LEVEL[Ga + Gb +
|
2009-02-01 22:55:12 +05:30
|
|
|
1]
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"les neveux et nièces" + can + civ
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Ga < len(_LEVEL_NAME):
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"les neveux et nièces" + bygen % Gb
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
|
|
|
return rel_str
|
|
|
|
return rel_str
|
|
|
|
|
2008-09-13 15:22:28 +05:30
|
|
|
# quick report (missing on RelCalc tool - Status Bar)
|
2007-10-27 00:22:55 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
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,
|
|
|
|
):
|
2007-10-27 00:22:55 +05:30
|
|
|
"""
|
2007-10-29 21:50:24 +05:30
|
|
|
voir Relationship.py
|
2007-10-27 00:22:55 +05:30
|
|
|
"""
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-11-24 19:48:21 +05:30
|
|
|
if only_birth:
|
2009-02-01 22:55:12 +05:30
|
|
|
step = ""
|
2007-11-24 19:48:21 +05:30
|
|
|
else:
|
|
|
|
step = self.STEP
|
2007-10-29 21:50:24 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
if in_law_a or in_law_b:
|
2007-11-11 16:57:29 +05:30
|
|
|
inlaw = self.INLAW
|
2007-10-31 16:49:33 +05:30
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
inlaw = u""
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"un parent lointains%s" % inlaw
|
|
|
|
bygen = u" par la %sème génération"
|
2007-10-27 00:22:55 +05:30
|
|
|
if Ga == 0:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-27 00:22:55 +05:30
|
|
|
# b is descendant of a
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
if Gb == 0:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le même individu"
|
2010-01-05 20:07:10 +05:30
|
|
|
elif gender_b == gen.lib.Person.MALE and Gb < len(_SON_LEVEL):
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2008-09-13 15:22:28 +05:30
|
|
|
# spouse of daughter
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-11-24 19:48:21 +05:30
|
|
|
if inlaw and Gb == 1 and not step:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le gendre"
|
2007-11-22 22:27:32 +05:30
|
|
|
else:
|
|
|
|
rel_str = self.get_son(Gb)
|
2010-01-05 20:07:10 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE and Gb < len(_DAUGHTER_LEVEL):
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2008-09-13 15:22:28 +05:30
|
|
|
# spouse of son
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-11-24 19:48:21 +05:30
|
|
|
if inlaw and Gb == 1 and not step:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la bru"
|
2007-11-22 22:27:32 +05:30
|
|
|
else:
|
|
|
|
rel_str = self.get_daughter(Gb)
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Gb < len(_LEVEL_NAME) and gender_b == gen.lib.Person.MALE:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
# don't display inlaw
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le descendant lointain (%dème génération)" % \
|
2009-02-01 22:55:12 +05:30
|
|
|
(Gb + 1)
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Gb < len(_LEVEL_NAME) and gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la descendante lointaine (%dème génération)" % \
|
2009-02-01 22:55:12 +05:30
|
|
|
(Gb + 1)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
2007-11-22 22:27:32 +05:30
|
|
|
return self.get_child_unknown(Gb)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Gb == 0:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-27 00:22:55 +05:30
|
|
|
# b is parents/grand parent of a
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE and Ga < len(_FATHER_LEVEL):
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2008-09-13 15:22:28 +05:30
|
|
|
# other spouse of father (new parent)
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2008-09-13 15:22:28 +05:30
|
|
|
if Ga == 1 and inlaw and self.STEP_SIB:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le beau-père"
|
2008-09-13 15:22:28 +05:30
|
|
|
elif Ga == 1 and inlaw:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
# father of spouse (family of spouse)
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le père du conjoint"
|
2007-11-22 22:27:32 +05:30
|
|
|
else:
|
|
|
|
rel_str = self.get_father(Ga, inlaw)
|
2010-01-05 20:07:10 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE and Ga < len(_MOTHER_LEVEL):
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2008-09-13 15:22:28 +05:30
|
|
|
# other spouse of mother (new parent)
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2008-09-13 15:22:28 +05:30
|
|
|
if Ga == 1 and inlaw and self.STEP_SIB:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la belle-mère"
|
2008-09-13 15:22:28 +05:30
|
|
|
elif Ga == 1 and inlaw:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
# mother of spouse (family of spouse)
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la mère du conjoint"
|
2007-11-22 22:27:32 +05:30
|
|
|
else:
|
|
|
|
rel_str = self.get_mother(Ga, inlaw)
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Ga < len(_LEVEL_NAME) and gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"l'ascendant lointain%s (%dème génération)" % \
|
2009-02-01 22:55:12 +05:30
|
|
|
(inlaw, Ga + 1)
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Ga < len(_LEVEL_NAME) and gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"l'ascendante lointaine%s (%dème génération)" % \
|
2009-02-01 22:55:12 +05:30
|
|
|
(inlaw, Ga + 1)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
2007-10-31 16:49:33 +05:30
|
|
|
return self.get_parent_unknown(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Gb == 1:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-27 00:22:55 +05:30
|
|
|
# b is sibling/aunt/uncle of a
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE and Ga < len(_BROTHER_LEVEL):
|
2007-11-22 22:27:32 +05:30
|
|
|
rel_str = self.get_uncle(Ga, inlaw)
|
2010-01-05 20:07:10 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE and Ga < len(_SISTER_LEVEL):
|
2007-11-22 22:27:32 +05:30
|
|
|
rel_str = self.get_aunt(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-11-22 22:27:32 +05:30
|
|
|
# don't display inlaw
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-27 00:22:55 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"l'oncle lointain" + bygen % (Ga + 1)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la tante lointaine" + bygen % (Ga + 1)
|
2007-11-11 16:57:29 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
2010-01-05 20:07:10 +05:30
|
|
|
rel_str = self.get_sibling_unknown(inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
|
|
|
return rel_str
|
|
|
|
elif Ga == 1:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-27 00:22:55 +05:30
|
|
|
# b is niece/nephew of a
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE and Gb < len(_NEPHEW_LEVEL):
|
2009-02-01 22:55:12 +05:30
|
|
|
rel_str = self.get_nephew(Gb - 1, inlaw)
|
2010-01-05 20:07:10 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE and Gb < len(_NIECE_LEVEL):
|
2009-02-01 22:55:12 +05:30
|
|
|
rel_str = self.get_niece(Gb - 1, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
2009-02-01 22:55:12 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le neveu lointain%s (%dème génération)" % \
|
2009-02-01 22:55:12 +05:30
|
|
|
(inlaw, Gb)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la nièce lointaine%s (%dème génération)" % \
|
2009-02-01 22:55:12 +05:30
|
|
|
(inlaw, Gb)
|
2007-11-11 16:57:29 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
2010-01-05 20:07:10 +05:30
|
|
|
rel_str = self.get_sibling_unknown(inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
return rel_str
|
2007-10-31 16:49:33 +05:30
|
|
|
elif Ga == Gb:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-27 00:22:55 +05:30
|
|
|
# a and b cousins in the same generation
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-31 16:49:33 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 20:07:10 +05:30
|
|
|
rel_str = self.get_cousin(Ga - 1, 0, inlaw=inlaw)
|
2007-10-31 16:49:33 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 20:07:10 +05:30
|
|
|
rel_str = self.get_cousine(Ga - 1, 0, inlaw=inlaw)
|
2007-11-11 16:57:29 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
2010-01-05 20:07:10 +05:30
|
|
|
rel_str = self.get_sibling_unknown(inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
2007-10-31 16:49:33 +05:30
|
|
|
return rel_str
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Ga > 1 and Ga > Gb:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
# These are cousins in different generations with the second person
|
|
|
|
# being in a higher generation from the common ancestor than the
|
2007-10-27 00:22:55 +05:30
|
|
|
# first person.
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-27 00:22:55 +05:30
|
|
|
if Ga == 3 and Gb == 2:
|
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
desc = u" (cousin germain d'un parent)"
|
|
|
|
rel_str = u"l'oncle à la mode de Bretagne" + desc
|
2009-02-01 22:55:12 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
desc = u" (cousine germaine d'un parent)"
|
|
|
|
rel_str = u"la tante à la mode de Bretagne" + desc
|
2009-02-01 22:55:12 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
2007-11-11 16:57:29 +05:30
|
|
|
return self.get_sibling_unknown(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
|
|
|
return rel_str
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Gb <= len(_LEVEL_NAME) and Ga - Gb < len(_REMOVED_LEVEL) and \
|
|
|
|
Ga + Gb + 1 < len(_REMOVED_LEVEL):
|
|
|
|
can = u" du %s au %s degré (canon)" % (_REMOVED_LEVEL[Gb],
|
|
|
|
_REMOVED_LEVEL[Ga])
|
|
|
|
civ = u" et au %s degré (civil)" % _REMOVED_LEVEL[Ga + Gb +
|
2009-02-01 22:55:12 +05:30
|
|
|
1]
|
2007-10-27 00:22:55 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"l'oncle" + can + civ
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la tante" + can + civ
|
2007-11-11 16:57:29 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
|
|
|
rel_str = self.get_sibling_unknown(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
|
|
|
return rel_str
|
|
|
|
else:
|
2009-02-01 22:55:12 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2007-11-22 22:27:32 +05:30
|
|
|
rel_str = self.get_uncle(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2007-11-22 22:27:32 +05:30
|
|
|
rel_str = self.get_aunt(Ga, inlaw)
|
2007-11-11 16:57:29 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
|
|
|
rel_str = self.get_sibling_unknown(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
2009-02-01 22:55:12 +05:30
|
|
|
return rel_str
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Gb > 1 and Gb > Ga:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
# These are cousins in different generations with the second person
|
|
|
|
# being in a lower generation from the common ancestor than the
|
2007-10-27 00:22:55 +05:30
|
|
|
# first person.
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-27 00:22:55 +05:30
|
|
|
if Ga == 2 and Gb == 3:
|
2010-01-05 19:12:23 +05:30
|
|
|
info = u" (cousins issus d'un germain)"
|
2009-02-01 22:55:12 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le neveu à la mode de Bretagne" + info
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la nièce à la mode de Bretagne" + info
|
2007-11-11 16:57:29 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
|
|
|
rel_str = self.get_sibling_unknown(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
2009-02-01 22:55:12 +05:30
|
|
|
return rel_str
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Ga <= len(_LEVEL_NAME) and Gb - Ga < len(_REMOVED_LEVEL) and \
|
|
|
|
Ga + Gb + 1 < len(_REMOVED_LEVEL):
|
|
|
|
can = u" du %s au %s degré (canon)" % (_REMOVED_LEVEL[Gb],
|
|
|
|
_REMOVED_LEVEL[Ga])
|
|
|
|
civ = u" et au %s degré (civil)" % _REMOVED_LEVEL[Ga + Gb +
|
2009-02-01 22:55:12 +05:30
|
|
|
1]
|
2007-10-27 00:22:55 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le neveu" + can + civ
|
2007-10-27 00:22:55 +05:30
|
|
|
if gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la nièce" + can + civ
|
2007-11-11 16:57:29 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
|
|
|
rel_str = self.get_sibling_unknown(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
|
|
|
return rel_str
|
2010-01-05 20:07:10 +05:30
|
|
|
elif Ga > len(_LEVEL_NAME):
|
2007-10-27 00:22:55 +05:30
|
|
|
return rel_str
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-10-27 00:22:55 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2007-11-22 22:27:32 +05:30
|
|
|
rel_str = self.get_nephew(Ga, inlaw)
|
2009-02-01 22:55:12 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2007-11-22 22:27:32 +05:30
|
|
|
rel_str = self.get_niece(Ga, inlaw)
|
2007-11-11 16:57:29 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
|
|
|
rel_str = self.get_sibling_unknown(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
return rel_str
|
2007-09-08 03:47:14 +05:30
|
|
|
return rel_str
|
|
|
|
|
2008-09-13 15:22:28 +05:30
|
|
|
# RelCalc tool - Status Bar
|
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
def get_sibling_relationship_string(self, sib_type, gender_a,
|
|
|
|
gender_b, in_law_a=False, in_law_b=False):
|
2010-01-05 20:07:10 +05:30
|
|
|
"""
|
|
|
|
voir Relationship.py
|
|
|
|
"""
|
2007-11-22 22:27:32 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
if in_law_a or in_law_b:
|
2007-11-22 22:27:32 +05:30
|
|
|
inlaw = self.INLAW
|
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
inlaw = u""
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-11-24 19:48:21 +05:30
|
|
|
if sib_type == self.NORM_SIB:
|
|
|
|
if not inlaw:
|
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le frère (germain)"
|
2007-11-24 19:48:21 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la sœur (germaine)"
|
2007-11-24 19:48:21 +05:30
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le frère ou la sœur germain(e)"
|
2007-11-24 19:48:21 +05:30
|
|
|
else:
|
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le beau-frère"
|
2007-11-24 19:48:21 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la belle-sœur"
|
2007-11-24 19:48:21 +05:30
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le beau-frère ou la belle-sœur"
|
2007-11-24 19:48:21 +05:30
|
|
|
elif sib_type == self.UNKNOWN_SIB:
|
|
|
|
if not inlaw:
|
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le frère"
|
2007-11-24 19:48:21 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la sœur"
|
2007-11-24 19:48:21 +05:30
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le frère ou la sœur"
|
2007-11-22 22:27:32 +05:30
|
|
|
else:
|
2007-11-24 19:48:21 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le beau-frère"
|
2007-11-24 19:48:21 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la belle-sœur"
|
2007-11-24 19:48:21 +05:30
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le beau-frère ou la belle-sœur"
|
2007-11-24 19:48:21 +05:30
|
|
|
elif sib_type == self.HALF_SIB_MOTHER:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
# for descendants the "half" logic is reversed !
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2008-09-12 22:56:32 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le demi-frère consanguin"
|
2008-09-12 22:56:32 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la demi-sœur consanguine"
|
2008-09-12 22:56:32 +05:30
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le demi-frère ou la demi-sœur consanguin(e)"
|
2008-09-12 22:56:32 +05:30
|
|
|
elif sib_type == self.HALF_SIB_FATHER:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2010-01-05 20:07:10 +05:30
|
|
|
# for descendants the "half" logic is reversed !
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2008-09-12 22:56:32 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le demi-frère utérin"
|
2008-09-12 22:56:32 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la demi-sœur utérine"
|
2008-09-12 22:56:32 +05:30
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le demi-frère ou la demi-sœur utérin(e)"
|
2007-11-24 19:48:21 +05:30
|
|
|
elif sib_type == self.STEP_SIB:
|
2008-09-12 22:56:32 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le demi-frère"
|
2008-09-12 22:56:32 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"la demi-sœur"
|
2008-09-12 22:56:32 +05:30
|
|
|
else:
|
2010-01-05 19:12:23 +05:30
|
|
|
rel_str = u"le demi-frère ou la demi-sœur"
|
2007-11-22 22:27:32 +05:30
|
|
|
return rel_str
|
|
|
|
|
2007-10-30 15:46:20 +05:30
|
|
|
if __name__ == "__main__":
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-30 15:46:20 +05:30
|
|
|
# Test function. Call it as follows from the command line (so as to find
|
|
|
|
# imported modules):
|
2009-02-01 22:55:12 +05:30
|
|
|
# export PYTHONPATH=/path/to/gramps/src
|
2010-01-05 19:12:23 +05:30
|
|
|
# python src/plugins/rel/rel_fr.py
|
2007-11-22 22:27:32 +05:30
|
|
|
# (Above not needed here)
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-30 15:46:20 +05:30
|
|
|
"""TRANSLATORS, copy this if statement at the bottom of your
|
|
|
|
rel_xx.py module, and test your work with:
|
2010-01-05 19:12:23 +05:30
|
|
|
python src/plugins/rel/rel_xx.py
|
2007-10-30 15:46:20 +05:30
|
|
|
"""
|
|
|
|
from Relationship import test
|
2009-04-29 19:57:08 +05:30
|
|
|
RC = RelationshipCalculator()
|
|
|
|
test(RC, True)
|