2007-07-17 02:49:24 +05:30
|
|
|
|
# -*- coding: utf-8 -*-
|
2006-10-20 09:55:28 +05:30
|
|
|
|
#
|
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
|
#
|
2006-10-26 04:52:09 +05:30
|
|
|
|
# Copyright (C) 2003-2005 Donald N. Allingham
|
2006-10-20 09:55: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
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# Written by Piotr Czubaszek, largely based on rel_de.py by Alex Roitman.
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# GRAMPS modules
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
2007-10-08 22:11:39 +05:30
|
|
|
|
import gen.lib
|
2006-10-20 09:55:28 +05:30
|
|
|
|
import Relationship
|
|
|
|
|
import types
|
|
|
|
|
from gettext import gettext as _
|
|
|
|
|
from PluginUtils import register_relcalc
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# Polish-specific definitions of relationships
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
_father_level = [ "", "ojciec",
|
|
|
|
|
"dziadek",
|
|
|
|
|
"pradziadek",
|
|
|
|
|
"prapradziadek",
|
|
|
|
|
"praprapradziadek",
|
2007-01-07 13:10:51 +05:30
|
|
|
|
"prapraprapradziadek",
|
2006-10-20 09:55:28 +05:30
|
|
|
|
"praprapraprapradziadek",
|
|
|
|
|
"prapraprapraprapradziadek",
|
|
|
|
|
"praprapraprapraprapradziadek",
|
|
|
|
|
"prapraprapraprapraprapradziadek",
|
|
|
|
|
"praprapraprapraprapraprapradziadek",
|
|
|
|
|
"prapraprapraprapraprapraprapradziadek",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_mother_level = [ "", "matka",
|
|
|
|
|
"babcia",
|
|
|
|
|
"prababcia",
|
|
|
|
|
"praprababcia",
|
2007-01-07 13:10:51 +05:30
|
|
|
|
"prapraprababcia",
|
|
|
|
|
"praprapraprababcia",
|
2006-10-20 09:55:28 +05:30
|
|
|
|
"prapraprapraprababcia",
|
|
|
|
|
"praprapraprapraprababcia",
|
|
|
|
|
"prapraprapraprapraprababcia",
|
|
|
|
|
"praprapraprapraprapraprababcia",
|
|
|
|
|
"prapraprapraprapraprapraprababcia",
|
|
|
|
|
"praprapraprapraprapraprapraprababcia",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_son_level = [ "", "syn",
|
2007-01-07 13:10:51 +05:30
|
|
|
|
"wnuk",
|
|
|
|
|
"prawnuk",
|
|
|
|
|
"praprawnuk",
|
|
|
|
|
"prapraprauwnuk",
|
|
|
|
|
"praprapraprauwnuk",
|
2006-10-20 09:55:28 +05:30
|
|
|
|
"prapraprapraprawnuk",
|
|
|
|
|
"praprapraprapraprawnuk",
|
|
|
|
|
"prapraprapraprapraprawnuk",
|
|
|
|
|
"praprapraprapraprapraprawnuk",
|
|
|
|
|
"prapraprapraprapraprapraprawnuk",
|
|
|
|
|
"praprapraprapraprapraprapraprawnuk",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_daughter_level = [ "", "córka",
|
|
|
|
|
"wnuczka",
|
|
|
|
|
"prawnuczka",
|
|
|
|
|
"praprawnuczka",
|
|
|
|
|
"prapraprauwnuczka",
|
2007-01-07 13:10:51 +05:30
|
|
|
|
"praprapraprauwnuczka",
|
2006-10-20 09:55:28 +05:30
|
|
|
|
"prapraprapraprawnuczka",
|
|
|
|
|
"praprapraprapraprawnuczka",
|
|
|
|
|
"prapraprapraprapraprawnuczka",
|
|
|
|
|
"praprapraprapraprapraprawnuczka",
|
|
|
|
|
"prapraprapraprapraprapraprawnuczka",
|
|
|
|
|
"praprapraprapraprapraprapraprawnuczka",
|
|
|
|
|
]
|
|
|
|
|
|
2006-10-26 04:52:09 +05:30
|
|
|
|
_sister_level_of_male = [ "", "siostra", "ciotka",
|
|
|
|
|
"babcia stryjeczna",
|
|
|
|
|
"prababcia stryjeczna",
|
|
|
|
|
"praprababcia stryjeczna",
|
|
|
|
|
"prapraprababcia stryjeczna",
|
|
|
|
|
"praprapraprababcia stryjeczna",
|
|
|
|
|
"prapraprapraprababcia stryjeczna",
|
|
|
|
|
"praprapraprapraprababcia stryjeczna",
|
|
|
|
|
"prapraprapraprapraprababcia stryjeczna",
|
|
|
|
|
"praprapraprapraprapraprababcia stryjeczna",
|
|
|
|
|
"prapraprapraprapraprapraprababcia stryjeczna",
|
|
|
|
|
"praprapraprapraprapraprapraprababcia stryjeczna",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_sister_level_of_female = [ "", "siostra", "ciotka",
|
|
|
|
|
"babcia cioteczna",
|
|
|
|
|
"prababcia cioteczna",
|
|
|
|
|
"praprababcia cioteczna",
|
|
|
|
|
"prapraprababcia cioteczna",
|
|
|
|
|
"praprapraprababcia cioteczna",
|
|
|
|
|
"prapraprapraprababcia cioteczna",
|
|
|
|
|
"praprapraprapraprababcia cioteczna",
|
|
|
|
|
"prapraprapraprapraprababcia cioteczna",
|
|
|
|
|
"praprapraprapraprapraprababcia cioteczna",
|
|
|
|
|
"prapraprapraprapraprapraprababcia cioteczna",
|
|
|
|
|
"praprapraprapraprapraprapraprababcia cioteczna",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_brother_level_of_male = [ "", "brat", "stryj",
|
|
|
|
|
"dziadek stryjeczny",
|
|
|
|
|
"pradziadek stryjeczny",
|
|
|
|
|
"prapradziadek stryjeczny",
|
|
|
|
|
"praprapradziadek stryjeczny",
|
|
|
|
|
"prapraprapradziadek stryjeczny",
|
|
|
|
|
"praprapraprapradziadek stryjeczny",
|
|
|
|
|
"prapraprapraprapradziadek stryjeczny",
|
|
|
|
|
"praprapraprapraprapradziadek stryjeczny",
|
|
|
|
|
"prapraprapraprapraprapradziadek stryjeczny",
|
|
|
|
|
"praprapraprapraprapraprapradziadek stryjeczny",
|
|
|
|
|
"prapraprapraprapraprapraprapradziadek stryjeczny",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_brother_level_of_female = [ "", "brat", "wuj",
|
|
|
|
|
"dziadek cioteczny",
|
|
|
|
|
"pradziadek cioteczny",
|
|
|
|
|
"prapradziadek cioteczny",
|
|
|
|
|
"praprapradziadek cioteczny",
|
|
|
|
|
"prapraprapradziadek cioteczny",
|
|
|
|
|
"praprapraprapradziadek cioteczny",
|
|
|
|
|
"prapraprapraprapradziadek cioteczny",
|
|
|
|
|
"praprapraprapraprapradziadek cioteczny",
|
|
|
|
|
"prapraprapraprapraprapradziadek cioteczny",
|
|
|
|
|
"praprapraprapraprapraprapradziadek cioteczny",
|
|
|
|
|
"prapraprapraprapraprapraprapradziadek cioteczny",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_nephew_level_of_brothers_son = [ "", "bratanek",
|
|
|
|
|
"syn bratanka",
|
|
|
|
|
"wnuk bratanka",
|
|
|
|
|
"prawnuk bratanka",
|
|
|
|
|
"praprawnuk bratanka",
|
|
|
|
|
"prapraprawnuk bratanka",
|
|
|
|
|
"praprapraprawnuk bratanka",
|
|
|
|
|
"prapraprapraprawnuk bratanka",
|
|
|
|
|
"praprapraprapraprawnuk bratanka",
|
|
|
|
|
"prapraprapraprapraprawnuk bratanka",
|
|
|
|
|
"praprapraprapraprapraprawnuk bratanka",
|
|
|
|
|
"prapraprapraprapraprapraprawnuk bratanka",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_nephew_level_of_brothers_daughter = [ "", "bratanek",
|
|
|
|
|
"syn bratanicy",
|
|
|
|
|
"wnuk bratanicy",
|
|
|
|
|
"prawnuk bratanicy",
|
|
|
|
|
"praprawnuk bratanicy",
|
|
|
|
|
"prapraprawnuk bratanicy",
|
|
|
|
|
"praprapraprawnuk bratanicy",
|
|
|
|
|
"prapraprapraprawnuk bratanicy",
|
|
|
|
|
"praprapraprapraprawnuk bratanicy",
|
|
|
|
|
"prapraprapraprapraprawnuk bratanicy",
|
|
|
|
|
"praprapraprapraprapraprawnuk bratanicy",
|
|
|
|
|
"prapraprapraprapraprapraprawnuk bratanicy",
|
|
|
|
|
"praprapraprapraprapraprapraprawnuk bratanicy",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_nephew_level_of_sisters_son = [ "", "siostrzeniec",
|
|
|
|
|
"syn siostrzeńca",
|
|
|
|
|
"wnuk siostrzeńca",
|
|
|
|
|
"prawnuk siostrzeńca",
|
|
|
|
|
"praprawnuk siostrzeńca",
|
|
|
|
|
"prapraprawnuk siostrzeńca",
|
|
|
|
|
"praprapraprawnuk siostrzeńca",
|
|
|
|
|
"prapraprapraprawnuk siostrzeńca",
|
|
|
|
|
"praprapraprapraprawnuk siostrzeńca",
|
|
|
|
|
"prapraprapraprapraprawnuk siostrzeńca",
|
|
|
|
|
"praprapraprapraprapraprawnuk siostrzeńca",
|
|
|
|
|
"prapraprapraprapraprapraprawnuk siostrzeńca",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_nephew_level_of_sisters_daughter = [ "", "siostrzeniec",
|
|
|
|
|
"syn siostrzenicy",
|
|
|
|
|
"wnuk siostrzenicy",
|
|
|
|
|
"prawnuk siostrzenicy",
|
|
|
|
|
"praprawnuk siostrzenicy",
|
|
|
|
|
"prapraprawnuk siostrzenicy",
|
|
|
|
|
"praprapraprawnuk siostrzenicy",
|
|
|
|
|
"prapraprapraprawnuk siostrzenicy",
|
|
|
|
|
"praprapraprapraprawnuk siostrzenicy",
|
|
|
|
|
"prapraprapraprapraprawnuk siostrzenicy",
|
|
|
|
|
"praprapraprapraprapraprawnuk siostrzenicy",
|
|
|
|
|
"prapraprapraprapraprapraprawnuk siostrzenicy",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_niece_level_of_brothers_son = [ "", "bratanica",
|
|
|
|
|
"córka bratanka",
|
|
|
|
|
"wnuczka bratanka",
|
|
|
|
|
"prawnuczka bratanka",
|
|
|
|
|
"praprawnuczka bratanka",
|
|
|
|
|
"prapraprawnuczka bratanka",
|
|
|
|
|
"praprapraprawnuczka bratanka",
|
|
|
|
|
"prapraprapraprawnuczka bratanka",
|
|
|
|
|
"praprapraprapraprawnuczka bratanka",
|
|
|
|
|
"prapraprapraprapraprawnuczka bratanka",
|
|
|
|
|
"praprapraprapraprapraprawnuczka bratanka",
|
2006-10-20 09:55:28 +05:30
|
|
|
|
]
|
|
|
|
|
|
2006-10-26 04:52:09 +05:30
|
|
|
|
_niece_level_of_brothers_daughter = [ "", "bratanica",
|
|
|
|
|
"córka bratanicy",
|
|
|
|
|
"wnuczka bratanicy",
|
|
|
|
|
"prawnuczka bratanicy",
|
|
|
|
|
"praprawnuczka bratanicy",
|
|
|
|
|
"prapraprawnuczka bratanicy",
|
|
|
|
|
"praprapraprawnuczka bratanicy",
|
|
|
|
|
"prapraprapraprawnuczka bratanicy",
|
|
|
|
|
"praprapraprapraprawnuczka bratanicy",
|
|
|
|
|
"prapraprapraprapraprawnuczka bratanicy",
|
|
|
|
|
"praprapraprapraprapraprawnuczka bratanicy",
|
2006-10-20 09:55:28 +05:30
|
|
|
|
]
|
|
|
|
|
|
2006-10-26 04:52:09 +05:30
|
|
|
|
_niece_level_of_sisters_son = [ "", "siostrzenica",
|
|
|
|
|
"córka siostrzeńca",
|
|
|
|
|
"wnuczka siostrzeńca",
|
|
|
|
|
"prawnuczka siostrzeńca",
|
|
|
|
|
"praprawnuczka siostrzeńca",
|
|
|
|
|
"prapraprawnuczka siostrzeńca",
|
|
|
|
|
"praprapraprawnuczka siostrzeńca",
|
|
|
|
|
"prapraprapraprawnuczka siostrzeńca",
|
|
|
|
|
"praprapraprapraprawnuczka siostrzeńca",
|
|
|
|
|
"prapraprapraprapraprawnuczka siostrzeńca",
|
|
|
|
|
"praprapraprapraprapraprawnuczka siostrzeńca",
|
2006-10-20 09:55:28 +05:30
|
|
|
|
]
|
|
|
|
|
|
2006-10-26 04:52:09 +05:30
|
|
|
|
_niece_level_of_sisters_daughter = [ "", "siostrzenica",
|
|
|
|
|
"córka siostrzenicy",
|
|
|
|
|
"wnuczka siostrzenicy",
|
|
|
|
|
"prawnuczka siostrzenicy",
|
|
|
|
|
"praprawnuczka siostrzenicy",
|
|
|
|
|
"prapraprawnuczka siostrzenicy",
|
|
|
|
|
"praprapraprawnuczka siostrzenicy",
|
|
|
|
|
"prapraprapraprawnuczka siostrzenicy",
|
|
|
|
|
"praprapraprapraprawnuczka siostrzenicy",
|
|
|
|
|
"prapraprapraprapraprawnuczka siostrzenicy",
|
|
|
|
|
"praprapraprapraprapraprawnuczka siostrzenicy",
|
2006-10-20 09:55:28 +05:30
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
2007-01-07 13:10:51 +05:30
|
|
|
|
|
2006-10-20 09:55:28 +05:30
|
|
|
|
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|
|
|
|
|
2007-08-18 19:01:50 +05:30
|
|
|
|
def __init__(self):
|
|
|
|
|
Relationship.RelationshipCalculator.__init__(self)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2007-01-07 13:10:51 +05:30
|
|
|
|
# other_level+orig_level=stopień pokrewieństwa (degree of kinship)
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_junior_male_cousin_father_uncle(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
if other_level == orig_level == 2:
|
|
|
|
|
return "brat stryjeczny"
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_junior_male_cousin_mother_uncle(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
if other_level == orig_level == 2:
|
|
|
|
|
return "brat wujeczny"
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_junior_male_cousin_aunt(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
if other_level == orig_level == 2:
|
|
|
|
|
return "brat cioteczny"
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_senior_male_cousin_of_male(self,level, orig_level, other_level):
|
2007-01-07 13:10:51 +05:30
|
|
|
|
if level>len(_brother_level_of_male)-1:
|
|
|
|
|
return "daleki pra*dziadek stryjeczny (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2008-02-24 19:25:55 +05:30
|
|
|
|
return "daleki %s (%d. stopień pokrewieństwa)" % (_brother_level_of_male[level], other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_senior_male_cousin_of_female(self,level, orig_level, other_level):
|
2007-01-07 13:10:51 +05:30
|
|
|
|
if level>len(_brother_level_of_female)-1:
|
|
|
|
|
return "daleki pra*dziadek cioteczny (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2008-02-24 19:25:55 +05:30
|
|
|
|
return "daleki %s (%d. stopień pokrewieństwa)" % (_brother_level_of_female[level], other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_junior_female_cousin_father_uncle(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
if other_level == orig_level == 2:
|
|
|
|
|
return "siostra stryjeczna"
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_junior_female_cousin_mother_uncle(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
if other_level == orig_level == 2:
|
|
|
|
|
return "siostra wujeczna"
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_junior_female_cousin_aunt(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
if other_level == orig_level == 2:
|
|
|
|
|
return "siostra cioteczna"
|
2007-01-07 13:10:51 +05:30
|
|
|
|
else:
|
|
|
|
|
return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level)
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_senior_female_cousin_of_male(self,level, orig_level, other_level):
|
2007-01-07 13:10:51 +05:30
|
|
|
|
if level>len(_sister_level_of_male)-1:
|
|
|
|
|
return "daleka pra*babcia stryjeczna (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
|
|
|
|
else:
|
2008-02-24 19:25:55 +05:30
|
|
|
|
return "daleka %s (%d. stopień pokrewieństwa)" % (_sister_level_of_male[level], other_level+orig_level)
|
2007-01-07 13:10:51 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_senior_female_cousin_of_female(self,level, orig_level, other_level):
|
2007-01-07 13:10:51 +05:30
|
|
|
|
if level>len(_sister_level_of_female)-1:
|
|
|
|
|
return "daleka pra*babcia cioteczna (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
|
|
|
|
else:
|
2008-02-24 19:25:55 +05:30
|
|
|
|
return "daleka %s (%d. stopień pokrewieństwa)" % (_sister_level_of_female[level], other_level+orig_level)
|
2007-01-07 13:10:51 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_father(self, other_level, orig_level):
|
2007-07-17 02:49:24 +05:30
|
|
|
|
level=other_level
|
2006-10-20 09:55:28 +05:30
|
|
|
|
if level>len(_father_level)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalony pra*dziadek (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
|
|
|
|
return _father_level[level]
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_son(self, other_level, orig_level):
|
2007-07-17 02:49:24 +05:30
|
|
|
|
level=orig_level
|
|
|
|
|
if level>len(_son_level)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalony pra*wnuk (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
|
|
|
|
return _son_level[level]
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_mother(self, other_level, orig_level):
|
2007-01-07 13:10:51 +05:30
|
|
|
|
level=other_level
|
2008-01-06 01:40:26 +05:30
|
|
|
|
if level>len(_mother_level)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalona pra*babcia (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
|
|
|
|
return _mother_level[level]
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_daughter(self, other_level, orig_level):
|
2007-07-17 02:49:24 +05:30
|
|
|
|
level=orig_level
|
2008-01-06 01:40:26 +05:30
|
|
|
|
if level>len(_daughter_level)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalona pra*wnuczka (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
|
|
|
|
return _daughter_level[level]
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_aunt_of_male(self, other_level, orig_level):
|
2007-01-07 13:10:51 +05:30
|
|
|
|
level=other_level
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_sister_level_of_male)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalona pra*babcia stryjeczna (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
return _sister_level_of_male[level]
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_aunt_of_female(self, other_level, orig_level):
|
2007-01-07 13:10:51 +05:30
|
|
|
|
level=other_level
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_sister_level_of_female)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalona pra*babcia cioteczna (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2006-10-26 04:52:09 +05:30
|
|
|
|
return _sister_level_of_female[level]
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_uncle_of_male(self, other_level, orig_level):
|
2007-01-07 13:10:51 +05:30
|
|
|
|
level=other_level
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_brother_level_of_male)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalony pra*dziadek stryjeczny (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2006-10-26 04:52:09 +05:30
|
|
|
|
return _brother_level_of_male[level]
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_uncle_of_female(self, other_level, orig_level):
|
2007-01-07 13:10:51 +05:30
|
|
|
|
level=other_level
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_brother_level_of_female)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalony pra*dziadek cioteczny (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
return _brother_level_of_female[level]
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_nephew_of_brothers_son(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
level=orig_level-1
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_nephew_level_of_brothers_son)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalony pra*wnuk bratanka (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2008-01-06 01:40:26 +05:30
|
|
|
|
return _nephew_level_of_brothers_son[level]
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_nephew_of_brothers_daughter(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
level=orig_level-1
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_nephew_level_of_brothers_daughter)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalony pra*wnuk bratanicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2008-01-06 01:40:26 +05:30
|
|
|
|
return _nephew_level_of_brothers_daughter[level]
|
2006-10-26 04:52:09 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_nephew_of_sisters_son(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
level=orig_level-1
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_nephew_level_of_sisters_son)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalony pra*wnuk siostrzeńca (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2008-01-06 01:40:26 +05:30
|
|
|
|
return _nephew_level_of_sisters_son[level]
|
2006-10-26 04:52:09 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_nephew_of_sisters_daughter(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
level=orig_level-1
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_nephew_level_of_sisters_daughter)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalony pra*wnuk siostrzenicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2008-01-06 01:40:26 +05:30
|
|
|
|
return _nephew_level_of_sisters_daughter[level]
|
2006-10-26 04:52:09 +05:30
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_niece_of_brothers_son(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
level=orig_level-1
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_niece_level_of_brothers_son)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalona pra*wnuczka bratanka (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
return _niece_level_of_brothers_son[level]
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_niece_of_brothers_daughter(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
level=orig_level-1
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_niece_level_of_brothers_daughter)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalona pra*wnuczka bratanicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
return _niece_level_of_brothers_daughter[level]
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_niece_of_sisters_son(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
level=orig_level-1
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_niece_level_of_sisters_son)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalona pra*wnuczka siostrzeńca (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
return _niece_level_of_sisters_son[level]
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_niece_of_sisters_daughter(self, other_level, orig_level):
|
2008-01-06 01:40:26 +05:30
|
|
|
|
level=orig_level-1
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if level>len(_niece_level_of_sisters_daughter)-1:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return "oddalona pra*wnuczka siostrzenicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
return _niece_level_of_sisters_daughter[level]
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_relationship_distance_pl(self,db, orig_person, other_person):
|
2006-10-26 04:52:09 +05:30
|
|
|
|
"""
|
2008-02-24 19:25:55 +05:30
|
|
|
|
Return a tuple (firstRel,secondRel,common):
|
2006-10-26 04:52:09 +05:30
|
|
|
|
|
|
|
|
|
firstRel Number of generations from the orig_person to their
|
|
|
|
|
closest common ancestor
|
|
|
|
|
secondRel Number of generations from the other_person to their
|
|
|
|
|
closest common ancestor
|
|
|
|
|
common list of their common ancestors, the closest is the first
|
|
|
|
|
|
|
|
|
|
is returned
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
firstRel = -1
|
|
|
|
|
secondRel = -1
|
|
|
|
|
common = []
|
|
|
|
|
|
|
|
|
|
firstMap = {}
|
|
|
|
|
firstList = []
|
|
|
|
|
secondMap = {}
|
|
|
|
|
secondList = []
|
|
|
|
|
rank = 9999999
|
|
|
|
|
|
|
|
|
|
try:
|
2008-02-24 19:25:55 +05:30
|
|
|
|
self.__apply_filter_old(db, orig_person,'',firstList,firstMap)
|
|
|
|
|
self.__apply_filter_old(db, other_person,'',secondList,secondMap)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
except RuntimeError:
|
|
|
|
|
return (firstRel,secondRel,_("Relationship loop detected"))
|
|
|
|
|
|
|
|
|
|
for person_handle in firstList:
|
|
|
|
|
if person_handle in secondList:
|
|
|
|
|
new_rank = len(firstMap[person_handle])
|
|
|
|
|
if new_rank < rank:
|
|
|
|
|
rank = new_rank
|
|
|
|
|
common = [ person_handle ]
|
|
|
|
|
elif new_rank == rank:
|
|
|
|
|
common.append(person_handle)
|
|
|
|
|
|
|
|
|
|
if common:
|
|
|
|
|
person_handle = common[0]
|
|
|
|
|
secondRel = firstMap[person_handle]
|
|
|
|
|
firstRel = secondMap[person_handle]
|
|
|
|
|
|
|
|
|
|
return (firstRel,secondRel,common,firstList,secondList)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2007-11-19 05:09:14 +05:30
|
|
|
|
def __apply_filter_old(self, db, person, rel_str, plist, pmap, depth=1):
|
|
|
|
|
""" DEPRECATED -- DO NOT USE
|
|
|
|
|
copied here from Relationship.py as no longer needed elsewhere
|
|
|
|
|
"""
|
2007-11-22 21:43:10 +05:30
|
|
|
|
if person == None or depth > 15:
|
2007-11-19 05:09:14 +05:30
|
|
|
|
return
|
|
|
|
|
depth += 1
|
|
|
|
|
plist.append(person.handle)
|
|
|
|
|
pmap[person.handle] = rel_str # ?? this overwrites if person is double!
|
|
|
|
|
|
|
|
|
|
family_handle = person.get_main_parents_family_handle()
|
|
|
|
|
try:
|
|
|
|
|
if family_handle:
|
|
|
|
|
family = db.get_family_from_handle(family_handle)
|
|
|
|
|
fhandle = family.father_handle
|
|
|
|
|
if fhandle:
|
|
|
|
|
father = db.get_person_from_handle(fhandle)
|
|
|
|
|
self.__apply_filter_old(db, father, rel_str+'f', plist, pmap,
|
|
|
|
|
depth)
|
|
|
|
|
mhandle = family.mother_handle
|
|
|
|
|
if mhandle:
|
|
|
|
|
mother = db.get_person_from_handle(mhandle)
|
|
|
|
|
self.__apply_filter_old(db, mother, rel_str+'m', plist, pmap,
|
|
|
|
|
depth)
|
|
|
|
|
except:
|
|
|
|
|
return
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
def get_relationship(self,db, orig_person, other_person):
|
2006-10-20 09:55:28 +05:30
|
|
|
|
"""
|
2008-02-24 19:25:55 +05:30
|
|
|
|
Return a string representing the relationshp between the two people,
|
2006-10-20 09:55:28 +05:30
|
|
|
|
along with a list of common ancestors (typically father,mother)
|
|
|
|
|
|
|
|
|
|
Special cases: relation strings "", "undefined" and "spouse".
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
if orig_person == None:
|
|
|
|
|
return ("undefined",[])
|
|
|
|
|
|
|
|
|
|
if orig_person.get_handle() == other_person.get_handle():
|
|
|
|
|
return ('', [])
|
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
|
is_spouse = self.is_spouse(db, orig_person, other_person)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
if is_spouse:
|
|
|
|
|
return (is_spouse,[])
|
|
|
|
|
|
2007-08-18 19:01:50 +05:30
|
|
|
|
(firstRel,secondRel,common,firstList,secondList) = \
|
2008-02-24 19:25:55 +05:30
|
|
|
|
self.get_relationship_distance_pl(db, orig_person, other_person)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
2007-08-18 19:01:50 +05:30
|
|
|
|
if type(common) == types.StringType or \
|
|
|
|
|
type(common) == types.UnicodeType:
|
2006-10-20 09:55:28 +05:30
|
|
|
|
return (common,[])
|
|
|
|
|
elif common:
|
|
|
|
|
person_handle = common[0]
|
|
|
|
|
else:
|
|
|
|
|
return ("",[])
|
|
|
|
|
|
|
|
|
|
firstRel = len(firstRel)
|
2007-07-17 02:49:24 +05:30
|
|
|
|
secondRelatives = secondRel
|
2006-10-20 09:55:28 +05:30
|
|
|
|
secondRel = len(secondRel)
|
|
|
|
|
|
|
|
|
|
if firstRel == 0:
|
|
|
|
|
if secondRel == 0:
|
|
|
|
|
return ('',common)
|
2007-10-08 22:11:39 +05:30
|
|
|
|
elif other_person.get_gender() == gen.lib.Person.MALE:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_father(secondRel,firstRel),common)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_mother(secondRel,firstRel),common)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
elif secondRel == 0:
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if other_person.get_gender() == gen.lib.Person.MALE:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_son(secondRel,firstRel),common)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_daughter(secondRel,firstRel),common)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
elif firstRel == 1:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
families1 = db.get_person_from_handle(common[0]).get_family_handle_list()
|
2006-10-26 04:52:09 +05:30
|
|
|
|
families2 = None
|
|
|
|
|
if len(common) >1:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
families2 = db.get_person_from_handle(common[1]).get_family_handle_list()
|
2006-10-26 04:52:09 +05:30
|
|
|
|
for ancFamily_handle in families1:
|
|
|
|
|
if families2:
|
|
|
|
|
if ancFamily_handle in families2:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
ancFamily = db.get_family_from_handle(ancFamily_handle)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
continue
|
|
|
|
|
else:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
ancFamily = db.get_family_from_handle(ancFamily_handle)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
children = ancFamily.get_child_ref_list()
|
|
|
|
|
for sibling in children:
|
|
|
|
|
if sibling.ref in firstList:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
# discriminate between siblings/uncles etc. and stepsiblings/stepuncles etc.
|
2007-08-18 19:01:50 +05:30
|
|
|
|
if other_person.get_main_parents_family_handle() == db.get_person_from_handle(sibling.ref).get_main_parents_family_handle():
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if other_person.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
if db.get_person_from_handle(sibling.ref).get_gender() == gen.lib.Person.MALE:
|
2006-10-26 04:52:09 +05:30
|
|
|
|
# brat / stryj / (pra)dziadek stryjeczny
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_uncle_of_male(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
# brat / wuj / (pra)dziadek cioteczny
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_uncle_of_female(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if db.get_person_from_handle(sibling.ref).get_gender() == gen.lib.Person.MALE:
|
2006-10-26 04:52:09 +05:30
|
|
|
|
# siostra / ciotka / (pra)babcia stryjeczna
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_aunt_of_male(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
# siostra / ciotka / (pra)babcia cioteczna
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_aunt_of_female(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if other_person.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
if db.get_person_from_handle(sibling.ref).get_gender() == gen.lib.Person.MALE:
|
2006-10-26 04:52:09 +05:30
|
|
|
|
# brat / stryj / (pra)dziadek stryjeczny
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_uncle_of_male(secondRel,firstRel)+" (przyrodni)",common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
# brat / wuj / (pra)dziadek cioteczny
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_uncle_of_female(secondRel,firstRel)+" (przyrodni)",common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if db.get_person_from_handle(sibling.ref).get_gender() == gen.lib.Person.MALE:
|
2006-10-26 04:52:09 +05:30
|
|
|
|
# siostra / ciotka / (pra)babcia stryjeczna
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_aunt_of_male(secondRel,firstRel)+" (przyrodnia)",common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
# siostra / ciotka / (pra)babcia cioteczna
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_aunt_of_female(secondRel,firstRel)+" (przyrodnia)",common)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
elif secondRel == 1:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
families1 = db.get_person_from_handle(common[0]).get_family_handle_list()
|
2006-10-26 04:52:09 +05:30
|
|
|
|
families2 = None
|
|
|
|
|
if len(common) >1:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
families2 = db.get_person_from_handle(common[1]).get_family_handle_list()
|
2006-10-26 04:52:09 +05:30
|
|
|
|
for ancFamily_handle in families1:
|
|
|
|
|
if families2:
|
|
|
|
|
if ancFamily_handle in families2:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
ancFamily = db.get_family_from_handle(ancFamily_handle)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
continue
|
|
|
|
|
else:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
ancFamily = db.get_family_from_handle(ancFamily_handle)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
children = ancFamily.get_child_ref_list()
|
|
|
|
|
for sibling_handle in children:
|
|
|
|
|
if sibling_handle.ref in secondList:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
sibling = db.get_person_from_handle(sibling_handle.ref)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
families = sibling.get_family_handle_list()
|
|
|
|
|
for sibFamily in families:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
for child_handle in db.get_family_from_handle(sibFamily).get_child_ref_list():
|
2006-10-26 04:52:09 +05:30
|
|
|
|
if child_handle.ref in secondList:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
child = db.get_person_from_handle(child_handle.ref)
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if other_person.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
if sibling.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
if child.get_gender() == gen.lib.Person.MALE:
|
2006-10-26 04:52:09 +05:30
|
|
|
|
# bratanek / syn bratanka
|
2007-02-02 00:40:09 +05:30
|
|
|
|
return (self.get_nephew_of_brothers_son(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
# bratanek / syn bratanicy
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_nephew_of_brothers_daughter(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if child.get_gender() == gen.lib.Person.MALE:
|
2006-10-26 04:52:09 +05:30
|
|
|
|
# siostrzeniec / syn siostrzeńca
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_nephew_of_sisters_son(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
# siostrzniec / syn siostrzenicy
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_nephew_of_sisters_daughter(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if sibling.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
if child.get_gender() == gen.lib.Person.MALE:
|
2006-10-26 04:52:09 +05:30
|
|
|
|
# bratanica / córka bratanka
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_niece_of_brothers_son(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
# bratanica / córka bratanicy
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_niece_of_brothers_daughter(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if child.get_gender() == gen.lib.Person.MALE:
|
2006-10-26 04:52:09 +05:30
|
|
|
|
# siostrzenica / córka siostrzeńca
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_niece_of_sisters_son(secondRel,firstRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
# siostrzenica / córka siostrzenicy
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_niece_of_sisters_daughter(secondRel,firstRel),common)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
elif secondRel > firstRel:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
families1 = db.get_person_from_handle(common[0]).get_family_handle_list()
|
2006-10-26 04:52:09 +05:30
|
|
|
|
families2 = None
|
|
|
|
|
if len(common) >1:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
families2 = db.get_person_from_handle(common[1]).get_family_handle_list()
|
2006-10-26 04:52:09 +05:30
|
|
|
|
for ancFamily_handle in families1:
|
|
|
|
|
if families2:
|
|
|
|
|
if ancFamily_handle in families2:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
ancFamily = db.get_family_from_handle(ancFamily_handle)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
|
|
|
|
continue
|
|
|
|
|
else:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
ancFamily = db.get_family_from_handle(ancFamily_handle)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
children = ancFamily.get_child_ref_list()
|
|
|
|
|
for sibling in children:
|
|
|
|
|
if sibling.ref in firstList:
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if other_person.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
if db.get_person_from_handle(sibling.ref).get_gender() == gen.lib.Person.MALE:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_senior_male_cousin_of_male(secondRel-firstRel+1,firstRel,secondRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_senior_male_cousin_of_female(secondRel-firstRel+1,firstRel,secondRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2007-10-08 22:11:39 +05:30
|
|
|
|
if db.get_person_from_handle(sibling.ref).get_gender() == gen.lib.Person.MALE:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_senior_female_cousin_of_male(secondRel-firstRel+1,firstRel,secondRel),common)
|
2006-10-26 04:52:09 +05:30
|
|
|
|
else:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
return (self.get_senior_female_cousin_of_female(secondRel-firstRel+1,firstRel,secondRel),common)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
else:
|
2008-01-06 01:40:26 +05:30
|
|
|
|
families1 = db.get_person_from_handle(common[0]).get_family_handle_list()
|
2007-01-07 13:10:51 +05:30
|
|
|
|
families2 = None
|
|
|
|
|
if len(common) >1:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
families2 = db.get_person_from_handle(common[1]).get_family_handle_list()
|
2007-01-07 13:10:51 +05:30
|
|
|
|
for ancFamily_handle in families1:
|
|
|
|
|
if families2:
|
|
|
|
|
if ancFamily_handle in families2:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
ancFamily = db.get_family_from_handle(ancFamily_handle)
|
2007-01-07 13:10:51 +05:30
|
|
|
|
else:
|
|
|
|
|
continue
|
|
|
|
|
else:
|
2007-08-18 19:01:50 +05:30
|
|
|
|
ancFamily = db.get_family_from_handle(ancFamily_handle)
|
2007-07-17 02:49:24 +05:30
|
|
|
|
|
|
|
|
|
children = ancFamily.get_child_ref_list()
|
|
|
|
|
for sibling_handle in children:
|
2007-01-07 13:10:51 +05:30
|
|
|
|
if sibling_handle.ref in firstList:
|
2008-01-06 01:40:26 +05:30
|
|
|
|
for other_sibling_handle in children:
|
|
|
|
|
if other_sibling_handle.ref in secondList:
|
|
|
|
|
sibling = db.get_person_from_handle(sibling_handle.ref)
|
|
|
|
|
other_sibling = db.get_person_from_handle(other_sibling_handle.ref)
|
|
|
|
|
if other_person.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
if other_sibling.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
if sibling.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
# brat stryjeczny
|
|
|
|
|
return (self.get_junior_male_cousin_father_uncle(secondRel,firstRel),common)
|
|
|
|
|
else:
|
|
|
|
|
# brat wujeczny
|
|
|
|
|
return (self.get_junior_male_cousin_mother_uncle(secondRel,firstRel),common)
|
|
|
|
|
else:
|
|
|
|
|
# brat cioteczny
|
|
|
|
|
return (self.get_junior_male_cousin_aunt(secondRel,firstRel),common)
|
|
|
|
|
else:
|
|
|
|
|
if other_sibling.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
if sibling.get_gender() == gen.lib.Person.MALE:
|
|
|
|
|
# siostra stryjeczna
|
|
|
|
|
return (self.get_junior_female_cousin_father_uncle(secondRel,firstRel),common)
|
|
|
|
|
else:
|
|
|
|
|
# siostra wujeczna
|
|
|
|
|
return (self.get_junior_female_cousin_mother_uncle(secondRel,firstRel),common)
|
|
|
|
|
else:
|
|
|
|
|
# siostra cioteczna
|
|
|
|
|
return (self.get_junior_female_cousin_aunt(secondRel,firstRel),common)
|
2006-10-20 09:55:28 +05:30
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# Register this class with the Plugins system
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
register_relcalc(RelationshipCalculator,
|
2006-10-26 04:52:09 +05:30
|
|
|
|
["pl","PL","pl_PL","polski","Polski","pl_PL.UTF-8", "pl_PL.UTF8", "pl_PL.utf-8", "pl_PL.utf8", "pl_PL.iso-8859-2", "pl_PL.iso8859-2", "pl_PL.cp1250", "pl_PL.cp-1250"])
|
2007-10-08 22:11:39 +05:30
|
|
|
|
|