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
|
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
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2007-10-08 22:11:39 +05:30
|
|
|
import gen.lib
|
2007-09-08 03:47:14 +05:30
|
|
|
import Relationship
|
|
|
|
import types
|
|
|
|
from gettext import gettext as _
|
|
|
|
from PluginUtils import register_relcalc
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2007-11-01 22:52:07 +05:30
|
|
|
# level est utilisé pour trouver/afficher le niveau de la génération :
|
|
|
|
# à la %sème génération
|
|
|
|
|
|
|
|
_level_name = [ "première", "deuxième", "troisième", "quatrième",
|
|
|
|
"cinquième", "sixième", "septième", "huitième",
|
|
|
|
"neuvième", "dixième", "onzième", "douzième",
|
|
|
|
"treizième", "quatorzième", "quinzième",
|
|
|
|
"seizième", "dix-septième", "dix-huitième",
|
|
|
|
"dix-neuvième", "vingtième", "vingt-et-unième",
|
|
|
|
"vingt-deuxième", "vingt-troisième",
|
|
|
|
"vingt-quatrième", "vingt-cinquième",
|
|
|
|
"vingt-sixième", "vingt-septième",
|
|
|
|
"vingt-huitième", "vingt-neuvième",
|
|
|
|
"trentième", ]
|
|
|
|
|
|
|
|
# pour le degrè (canon et civil), limitation 20+20 ainsi que pour
|
|
|
|
# LE [premier] cousin
|
|
|
|
|
|
|
|
_removed_level = [ "premièr", "deuxième", "troisième", "quatrième",
|
|
|
|
"cinquième", "sixième", "septième", "huitième",
|
|
|
|
"neuvième", "dixième", "onzième", "douzième",
|
|
|
|
"treizième", "quatorzième", "quinzième",
|
|
|
|
"seizième", "dix-septième", "dix-huitième",
|
|
|
|
"dix-neuvième", "vingtième", "vingt-et-unième",
|
|
|
|
"vingt-deuxième", "vingt-troisième",
|
|
|
|
"vingt-quatrième", "vingt-cinquième",
|
|
|
|
"vingt-sixième", "vingt-septième",
|
|
|
|
"vingt-huitième", "vingt-neuvième",
|
|
|
|
"trentième", "trente-et-unième",
|
|
|
|
"trente-deuxième", "trente-troisième",
|
|
|
|
"trente-quatrième", "trente-cinquième",
|
|
|
|
"trente-sixième", "trente-septième",
|
|
|
|
"trente-huitième", "trente-neuvième",
|
|
|
|
"quarantième", "quanrante-et-unième", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-30 00:54:01 +05:30
|
|
|
# listes volontairement limitées | small lists, use generation level if > [5]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-11-01 22:52:07 +05:30
|
|
|
_father_level = [ "", "le père%s", "le grand-père%s",
|
|
|
|
"l'arrière-grand-père%s", "le trisaïeul%s", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-11-01 22:52:07 +05:30
|
|
|
_mother_level = [ "", "la mère%s", "la grand-mère%s",
|
|
|
|
"l'arrière-grand-mère%s", "la trisaïeule%s", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-11-11 16:57:29 +05:30
|
|
|
_son_level = [ "", "le fils%s", "le petit-fils%s", "l'arrière-petit-fils%s", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-11-11 16:57:29 +05:30
|
|
|
_daughter_level = [ "", "la fille%s", "la petite-fille%s",
|
|
|
|
"l'arrière-petite-fille%s", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-31 20:51:12 +05:30
|
|
|
_sister_level = [ "", "la sœur%s", "la tante%s", "la grand-tante%s",
|
|
|
|
"l'arrière-grand-tante%s", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-31 20:51:12 +05:30
|
|
|
_brother_level = [ "", "le frère%s", "l'oncle%s", "le grand-oncle%s",
|
|
|
|
"l'arrière-grand-oncle%s", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-11-11 16:57:29 +05:30
|
|
|
_nephew_level = [ "", "le neveu%s%s", "le petit-neveu%s%s",
|
|
|
|
"l'arrière-petit-neveu%s%s", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-11-11 16:57:29 +05:30
|
|
|
_niece_level = [ "", "la nièce%s%s", "la petite-nièce%s%s",
|
|
|
|
"l'arrière-petite-nièce%s%s", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
|
|
|
# kinship report
|
|
|
|
|
2007-10-30 15:46:20 +05:30
|
|
|
_parents_level = [ "", "les parents", "les grands-parents",
|
|
|
|
"les arrières-grands-parents", "les trisaïeux", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-30 15:46:20 +05:30
|
|
|
_children_level = [ "", "les enfants", "les petits-enfants",
|
|
|
|
"les arrières-petits-enfants",
|
|
|
|
"les arrières-arrières-petits-enfants", ]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-11-01 22:52:07 +05:30
|
|
|
_siblings_level = [ "", "les frères et les sœurs",
|
|
|
|
"les oncles et les tantes",
|
2007-10-30 15:46:20 +05:30
|
|
|
"les grands-oncles et les grands-tantes",
|
|
|
|
"les arrières-grands-oncles et les arrières-grands-tantes",
|
|
|
|
]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-11-01 22:52:07 +05:30
|
|
|
_nephews_nieces_level = [ "", "les neveux et les nièces",
|
|
|
|
"les petits-neveux et les petites-nièces",
|
|
|
|
"les arrière-petits-neveux et les arrières-petites-nièces",
|
2007-10-30 15:46:20 +05:30
|
|
|
]
|
2007-09-08 03:47:14 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2007-10-27 00:22:55 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|
|
|
|
2007-11-11 16:57:29 +05:30
|
|
|
#sibling strings
|
|
|
|
STEP = ''
|
|
|
|
HALF = 'demi-'
|
|
|
|
|
|
|
|
INLAW = ' (par alliance)'
|
|
|
|
|
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
def __init__(self):
|
|
|
|
Relationship.RelationshipCalculator.__init__(self)
|
|
|
|
|
2007-11-01 22:52:07 +05:30
|
|
|
# de la personne active à l'ascendant commun Ga=[level] pour
|
|
|
|
# le calculateur de relations
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-31 16:49:33 +05:30
|
|
|
def get_cousin(self, level, removed, dir = '', step='', inlaw=''):
|
|
|
|
if removed == 0 and level < len(_level_name):
|
|
|
|
return "le %s cousin%s%s" % (_removed_level[level-1],
|
|
|
|
step, inlaw)
|
2007-09-08 03:47:14 +05:30
|
|
|
elif (level) < (removed):
|
2007-10-31 16:49:33 +05:30
|
|
|
rel_str = self.get_uncle(Ga, inlaw)
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-10-31 16:49:33 +05:30
|
|
|
# limitation gen = 29
|
2007-10-30 15:46:20 +05:30
|
|
|
return "le cousin éloigné, relié à la %s génération" % (
|
|
|
|
_level_name[removed])
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-31 16:49:33 +05:30
|
|
|
def get_cousine(self, level, removed, dir = '', step='', inlaw=''):
|
|
|
|
if removed == 0 and level < len(_level_name):
|
2007-11-06 21:12:54 +05:30
|
|
|
return "la %s cousine%s%s" % (_level_name[level-1],
|
|
|
|
step, inlaw)
|
2007-09-08 03:47:14 +05:30
|
|
|
elif (level) < (removed):
|
2007-10-31 16:49:33 +05:30
|
|
|
rel_str = self.get_aunt(Ga, inlaw)
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-10-30 15:46:20 +05:30
|
|
|
return "la cousine éloignée, reliée à la %s génération" % (
|
|
|
|
_level_name[removed])
|
2007-09-08 03:47:14 +05:30
|
|
|
|
|
|
|
def get_parents(self, level):
|
|
|
|
if level > len(_parents_level)-1:
|
2007-10-30 15:46:20 +05:30
|
|
|
return "les ascendants éloignés, à la %s génération" % (
|
|
|
|
_level_name[level])
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
|
|
|
return _parents_level[level]
|
|
|
|
|
2007-10-31 20:51:12 +05:30
|
|
|
def get_father(self, level, inlaw=''):
|
2007-09-08 03:47:14 +05:30
|
|
|
if level > len(_father_level)-1:
|
2007-11-01 22:52:07 +05:30
|
|
|
return "l'ascendant éloigné, à la %s génération" % (
|
|
|
|
_level_name[level])
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-10-31 20:51:12 +05:30
|
|
|
return _father_level[level] % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-31 20:51:12 +05:30
|
|
|
def get_mother(self, level, inlaw=''):
|
|
|
|
if level > len(_mother_level)-1:
|
2007-11-01 22:52:07 +05:30
|
|
|
return "l'ascendante éloignée, à la %s génération" % (
|
|
|
|
_level_name[level])
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-10-31 20:51:12 +05:30
|
|
|
return _mother_level[level] % inlaw
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-31 20:51:12 +05:30
|
|
|
def get_parent_unknown(self, level, inlaw=''):
|
|
|
|
if level > len(_level_name)-1:
|
2007-11-01 22:52:07 +05:30
|
|
|
return "l'ascendant éloigné, à la %s génération" % (
|
|
|
|
_level_name[level])
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
return "un parent éloigné%s" % (inlaw)
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-11-11 16:57:29 +05:30
|
|
|
def get_son(self, level, step='', inlaw=''):
|
2007-10-31 20:51:12 +05:30
|
|
|
if level > len(_son_level)-1:
|
2007-11-01 22:52:07 +05:30
|
|
|
return "le descendant éloigné, à la %s génération" % (
|
|
|
|
_level_name[level+1])
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
return _son_level[level] % (inlaw)
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-11-11 16:57:29 +05:30
|
|
|
def get_daughter(self, level, step='', inlaw=''):
|
2007-10-31 20:51:12 +05:30
|
|
|
if level > len(_daughter_level)-1:
|
2007-11-01 22:52:07 +05:30
|
|
|
return "la descendante éloignée, à la %s génération" % (
|
|
|
|
_level_name[level+1])
|
2007-10-30 23:57:47 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
return _daughter_level[level] % (inlaw)
|
2007-10-30 23:57:47 +05:30
|
|
|
|
2007-11-11 16:57:29 +05:30
|
|
|
def get_child_unknown(self, level, step='', inlaw=''):
|
2007-10-31 16:49:33 +05:30
|
|
|
if level > len(_level_name)-1:
|
2007-11-01 22:52:07 +05:30
|
|
|
return "le descendant éloigné, à la %s génération" % (
|
|
|
|
_level_name[level+1])
|
2007-10-30 23:57:47 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
return "un descendant éloigné%s" % (inlaw)
|
|
|
|
|
|
|
|
def get_sibling_unknown(self, level, inlaw=''):
|
|
|
|
return "un parent éloigné%s" % (inlaw)
|
2007-10-30 23:57:47 +05:30
|
|
|
|
2007-10-31 20:51:12 +05:30
|
|
|
def get_uncle(self, level, step='', inlaw=''):
|
|
|
|
if level > len(_brother_level)-1:
|
2007-11-01 22:52:07 +05:30
|
|
|
return "l'oncle éloigné, relié à la %s génération" % (
|
|
|
|
_level_name[level])
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
return _brother_level[level] % (inlaw)
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-31 20:51:12 +05:30
|
|
|
def get_aunt(self, level, step='', inlaw=''):
|
|
|
|
if level > len(_sister_level)-1:
|
2007-11-01 22:52:07 +05:30
|
|
|
return "la tante éloignée, reliée à la %s génération" % (
|
|
|
|
_level_name[level])
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
return _sister_level[level] % (inlaw)
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-31 20:51:12 +05:30
|
|
|
def get_nephew(self, level, step='', inlaw=''):
|
2007-09-08 03:47:14 +05:30
|
|
|
if level > len(_nephew_level)-1:
|
2007-11-06 19:31:09 +05:30
|
|
|
return "le neveu éloigné, à la %s génération" % (
|
|
|
|
_level_name[level])
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
return _nephew_level[level] % (step, inlaw)
|
2007-09-08 03:47:14 +05:30
|
|
|
|
2007-10-31 20:51:12 +05:30
|
|
|
def get_niece(self, level, step='', inlaw=''):
|
2007-09-08 03:47:14 +05:30
|
|
|
if level > len(_niece_level)-1:
|
2007-11-06 19:31:09 +05:30
|
|
|
return "la nièce éloignée, à la %s génération" % (
|
|
|
|
_level_name[level])
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
return _niece_level[level] % (step, 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
|
|
|
"""
|
|
|
|
rel_str = "des parents éloignés"
|
2007-11-01 22:52:07 +05:30
|
|
|
gen = " à la %sème génération"
|
|
|
|
bygen = " par la %sème génération"
|
|
|
|
cmt = " (frères ou sœurs d'un ascendant" + gen % (
|
|
|
|
Ga) + ")"
|
2007-09-08 03:47:14 +05:30
|
|
|
if Ga == 0:
|
|
|
|
# These are descendants
|
|
|
|
if Gb < len(_children_level):
|
|
|
|
rel_str = _children_level[Gb]
|
|
|
|
else:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "les descendants" + gen % (
|
|
|
|
Gb+1)
|
2007-09-08 03:47:14 +05:30
|
|
|
elif Gb == 0:
|
|
|
|
# These are parents/grand parents
|
|
|
|
if Ga < len(_parents_level):
|
|
|
|
rel_str = _parents_level[Ga]
|
|
|
|
else:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "les ascendants" + gen % (
|
|
|
|
Ga+1)
|
2007-09-08 03:47:14 +05:30
|
|
|
elif Gb == 1:
|
|
|
|
# These are siblings/aunts/uncles
|
|
|
|
if Ga < len(_siblings_level):
|
|
|
|
rel_str = _siblings_level[Ga]
|
|
|
|
else:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "Les enfants d'un ascendant" + gen % (
|
|
|
|
Ga+1) + cmt
|
2007-09-08 03:47:14 +05:30
|
|
|
elif Ga == 1:
|
|
|
|
# These are nieces/nephews
|
|
|
|
if Gb < len(_nephews_nieces_level):
|
2007-11-06 19:31:09 +05:30
|
|
|
rel_str = _nephews_nieces_level[Gb-1]
|
2007-09-08 03:47:14 +05:30
|
|
|
else:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "les neveux et les nièces" + gen % (
|
|
|
|
Gb)
|
2007-09-08 03:47:14 +05:30
|
|
|
elif Ga > 1 and Ga == Gb:
|
|
|
|
# These are cousins in the same generation
|
|
|
|
# use custom level for latin words
|
|
|
|
if Ga == 2:
|
|
|
|
rel_str = "les cousins germains et cousines germaines"
|
2007-11-01 22:52:07 +05:30
|
|
|
elif Ga <= len(_level_name):
|
|
|
|
rel_str = "les %ss cousins et cousines" % _level_name[Ga-2]
|
2007-09-08 03:47:14 +05:30
|
|
|
# security
|
|
|
|
else:
|
|
|
|
rel_str = "les cousins et cousines"
|
|
|
|
elif Ga > 1 and Ga > Gb:
|
|
|
|
# These are cousins in different generations with the second person
|
|
|
|
# being in a higher generation from the common ancestor than the
|
|
|
|
# first person.
|
|
|
|
# use custom level for latin words and specific relation
|
|
|
|
if Ga == 3 and Gb == 2:
|
2007-11-01 22:52:07 +05:30
|
|
|
desc = " (cousins germains d'un parent)"
|
|
|
|
rel_str = "les oncles et tantes à la mode de Bretagne" + desc
|
|
|
|
elif Gb <= len(_level_name) and (Ga-Gb) < len(_removed_level) and (Ga+Gb+1) < len(_removed_level):
|
|
|
|
can = " du %s au %s degré (canon)" % (
|
|
|
|
_removed_level[Gb], _removed_level[Ga] )
|
|
|
|
civ = " et au %s degré (civil)" % ( _removed_level[Ga+Gb+1] )
|
|
|
|
rel_str = "les oncles et tantes" + can + civ
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Ga < len(_level_name):
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "les grands-oncles et grands-tantes" + bygen % (
|
|
|
|
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:
|
|
|
|
# These are cousins in different generations with the second person
|
|
|
|
# being in a lower generation from the common ancestor than the
|
|
|
|
# first person.
|
|
|
|
# use custom level for latin words and specific relation
|
|
|
|
if Ga == 2 and Gb == 3:
|
2007-11-01 22:52:07 +05:30
|
|
|
info = " (cousins issus d'un germain)"
|
|
|
|
rel_str = "les neveux et nièces à la mode de Bretagne" + info
|
|
|
|
elif Ga <= len(_level_name) and (Gb-Ga) < len(_removed_level) and (Ga+Gb+1) < len(_removed_level):
|
|
|
|
can = " du %s au %s degré (canon)" % (
|
|
|
|
_removed_level[Gb], _removed_level[Ga] )
|
|
|
|
civ = " et au %s degré (civil)" % ( _removed_level[Ga+Gb+1] )
|
|
|
|
rel_str = "les neveux et nièces" + can + civ
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Ga < len(_level_name):
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "les neveux et nièces" + bygen % (
|
|
|
|
Gb)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
|
|
|
return rel_str
|
|
|
|
return rel_str
|
|
|
|
|
2007-11-06 21:12:54 +05:30
|
|
|
|
2007-10-29 21:50:24 +05:30
|
|
|
# quick report /RelCalc tool
|
2007-10-27 00:22:55 +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-29 21:50:24 +05:30
|
|
|
voir Relationship.py
|
2007-10-27 00:22:55 +05:30
|
|
|
"""
|
2007-10-29 21:50:24 +05:30
|
|
|
## print 'Ga, Gb :', Ga, Gb
|
|
|
|
|
|
|
|
if only_birth:
|
2007-11-06 21:12:54 +05:30
|
|
|
step = ''
|
|
|
|
#if birthfather == None and birthmother != None:
|
|
|
|
#step = ' utérin'
|
|
|
|
#elif birthmother == None and birthfather != None:
|
|
|
|
#step = ' consanguin'
|
2007-10-29 21:50:24 +05:30
|
|
|
else:
|
2007-11-11 16:57:29 +05:30
|
|
|
step = self.STEP
|
2007-10-29 21:50:24 +05:30
|
|
|
|
2007-11-06 21:12:54 +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:
|
|
|
|
inlaw = ''
|
2007-10-29 21:50:24 +05:30
|
|
|
|
2007-11-11 16:57:29 +05:30
|
|
|
half = self.HALF
|
|
|
|
|
2007-11-06 21:12:54 +05:30
|
|
|
rel_str = "un parent%s éloigné%s" % (step, inlaw)
|
2007-11-01 22:52:07 +05:30
|
|
|
bygen = " par la %sème génération"
|
2007-10-27 00:22:55 +05:30
|
|
|
if Ga == 0:
|
|
|
|
# b is descendant of a
|
|
|
|
if Gb == 0 :
|
|
|
|
rel_str = 'le même individu'
|
|
|
|
elif gender_b == gen.lib.Person.MALE and Gb < len(_son_level):
|
2007-10-31 16:49:33 +05:30
|
|
|
rel_str = self.get_son(Gb, step)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE and Gb < len(_daughter_level):
|
2007-10-31 16:49:33 +05:30
|
|
|
rel_str = self.get_daughter(Gb, step)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Gb < len(_level_name) and gender_b == gen.lib.Person.MALE:
|
2007-11-06 21:12:54 +05:30
|
|
|
rel_str = "le descendant éloigné%s (%dème génération)" % (
|
|
|
|
step, Gb+1)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Gb < len(_level_name) and gender_b == gen.lib.Person.FEMALE:
|
2007-11-06 21:12:54 +05:30
|
|
|
rel_str = "la descendante éloignée%s (%dème génération)" % (
|
|
|
|
step, Gb+1)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
2007-10-31 16:49:33 +05:30
|
|
|
return self.get_child_unknown(Gb, step)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Gb == 0:
|
|
|
|
# b is parents/grand parent of a
|
|
|
|
if gender_b == gen.lib.Person.MALE and Ga < len(_father_level):
|
2007-10-31 16:49:33 +05:30
|
|
|
rel_str = self.get_father(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE and Ga < len(_mother_level):
|
2007-10-31 16:49:33 +05:30
|
|
|
rel_str = self.get_mother(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Ga < len(_level_name) and gender_b == gen.lib.Person.MALE:
|
2007-11-06 21:12:54 +05:30
|
|
|
rel_str = "l'ascendant éloigné%s (%dème génération)" % (
|
|
|
|
inlaw, Ga+1)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif Ga < len(_level_name) and gender_b == gen.lib.Person.FEMALE:
|
2007-11-06 21:12:54 +05:30
|
|
|
rel_str = "l'ascendante éloignée%s (%dème génération)" % (
|
|
|
|
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:
|
|
|
|
# b is sibling/aunt/uncle of a
|
|
|
|
if gender_b == gen.lib.Person.MALE and Ga < len(_brother_level):
|
2007-10-31 20:51:12 +05:30
|
|
|
rel_str = self.get_uncle(Ga, step, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE and Ga < len(_sister_level):
|
2007-10-31 20:51:12 +05:30
|
|
|
rel_str = self.get_aunt(Ga, step, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "l'oncle éloigné" + bygen % (
|
|
|
|
Ga+1)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "la tante éloignée" + bygen % (
|
|
|
|
Ga+1)
|
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
|
|
|
|
elif Ga == 1:
|
|
|
|
# b is niece/nephew of a
|
|
|
|
if gender_b == gen.lib.Person.MALE and Gb < len(_nephew_level):
|
2007-10-31 20:51:12 +05:30
|
|
|
rel_str = self.get_nephew(Gb-1, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE and Gb < len(_niece_level):
|
2007-10-31 20:51:12 +05:30
|
|
|
rel_str = self.get_niece(Gb-1, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2007-11-06 21:12:54 +05:30
|
|
|
rel_str = "le neveu éloigné%s (%dème génération)" % (
|
|
|
|
inlaw, Gb)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2007-11-06 21:12:54 +05:30
|
|
|
rel_str = "la nièce éloignée%s (%dème génération)" % (
|
|
|
|
inlaw, Gb)
|
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-10-31 16:49:33 +05:30
|
|
|
elif Ga == Gb:
|
2007-10-27 00:22:55 +05:30
|
|
|
# a and b cousins in the same generation
|
2007-10-31 16:49:33 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
|
|
|
rel_str = self.get_cousin(Ga-1, 0, dir = '', step=step,
|
|
|
|
inlaw=inlaw)
|
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
|
|
|
rel_str = self.get_cousine(Ga-1, 0, dir = '', step=step,
|
|
|
|
inlaw=inlaw)
|
2007-11-11 16:57:29 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
|
|
|
rel_str = self.get_sibling_unknown(Ga-1, 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:
|
|
|
|
# These are cousins in different generations with the second person
|
|
|
|
# being in a higher generation from the common ancestor than the
|
|
|
|
# first person.
|
|
|
|
if Ga == 3 and Gb == 2:
|
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
desc = " (cousin germain d'un parent)"
|
|
|
|
rel_str = "l'oncle à la mode de Bretagne" + desc
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
desc = " (cousine germaine d'un parent)"
|
|
|
|
rel_str = "la tante à la mode de Bretagne" + desc
|
2007-11-11 16:57:29 +05:30
|
|
|
elif gender_b == gen.lib.Person.UNKNOWN:
|
|
|
|
return self.get_sibling_unknown(Ga, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
else:
|
|
|
|
return rel_str
|
2007-11-01 22:52:07 +05:30
|
|
|
elif Gb <= len(_level_name) and (Ga-Gb) < len(_removed_level) and (Ga+Gb+1) < len(_removed_level):
|
|
|
|
can = " du %s au %s degré (canon)" % (
|
|
|
|
_removed_level[Gb], _removed_level[Ga] )
|
|
|
|
civ = " et au %s degré (civil)" % ( _removed_level[Ga+Gb+1] )
|
2007-10-27 00:22:55 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "l'oncle" + can + civ
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "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:
|
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2007-10-31 20:51:12 +05:30
|
|
|
rel_str = self.get_uncle(Ga, step, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2007-10-31 20:51:12 +05:30
|
|
|
rel_str = self.get_aunt(Ga, step, 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:
|
|
|
|
return rel_str
|
|
|
|
elif Gb > 1 and Gb > Ga:
|
|
|
|
# These are cousins in different generations with the second person
|
|
|
|
# being in a lower generation from the common ancestor than the
|
|
|
|
# first person.
|
|
|
|
if Ga == 2 and Gb == 3:
|
2007-11-01 22:52:07 +05:30
|
|
|
info = " (cousins issus d'un germain)"
|
2007-10-27 00:22:55 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "le neveu à la mode de Bretagne" + info
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b == gen.lib.Person.FEMALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "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:
|
2007-11-11 16:57:29 +05:30
|
|
|
return rel_str
|
2007-11-01 22:52:07 +05:30
|
|
|
elif Ga <= len(_level_name) and (Gb-Ga) < len(_removed_level) and (Ga+Gb+1) < len(_removed_level):
|
|
|
|
can = " du %s au %s degré (canon)" % (
|
|
|
|
_removed_level[Gb], _removed_level[Ga] )
|
|
|
|
civ = " et au %s degré (civil)" % ( _removed_level[Ga+Gb+1] )
|
2007-10-27 00:22:55 +05:30
|
|
|
if gender_b == gen.lib.Person.MALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "le neveu" + can + civ
|
2007-10-27 00:22:55 +05:30
|
|
|
if gender_b == gen.lib.Person.FEMALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = "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
|
2007-09-08 03:47:14 +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-01 22:52:07 +05:30
|
|
|
rel_str = self.get_nephew(Ga, step, inlaw)
|
2007-10-27 00:22:55 +05:30
|
|
|
elif gender_b ==gen.lib.Person.FEMALE:
|
2007-11-01 22:52:07 +05:30
|
|
|
rel_str = self.get_niece(Ga, step, 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
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Register this class with the Plugins system
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2007-10-30 15:46:20 +05:30
|
|
|
|
2007-09-08 03:47:14 +05:30
|
|
|
register_relcalc(RelationshipCalculator,
|
2007-10-30 15:46:20 +05:30
|
|
|
["fr", "FR", "fr_FR", "fr_CA", "francais", "Francais", "fr_FR.UTF8",
|
|
|
|
"fr_FR@euro", "fr_FR.UTF8@euro",
|
|
|
|
"french","French", "fr_FR.UTF-8", "fr_FR.utf-8", "fr_FR.utf8",
|
|
|
|
"fr_CA.UTF-8"])
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
# Test function. Call it as follows from the command line (so as to find
|
|
|
|
# imported modules):
|
2007-11-17 02:57:42 +05:30
|
|
|
# export PYTHONPATH=/path/to/gramps/src
|
|
|
|
# python src/plugins/rel_fr.py
|
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:
|
|
|
|
python src/plugins/rel_xx.py
|
|
|
|
"""
|
|
|
|
from Relationship import test
|
|
|
|
rc = RelationshipCalculator()
|
|
|
|
test(rc, True)
|