2007-10-13 15:37:28 +05:30
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
|
|
|
# Copyright (C) 2003-2005 Donald N. Allingham
|
2008-05-19 00:54:28 +05:30
|
|
|
# Copyright (C) 2008 Brian G. Matherly
|
2010-12-05 23:00:17 +05:30
|
|
|
# Copyright (C) 2010 lcc & Robert Jerome
|
2007-10-13 15:37:28 +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
|
|
|
|
#
|
|
|
|
|
|
|
|
# Portuguese version by Duarte Loreto <happyguy_pt@hotmail.com>, 2007.
|
|
|
|
# Based on the Spanish version by Julio Sanchez <julio.sanchez@gmail.com>
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
# $Id:rel_pt.py 9912 2008-01-22 09:17:46Z acraphae $
|
2010-01-08 21:40:54 +05:30
|
|
|
"""
|
|
|
|
Specific classes for relationships.
|
|
|
|
"""
|
2007-10-13 15:37:28 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2007-11-19 05:09:14 +05:30
|
|
|
import gen.lib
|
2007-10-13 15:37:28 +05:30
|
|
|
import Relationship
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
_level_name_male = [ "", "primeiro", "segundo", "terceiro", "quarto", "quinto",
|
|
|
|
"sexto", "sétimo", "oitavo", "nono", "décimo", "décimo-primeiro",
|
|
|
|
"décimo-segundo", "décimo-terceiro", "décimo-quarto", "décimo-quinto",
|
|
|
|
"décimo-sexto", "décimo-sétimo", "décimo-oitavo", "décimo-nono",
|
2010-12-05 23:00:17 +05:30
|
|
|
"vigésimo"]
|
2007-10-13 15:37:28 +05:30
|
|
|
|
|
|
|
# Short forms (in apocope) used before names
|
|
|
|
_level_name_male_a = [ "", "primeiro", "segundo", "terceiro", "quarto", "quinto",
|
|
|
|
"sexto", "sétimo", "oitavo", "nono", "décimo", "décimo-primeiro",
|
|
|
|
"décimo-segundo", "décimo-terceiro", "décimo-quarto", "décimo-quinto",
|
|
|
|
"décimo-sexto", "décimo-sétimo", "décimo-oitavo", "décimo-nono",
|
|
|
|
"vigésimo"]
|
|
|
|
|
|
|
|
_level_name_female = [ "", "primeira", "segunda", "terceira", "quarta", "quinta",
|
|
|
|
"sexta", "sétima", "oitava", "nona", "décima", "décima-primeira",
|
|
|
|
"décima-segunda", "décima-terceira", "décima-quarta", "décima-quinta",
|
|
|
|
"décima-sexta", "décima-sétima", "décima-oitava", "décima-nona",
|
|
|
|
"vigésima"]
|
|
|
|
|
|
|
|
_level_name_plural = [ "", "primeiros", "segundos", "terceiros", "quartos",
|
|
|
|
"quintos", "sextos", "sétimos", "oitavos", "nonos",
|
|
|
|
"décimos", "décimos-primeiros", "décimos-segundos", "décimos-terceiros",
|
|
|
|
"décimos-quartos", "décimos-quintos", "décimos-sextos",
|
|
|
|
"décimos-sétimos", "décimos-oitavos", "décimos-nonos",
|
2010-12-05 23:00:17 +05:30
|
|
|
"vigésimos"]
|
2007-10-13 15:37:28 +05:30
|
|
|
|
|
|
|
# This plugin tries to be flexible and expect little from the following
|
|
|
|
# tables. Ancestors are named from the list for the first generations.
|
|
|
|
# When this list is not enough, ordinals are used based on the same idea,
|
|
|
|
# i.e. bisavô is 'segundo avô' and so on, that has been the
|
|
|
|
# traditional way in Portuguese. When we run out of ordinals we resort to
|
|
|
|
# Nº notation, that is sort of understandable if in context.
|
2011-01-22 22:17:26 +05:30
|
|
|
# There is a specificity for pt_BR where they can use "tataravô" instead
|
|
|
|
# of "tetravô", being both forms correct for pt_BR but just "tetravô"
|
2007-10-13 15:37:28 +05:30
|
|
|
# correct for pt. Translation keeps "tetravô".
|
|
|
|
_parents_level = [ "", "pais", "avós", "bisavós", "trisavós",
|
2010-12-05 23:00:17 +05:30
|
|
|
"tetravós", "pentavós", "hexavós", "heptavós", "octavós"]
|
2007-10-13 15:37:28 +05:30
|
|
|
|
|
|
|
_father_level = [ "", "pai", "avô", "bisavô", "trisavô",
|
2010-12-05 23:00:17 +05:30
|
|
|
"tetravô", "pentavô", "hexavô", "heptavô", "octavô"]
|
2007-10-13 15:37:28 +05:30
|
|
|
|
|
|
|
_mother_level = [ "", "mãe", "avó", "bisavó", "trisavó",
|
2010-12-05 23:00:17 +05:30
|
|
|
"tetravó", "pentavó", "hexavó", "heptavó", "octovó"]
|
2007-10-13 15:37:28 +05:30
|
|
|
|
|
|
|
# Higher-order terms (after "tetravô") are not standard in Portuguese.
|
|
|
|
# Check http://www.geneall.net/P/forum_msg.php?id=136774 that states
|
|
|
|
# that although some people may use other greek-prefixed forms for
|
|
|
|
# higher levels, both pt and pt_BR correct form is to use, after
|
|
|
|
# "tetravô", the "quinto avô", "sexto avô", etc.
|
|
|
|
|
|
|
|
_son_level = [ "", "filho", "neto", "bisneto",
|
2010-12-05 23:00:17 +05:30
|
|
|
"trineto", "tretaneto", "pentaneto", "hexaneto", "heptaneto", "octaneto"]
|
2007-10-13 15:37:28 +05:30
|
|
|
|
|
|
|
_daughter_level = [ "", "filha", "neta", "bisneta",
|
2010-12-05 23:00:17 +05:30
|
|
|
"trineta", "tretaneta", "pentaneta", "hexaneta", "heptaneta", "octaneta"]
|
|
|
|
|
2011-01-22 22:17:26 +05:30
|
|
|
_sister_level = [ "", "irmã", "tia", "tia avó", "tia bisavó", "tia trisavó", "tia tetravó",
|
2010-12-05 23:00:17 +05:30
|
|
|
"tia pentavó", "tia hexavó", "tia heptavó", "tia octovó"]
|
|
|
|
|
|
|
|
_brother_level = [ "", "irmão", "tio", "tio avô", "tio bisavô", "tio trisavô",
|
|
|
|
"tio tetravô", "tio pentavô", "tio hexavô", "tio heptavô", "tio octavô"]
|
|
|
|
|
2011-01-22 22:17:26 +05:30
|
|
|
_nephew_level = [ "", "sobrinho", "sobrinho neto", "sobrinho bisneto", "sobrinho trineto",
|
|
|
|
"sobrinho tetraneto", "sobrinho pentaneto", "sobrinho hexaneto",
|
2010-12-05 23:00:17 +05:30
|
|
|
"sobrinho heptaneto", "sobrinho octaneto"]
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2011-01-22 22:17:26 +05:30
|
|
|
_niece_level = [ "", "sobrinha", "sobrinha neta", "sobrinha bisneta", "sobrinha trineta",
|
|
|
|
"sobrinha tetraneta", "sobrinha pentaneta", "sobrinha hexaneta",
|
2010-12-05 23:00:17 +05:30
|
|
|
"sobrinha heptaneta", "sobrinha octaneta"]
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2010-12-05 23:00:17 +05:30
|
|
|
# Relatório de Parentesco
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2011-01-22 22:17:26 +05:30
|
|
|
_PARENTS_LEVEL = [u"", u"pais", u"avós", u"bisavós", u"tetravós",
|
2010-12-05 23:00:17 +05:30
|
|
|
u"pentavós", u"hexavós", u"heptavós", u"octavós"]
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2011-01-22 22:17:26 +05:30
|
|
|
_CHILDREN_LEVEL = [u"", u"filhos", u"netos", u"bisnetos", u"trinetos",
|
2010-12-05 23:00:17 +05:30
|
|
|
u"tetranetos", u"pentanetos", u"hexanetos", u"heptanetos"
|
|
|
|
u"octanetos"]
|
|
|
|
|
|
|
|
_SIBLINGS_LEVEL = [u"", u"irmãos e irmães", u"tios e tias",u"tios avôs e tias avós",
|
|
|
|
u"tios bisavôs e tias bisavós", u"tios trisavôs e tias trisavós",
|
|
|
|
u"tios tetravôs e tias tetravós", u"tios pentavôs e tias pentavós",
|
|
|
|
u"tios hexavôs e tias hexavós", u"tios heptavôs e tias heptavós"
|
|
|
|
u"tios octavôs e tias octavós"]
|
|
|
|
|
|
|
|
_NEPHEWS_NIECES_LEVEL = [u"", u"sobrinhos e sobrinhas",
|
|
|
|
u"sobrinhos netos e sobrinhas netas",
|
|
|
|
u"sobrinhos bisnetos e sobrinhas bisnetas",
|
|
|
|
u"sobrinhos trinetos e sobrinhas trinetas"
|
|
|
|
u"sobrinhos tetranetos e sobrinhas tetranetas"
|
|
|
|
u"sobrinhos pentanetos e sobrinhas pentanetas"
|
|
|
|
u"sobrinhos hexanetos e sobrinhas hexanetas"
|
|
|
|
u"sobrinhos heptanetos e sobrinhas heptanetas"
|
|
|
|
u"sobrinhos octanetos e sobrinhas octanetas"
|
|
|
|
]
|
2007-10-13 15:37:28 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
2010-01-08 21:40:54 +05:30
|
|
|
"""
|
|
|
|
RelationshipCalculator Class
|
|
|
|
"""
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2008-08-14 14:54:58 +05:30
|
|
|
def __init__(self):
|
|
|
|
Relationship.RelationshipCalculator.__init__(self)
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_male_cousin(self, level):
|
|
|
|
if level < len(_level_name_male):
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%s primo" % (_level_name_male[level])
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%dº primo" % level
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_female_cousin(self, level):
|
|
|
|
if level < len(_level_name_female):
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%s prima" % (_level_name_female[level])
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%dª prima" % level
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_distant_uncle(self, level):
|
|
|
|
if level < len(_level_name_male):
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%s tio" % (_level_name_male[level])
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%dº tio" % level
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_distant_aunt(self, level):
|
|
|
|
if level < len(_level_name_female):
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%s tia" % (_level_name_female[level])
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%dª tia" % level
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_distant_nephew(self, level):
|
|
|
|
if level < len(_level_name_male):
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%s sobrinho" % (_level_name_male[level])
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%dº sobrinho" % level
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2010-01-10 22:02:57 +05:30
|
|
|
def get_distant_niece(self, level):
|
2010-01-08 21:40:54 +05:30
|
|
|
if level < len(_level_name_female):
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%s sobrinha" % (_level_name_female[level])
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2011-01-22 22:17:26 +05:30
|
|
|
return "%dª sobrinha" % level
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_male_relative(self, level1, level2):
|
|
|
|
if level1 < len(_level_name_male_a):
|
2007-10-13 15:37:28 +05:30
|
|
|
level1_str = _level_name_male_a[level1]
|
|
|
|
else:
|
|
|
|
level1_str = "%dº" % level1
|
2010-01-08 21:40:54 +05:30
|
|
|
if level2 < len(_level_name_male_a):
|
2007-10-13 15:37:28 +05:30
|
|
|
level2_str = _level_name_male_a[level2]
|
|
|
|
else:
|
|
|
|
level2_str = "%dº" % level2
|
|
|
|
level = level1 + level2
|
2010-01-08 21:40:54 +05:30
|
|
|
if level < len(_level_name_male_a):
|
2007-10-13 15:37:28 +05:30
|
|
|
level_str = _level_name_male_a[level]
|
|
|
|
else:
|
|
|
|
level_str = "%dº" % level
|
2010-01-08 21:40:54 +05:30
|
|
|
return "parente em %s grau (%s com %s)" % (level_str, level1_str, level2_str)
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_female_relative(self, level1, level2):
|
|
|
|
return self.get_male_relative(level1, level2)
|
2007-10-13 15:37:28 +05:30
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_parents(self, level):
|
|
|
|
if level < len(_parents_level):
|
2007-10-13 15:37:28 +05:30
|
|
|
return _parents_level[level]
|
2010-01-08 21:40:54 +05:30
|
|
|
elif (level-1) < len(_level_name_plural):
|
2007-10-13 15:37:28 +05:30
|
|
|
return "%s avós" % (_level_name_plural[level-1])
|
|
|
|
else:
|
|
|
|
return "%dº avós" % (level-1)
|
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_father(self, level):
|
|
|
|
if level < len(_father_level):
|
2007-10-13 15:37:28 +05:30
|
|
|
return _father_level[level]
|
2010-01-08 21:40:54 +05:30
|
|
|
elif (level-1) < len(_level_name_male_a):
|
2007-10-13 15:37:28 +05:30
|
|
|
return "%s avô" % (_level_name_male_a[level-1])
|
|
|
|
else:
|
|
|
|
return "%dº avô" % (level-1)
|
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_son(self, level):
|
|
|
|
if level < len(_son_level):
|
2007-10-13 15:37:28 +05:30
|
|
|
return _son_level[level]
|
2010-01-08 21:40:54 +05:30
|
|
|
elif (level-1) < len(_level_name_male_a):
|
2007-10-13 15:37:28 +05:30
|
|
|
return "%s neto" % (_level_name_male_a[level-1])
|
|
|
|
else:
|
|
|
|
return "%dº neto" % (level-1)
|
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_mother(self, level):
|
|
|
|
if level < len(_mother_level):
|
2007-10-13 15:37:28 +05:30
|
|
|
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)
|
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_daughter(self, level):
|
|
|
|
if level < len(_daughter_level):
|
2007-10-13 15:37:28 +05:30
|
|
|
return _daughter_level[level]
|
2010-01-08 21:40:54 +05:30
|
|
|
elif (level-1) < len(_level_name_female):
|
2007-10-13 15:37:28 +05:30
|
|
|
return "%s neta" % (_level_name_female[level-1])
|
|
|
|
else:
|
|
|
|
return "%dª neta" % (level-1)
|
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_aunt(self, level):
|
|
|
|
if level < len(_sister_level):
|
2007-10-13 15:37:28 +05:30
|
|
|
return _sister_level[level]
|
2010-01-08 21:40:54 +05:30
|
|
|
elif (level-2) < len(_level_name_female):
|
2007-10-13 15:37:28 +05:30
|
|
|
return "%s tia avó" % (_level_name_female[level-2])
|
|
|
|
else:
|
|
|
|
return "%dª tia avó" % (level-2)
|
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_uncle(self, level):
|
|
|
|
if level < len(_brother_level):
|
2007-10-13 15:37:28 +05:30
|
|
|
return _brother_level[level]
|
2010-01-08 21:40:54 +05:30
|
|
|
elif (level-2) < len(_level_name_male_a):
|
2007-10-13 15:37:28 +05:30
|
|
|
return "%s tio avô" % (_level_name_male_a[level-2])
|
|
|
|
else:
|
|
|
|
return "%dº tio avô" % (level-2)
|
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_nephew(self, level):
|
|
|
|
if level < len(_nephew_level):
|
2007-10-13 15:37:28 +05:30
|
|
|
return _nephew_level[level]
|
2010-01-08 21:40:54 +05:30
|
|
|
elif (level-1) < len(_level_name_male_a):
|
2007-10-13 15:37:28 +05:30
|
|
|
return "%s sobrinho neto" % (_level_name_male_a[level-1])
|
|
|
|
else:
|
|
|
|
return "%dº sobrinho neto" % (level-1)
|
|
|
|
|
2010-01-08 21:40:54 +05:30
|
|
|
def get_niece(self, level):
|
|
|
|
if level < len(_niece_level):
|
2007-10-13 15:37:28 +05:30
|
|
|
return _niece_level[level]
|
2010-01-08 21:40:54 +05:30
|
|
|
elif (level-1) < len(_level_name_female):
|
2007-10-13 15:37:28 +05:30
|
|
|
return "%s sobrinha neta" % (_level_name_female[level-1])
|
|
|
|
else:
|
|
|
|
return "%dª sobrinha neta" % (level-1)
|
|
|
|
|
2010-01-10 22:02:57 +05:30
|
|
|
def get_relationship(self, secondRel, firstRel, orig_person_gender, other_person_gender):
|
2007-10-13 15:37:28 +05:30
|
|
|
"""
|
|
|
|
returns a string representing the relationshp between the two people,
|
2011-01-22 22:17:26 +05:30
|
|
|
along with a list of common ancestors (typically father, mother)
|
2007-10-13 15:37:28 +05:30
|
|
|
"""
|
|
|
|
|
2010-01-10 22:02:57 +05:30
|
|
|
common = ""
|
2007-10-13 15:37:28 +05:30
|
|
|
if firstRel == 0:
|
|
|
|
if secondRel == 0:
|
2010-01-08 21:40:54 +05:30
|
|
|
return ('', common)
|
2010-01-10 22:02:57 +05:30
|
|
|
elif other_person_gender == gen.lib.Person.MALE:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_father(secondRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_mother(secondRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
elif secondRel == 0:
|
2010-01-10 22:02:57 +05:30
|
|
|
if other_person_gender == gen.lib.Person.MALE:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_son(firstRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_daughter(firstRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
elif firstRel == 1:
|
2010-01-10 22:02:57 +05:30
|
|
|
if other_person_gender == gen.lib.Person.MALE:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_uncle(secondRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_aunt(secondRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
elif secondRel == 1:
|
2010-01-10 22:02:57 +05:30
|
|
|
if other_person_gender == gen.lib.Person.MALE:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_nephew(firstRel-1), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_niece(firstRel-1), common)
|
2008-06-16 20:31:46 +05:30
|
|
|
elif firstRel == secondRel == 2:
|
2010-01-10 22:02:57 +05:30
|
|
|
if other_person_gender == gen.lib.Person.MALE:
|
2010-01-08 21:40:54 +05:30
|
|
|
return ('primo irmão', common)
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2010-01-08 21:40:54 +05:30
|
|
|
return ('prima irmã', common)
|
2007-10-13 15:37:28 +05:30
|
|
|
elif firstRel == secondRel:
|
2010-01-10 22:02:57 +05:30
|
|
|
if other_person_gender == gen.lib.Person.MALE:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_male_cousin(firstRel-1), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_female_cousin(firstRel-1), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
elif firstRel == secondRel+1:
|
2010-01-10 22:02:57 +05:30
|
|
|
if other_person_gender == gen.lib.Person.MALE:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_distant_nephew(secondRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_distant_niece(secondRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
elif firstRel+1 == secondRel:
|
2010-01-10 22:02:57 +05:30
|
|
|
if other_person_gender == gen.lib.Person.MALE:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_distant_uncle(firstRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_distant_aunt(firstRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2010-01-10 22:02:57 +05:30
|
|
|
if other_person_gender == gen.lib.Person.MALE:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_male_relative(firstRel, secondRel), common)
|
2007-10-13 15:37:28 +05:30
|
|
|
else:
|
2010-01-08 21:40:54 +05:30
|
|
|
return (self.get_female_relative(firstRel, secondRel), common)
|
2010-01-05 19:12:23 +05:30
|
|
|
|
2010-01-10 22:02:57 +05:30
|
|
|
def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b,
|
|
|
|
reltocommon_a, reltocommon_b,
|
2011-01-22 22:17:26 +05:30
|
|
|
only_birth=True,
|
2010-01-10 22:02:57 +05:30
|
|
|
in_law_a=False, in_law_b=False):
|
|
|
|
return self.get_relationship(Ga, Gb, gender_a, gender_b)[0];
|
|
|
|
|
2011-01-22 22:17:26 +05:30
|
|
|
def get_sibling_relationship_string(self, sib_type, gender_a, gender_b,
|
2010-01-10 22:02:57 +05:30
|
|
|
in_law_a=False, in_law_b=False):
|
|
|
|
return self.get_relationship(1, 1, gender_a, gender_b)[0];
|
|
|
|
|
2010-12-05 23:00:17 +05:30
|
|
|
# Relatório de Parentesco
|
|
|
|
|
|
|
|
def get_plural_relationship_string(self, Ga, Gb,
|
|
|
|
reltocommon_a='', reltocommon_b='',
|
|
|
|
only_birth=True,
|
|
|
|
in_law_a=False, in_law_b=False):
|
|
|
|
"""
|
|
|
|
Cria o objeto KinshipReport que produz o relatório.
|
|
|
|
Os argumentos são:
|
|
|
|
database - a instância do banco de dados GRAMPS
|
|
|
|
options_class - instância da classe das opções para este relatório
|
|
|
|
O presente relatório tem os seguintes parâmetros (variáveis de classe)
|
|
|
|
que entram na classe de opções.
|
|
|
|
maxdescend - Máximo gerações de descendentes para incluir.
|
|
|
|
maxascend - Máximo de gerações ancestrais para incluir.
|
|
|
|
incspouses - Se deseja incluir cônjuges.
|
|
|
|
inccousins - Se deseja incluir primos.
|
|
|
|
incaunts - Se deseja incluir tios / sobrinhos.
|
|
|
|
pid - A identificação Gramps da pessoa central para o relatório.
|
|
|
|
|
|
|
|
Preenche um mapa das matrizes contendo os descendentes
|
|
|
|
da pessoa falecida. Esta função chama a si mesma recursivamente até
|
|
|
|
atingir max_descend.
|
|
|
|
Parâmetros:
|
|
|
|
person_handle: o identificador da próxima pessoa
|
|
|
|
Ga: O número de gerações, desde a pessoa principal até o ancestral
|
|
|
|
comum. É incrementado quando subir as gerações, e
|
|
|
|
deixado inalterado quando descer as gerações.
|
|
|
|
Gb: O número de gerações desta pessoa (person_handle) até o
|
|
|
|
ancestral comum. É incrementado quando descer as
|
|
|
|
gerações and posto a zero quando subir as gerações.
|
2011-01-22 22:17:26 +05:30
|
|
|
skip_handle: Identificador opcional para pular quando descer.
|
2010-12-05 23:00:17 +05:30
|
|
|
Isso é útil para pular o descendente que trouxe essa generação em primeiro lugar.
|
2011-01-22 22:17:26 +05:30
|
|
|
|
2010-12-05 23:00:17 +05:30
|
|
|
Preenche um mapa das matrizes contendo os ancestrais
|
|
|
|
da pessoa falecida. Esta função chama a si mesma recursivamente até
|
|
|
|
atingir max_ascend.
|
|
|
|
Parâmetros:
|
|
|
|
person_handle: o identificador da próxima pessoa
|
|
|
|
Ga: O número de gerações, desde a pessoa principal até o ancestral
|
|
|
|
comum. É incrementado quando subir as gerações, e
|
|
|
|
deixado inalterado quando descer as gerações.
|
|
|
|
Gb: O número de gerações desta pessoa (person_handle) até o
|
|
|
|
ancestral comum. É incrementado quando descer as
|
|
|
|
gerações and posto a zero quando subir as gerações.
|
|
|
|
"""
|
|
|
|
|
|
|
|
rel_str = "???"
|
|
|
|
|
|
|
|
if Ga == 0:
|
|
|
|
|
|
|
|
# These are descendants
|
|
|
|
|
|
|
|
if Gb < len(_CHILDREN_LEVEL):
|
|
|
|
rel_str = _CHILDREN_LEVEL[Gb]
|
|
|
|
else:
|
|
|
|
rel_str = u"descendentes"
|
|
|
|
elif Gb == 0:
|
|
|
|
|
|
|
|
# These are parents/grand parents
|
|
|
|
|
|
|
|
if Ga < len(_PARENTS_LEVEL):
|
|
|
|
rel_str = _PARENTS_LEVEL[Ga]
|
|
|
|
else:
|
|
|
|
rel_str = u"ancestrais"
|
|
|
|
elif Gb == 1:
|
|
|
|
|
|
|
|
# These are siblings/aunts/uncles
|
|
|
|
|
|
|
|
if Ga < len(_SIBLINGS_LEVEL):
|
|
|
|
rel_str = _SIBLINGS_LEVEL[Ga]
|
|
|
|
else:
|
|
|
|
rel_str = u"filhos dos ancestrais"
|
|
|
|
elif Ga == 1:
|
|
|
|
|
|
|
|
# These are nieces/nephews
|
|
|
|
|
|
|
|
if Gb < len(_NEPHEWS_NIECES_LEVEL):
|
|
|
|
rel_str = _NEPHEWS_NIECES_LEVEL[Gb - 1]
|
|
|
|
else:
|
|
|
|
rel_str = u"sobrinhos sobrinhas"
|
|
|
|
elif Ga > 1 and Ga == Gb:
|
|
|
|
|
|
|
|
# These are cousins in the same generation
|
|
|
|
|
|
|
|
if Ga == 2:
|
|
|
|
rel_str = u"primos primas"
|
|
|
|
elif Ga <= len(_level_name_plural):
|
|
|
|
rel_str = u"%s primos primas" % _level_name_plural[Ga -
|
|
|
|
2]
|
|
|
|
else:
|
|
|
|
|
|
|
|
# security
|
|
|
|
|
|
|
|
rel_str = u"primos primas"
|
2011-01-22 22:17:26 +05:30
|
|
|
|
2010-12-05 23:00:17 +05:30
|
|
|
if in_law_b == True:
|
2011-01-22 22:17:26 +05:30
|
|
|
rel_str = u"cônjuges dos %s" % rel_str
|
|
|
|
|
2010-12-05 23:00:17 +05:30
|
|
|
return rel_str
|
|
|
|
|
2010-01-05 19:12:23 +05:30
|
|
|
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_pt.py
|
|
|
|
# (Above not needed here)
|
|
|
|
|
2011-01-22 22:17:26 +05:30
|
|
|
"""TRANSLATORS, copy this if statement at the bottom of your
|
2010-01-05 19:12:23 +05:30
|
|
|
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)
|