2006-12-30 02:22:33 +05:30
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
|
|
|
# Copyright (C) 2003-2005 Donald N. Allingham
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
|
|
|
# $Id: rel_nl.py 6775 2006-12-16 05:52:17Z erikderichter $
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2007-10-08 22:11:39 +05:30
|
|
|
import gen.lib
|
2006-12-30 02:22:33 +05:30
|
|
|
import Relationship
|
|
|
|
import types
|
|
|
|
from gettext import gettext as _
|
|
|
|
from PluginUtils import register_relcalc
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2007-10-16 14:11:25 +05:30
|
|
|
_removed_level = [ " ",
|
2007-10-26 04:45:28 +05:30
|
|
|
" eerste",
|
|
|
|
" tweede",
|
|
|
|
" derde",
|
|
|
|
" vierde",
|
|
|
|
" vijfde",
|
|
|
|
" zesde",
|
|
|
|
" zevende",
|
2007-10-16 14:11:25 +05:30
|
|
|
" achtste",
|
|
|
|
" negende",
|
|
|
|
" tiende",
|
|
|
|
" elfde",
|
|
|
|
" twaalfde",
|
|
|
|
" dertiende",
|
|
|
|
" veertiende",
|
|
|
|
" vijftiende",
|
|
|
|
" zestiende",
|
|
|
|
" zeventiende",
|
|
|
|
" achttiende",
|
|
|
|
" negentiende",
|
|
|
|
" twintigste",
|
|
|
|
" eenentwintigste",
|
|
|
|
" tweeëntwintigste",
|
|
|
|
" drieëntwingste",
|
|
|
|
" vierentwingste",
|
|
|
|
" vijfentwintigste",
|
|
|
|
" zesentwintigste",
|
|
|
|
" zevenentwintigste",
|
|
|
|
" achtentwintigste",
|
|
|
|
" negenentwintigste",
|
|
|
|
" dertigste" ]
|
2006-12-30 02:22:33 +05:30
|
|
|
|
|
|
|
_parents_level = [ "",
|
|
|
|
"ouders",
|
|
|
|
"grootouders",
|
|
|
|
"overgrootouders",
|
2007-10-16 14:11:25 +05:30
|
|
|
"betovergrootouders",
|
|
|
|
"oudouders",
|
|
|
|
"oudgrootouders",
|
|
|
|
"oudovergrootouders",
|
|
|
|
"oudbetovergrootouders",
|
|
|
|
"stamouders",
|
2007-10-26 04:45:28 +05:30
|
|
|
"stamgrootouders", # gen 10
|
2007-10-16 14:11:25 +05:30
|
|
|
"stamovergrootouders",
|
|
|
|
"stambetovergrootouders",
|
|
|
|
"stamoudouders",
|
|
|
|
"stamoudgrootouders",
|
|
|
|
"stamoudovergrootouders",
|
|
|
|
"stamoudbetovergrootouders",
|
|
|
|
"edelouders",
|
|
|
|
"edelgrootoders",
|
|
|
|
"edelovergrootoudouders",
|
2007-10-26 04:45:28 +05:30
|
|
|
"edelbetovergrootouders", # gen 20
|
2007-10-16 14:11:25 +05:30
|
|
|
"edeloudouders",
|
|
|
|
"edeloudgrootouders",
|
|
|
|
"edeloudvergrootouders",
|
|
|
|
"edeloudbetovergrootouders",
|
|
|
|
"edelstamouders",
|
|
|
|
"edelstamgrootouders",
|
|
|
|
"edelstamovergrootouders",
|
|
|
|
"edelstambetovergrootouders",
|
|
|
|
"edelstamoudouders" ]
|
2006-12-30 02:22:33 +05:30
|
|
|
|
|
|
|
_father_level = [ "",
|
2007-10-26 04:45:28 +05:30
|
|
|
"vader",
|
|
|
|
"grootvader",
|
|
|
|
"overgrootvader",
|
|
|
|
"betovergrootvader",
|
|
|
|
"oudvader (generatie 5)",
|
|
|
|
"oudgrootvader (generatie 6)",
|
|
|
|
"oudovergrootvader (generatie 7)",
|
|
|
|
"oudbetovergrootvader (generatie 8)",
|
|
|
|
"stamvader (generatie 9)",
|
|
|
|
"stamgrootvader (generatie 10)",
|
|
|
|
"stamovergrootvader (generatie 11)",
|
|
|
|
"stambetovergrootvader (generatie 12)",
|
|
|
|
"stamoudvader (generatie 13)",
|
|
|
|
"stamoudgrootvader (generatie 14)",
|
|
|
|
"stamoudovergrootvader (generatie 15)",
|
|
|
|
"stamoudbetovergrootvader (generatie 16)",
|
|
|
|
"edelvader (generatie 17)",
|
|
|
|
"edelgrootvader (generatie 18)",
|
|
|
|
"edelovergrootoudvader (generatie 19)",
|
|
|
|
"edelbetovergrootvader (generatie 20)",
|
|
|
|
"edeloudvader (generatie 21)",
|
|
|
|
"edeloudgrootvader (generatie 22)",
|
|
|
|
"edeloudvergrootvader (generatie 23)",
|
|
|
|
"edeloudbetovergrootvader (generatie 24)",
|
|
|
|
"edelstamvader (generatie 25)",
|
|
|
|
"edelstamgrootvader (generatie 26)",
|
|
|
|
"edelstamovergrootvader (generatie 27)",
|
|
|
|
"edelstambetovergrootvader (generatie 28)",
|
|
|
|
"edelstamoudvader (generatie 29)" ]
|
2006-12-30 02:22:33 +05:30
|
|
|
|
|
|
|
_mother_level = [ "",
|
2007-10-26 04:45:28 +05:30
|
|
|
"moeder ",
|
|
|
|
"grootmoeder",
|
|
|
|
"overgrootmoeder",
|
|
|
|
"betovergrootmoeder",
|
|
|
|
"oudmoeder (generatie 5)",
|
|
|
|
"oudgrootmoeder (generatie 6)",
|
|
|
|
"oudovergrootmoeder (generatie 7)",
|
|
|
|
"oudbetovergrootmoeder (generatie 8)",
|
|
|
|
"stammoeder (generatie 9)",
|
|
|
|
"stamgrootmoeder (generatie 10)",
|
|
|
|
"stamovergrootmoeder (generatie 11)",
|
|
|
|
"stambetovergrootmoeder (generatie 12)",
|
|
|
|
"stamoudmoeder (generatie 13)",
|
|
|
|
"stamoudgrootmoeder (generatie 14)",
|
|
|
|
"stamoudovergrootmoeder (generatie 15)",
|
|
|
|
"stamoudbetovergrootmoeder (generatie 16)",
|
|
|
|
"edelmoeder (generatie 17)",
|
|
|
|
"edelgrootmoeder (generatie 18)",
|
|
|
|
"edelovergrootoudmoeder (generatie 19)",
|
|
|
|
"edelbetovergrootmoeder (generatie 20)",
|
|
|
|
"edeloudmoeder (generatie 21)",
|
|
|
|
"edeloudgrootmoeder (generatie 22)",
|
|
|
|
"edeloudvergrootmoeder (generatie 23)",
|
|
|
|
"edeloudbetovergrootmoeder (generatie 24)",
|
|
|
|
"edelstammoeder (generatie 25)",
|
|
|
|
"edelstamgrootmoeder (generatie 26)",
|
|
|
|
"edelstamovergrootmoeder (generatie 27)",
|
|
|
|
"edelstambetovergrootmoeder (generatie 28)",
|
|
|
|
"edelstamoudmoeder (generatie 29)" ]
|
2006-12-30 02:22:33 +05:30
|
|
|
|
|
|
|
_son_level = [ "",
|
|
|
|
"zoon",
|
|
|
|
"kleinzoon",
|
2007-10-16 14:11:25 +05:30
|
|
|
"achterkleinzoon",
|
|
|
|
"achterachterkleinzoon",
|
|
|
|
"achterachterachterkleinzoon"]
|
2006-12-30 02:22:33 +05:30
|
|
|
|
|
|
|
_daughter_level = [ "",
|
|
|
|
"dochter",
|
|
|
|
"kleindochter",
|
2007-10-16 14:11:25 +05:30
|
|
|
"achterkleindochter",
|
|
|
|
"achterachterkleindochter",
|
|
|
|
"achterachterachterkleindochter"]
|
|
|
|
|
2006-12-30 02:22:33 +05:30
|
|
|
_nephew_level = [ "",
|
|
|
|
"neef",
|
2007-10-16 14:11:25 +05:30
|
|
|
"achterneef",
|
|
|
|
"achterachterneef" ]
|
2006-12-30 02:22:33 +05:30
|
|
|
|
|
|
|
_niece_level = [ "",
|
|
|
|
"nicht",
|
2007-10-16 14:11:25 +05:30
|
|
|
"achternicht",
|
2007-10-26 04:45:28 +05:30
|
|
|
"achterachternicht"]
|
2007-10-16 14:11:25 +05:30
|
|
|
_aunt_level = [ "",
|
|
|
|
"tante",
|
|
|
|
"groottante",
|
|
|
|
"overgroottante",
|
|
|
|
"betovergroottante",
|
2007-10-26 04:45:28 +05:30
|
|
|
"oudtante (generatie 5)"]
|
2007-10-16 14:11:25 +05:30
|
|
|
|
|
|
|
_uncle_level = [ "",
|
|
|
|
"oom",
|
|
|
|
"grootoom",
|
|
|
|
"overgrootoom",
|
2007-10-26 04:45:28 +05:30
|
|
|
"betovergrootoom",
|
|
|
|
"oudoom (generatie 5)"]
|
2006-12-30 02:22:33 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class RelationshipCalculator(Relationship.RelationshipCalculator):
|
|
|
|
|
2007-08-18 19:01:50 +05:30
|
|
|
def __init__(self):
|
|
|
|
Relationship.RelationshipCalculator.__init__(self)
|
2006-12-30 02:22:33 +05:30
|
|
|
|
2007-10-16 14:11:25 +05:30
|
|
|
def get_parents(self, level):
|
2007-10-26 04:45:28 +05:30
|
|
|
if level > len(_parents_level)-1:
|
|
|
|
return "verre voorouders (%d generaties)" % level
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-16 14:11:25 +05:30
|
|
|
return _parents_level[level]
|
|
|
|
def get_father(self, level):
|
2007-10-26 04:45:28 +05:30
|
|
|
if level > len(_father_level)-1:
|
|
|
|
return "verre voorvader (%d generaties)" % level
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
|
|
|
return _father_level[level]
|
|
|
|
|
2007-10-16 14:11:25 +05:30
|
|
|
def get_son(self, level):
|
2007-10-26 04:45:28 +05:30
|
|
|
if level < len(_son_level):
|
|
|
|
return _son_level[level]
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-26 04:45:28 +05:30
|
|
|
return "verre achterkleinzoon (%d generaties)" % level
|
2006-12-30 02:22:33 +05:30
|
|
|
|
|
|
|
def get_mother(self,level):
|
2007-10-26 04:45:28 +05:30
|
|
|
if level > len(_mother_level)-1:
|
|
|
|
return "verre voormoeder (%d generaties)" % level
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
|
|
|
return _mother_level[level]
|
|
|
|
|
2007-10-16 14:11:25 +05:30
|
|
|
def get_daughter(self, level):
|
2007-10-26 04:45:28 +05:30
|
|
|
if level > len(_daughter_level)-1:
|
|
|
|
return "verre achterkleindochter (%d generaties)" % level
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
|
|
|
return _daughter_level[level]
|
|
|
|
|
2007-10-16 14:11:25 +05:30
|
|
|
def get_aunt(self, level, removed):
|
2007-10-26 04:45:28 +05:30
|
|
|
if removed == 1 and level < len(_aunt_level):
|
|
|
|
return _aunt_level[level]
|
|
|
|
elif level > len(_aunt_level)-1 or removed > len(_removed_level) -1:
|
|
|
|
return "verre tante (%d generaties, %d graden)" % (level, removed)
|
|
|
|
elif level > len(_aunt_level)-1:
|
|
|
|
return "verre tante van de%s graad (%d generaties)" \
|
|
|
|
% (_removed_level[removed], level)
|
2007-10-16 14:11:25 +05:30
|
|
|
else:
|
2007-10-26 04:45:28 +05:30
|
|
|
return _aunt_level[level] + _removed_level[removed] + " graad"
|
|
|
|
|
2007-10-16 14:11:25 +05:30
|
|
|
def get_uncle(self, level, removed):
|
2007-10-26 04:45:28 +05:30
|
|
|
if removed == 1 and level < len(_uncle_level):
|
|
|
|
return _uncle_level[level]
|
|
|
|
elif level > len(_uncle_level)-1 or removed > len(_removed_level) -1:
|
|
|
|
return "verre oom (%d generaties, %d graden)" % (level, removed)
|
|
|
|
elif level > len(_uncle_level)-1:
|
|
|
|
return "verre oom van de%s graad (%d generaties)" \
|
|
|
|
% (_removed_level[removed], level)
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-26 04:45:28 +05:30
|
|
|
return _uncle_level[level] + _removed_level[removed] + " graad"
|
|
|
|
|
|
|
|
def get_nephew(self, level, removed=1):
|
|
|
|
if removed == 1 and level < len(_nephew_level):
|
|
|
|
return _nephew_level[level]
|
|
|
|
elif level > len(_nephew_level)-1 or removed > len(_removed_level) -1:
|
|
|
|
return "verre neef (%d generaties, %d graden)" % (level, removed)
|
|
|
|
elif level > len(_nephew_level)-1:
|
|
|
|
return "verre neef van de%s graad (%d generaties)" \
|
|
|
|
% (_removed_level[removed], level)
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-26 04:45:28 +05:30
|
|
|
return _nephew_level[level] + _removed_level[removed] + " graad"
|
|
|
|
|
|
|
|
def get_niece(self, level, removed=1):
|
|
|
|
if removed == 1 and level < len(_niece_level):
|
|
|
|
return _niece_level[level]
|
|
|
|
if level > len(_niece_level)-1 or removed > len(_removed_level) -1:
|
|
|
|
return "verre nicht (%d generaties, %d graden)" % (level, removed)
|
|
|
|
elif level > len(_niece_level)-1:
|
|
|
|
return "verre nicht van de%s graad (%d generaties)" \
|
|
|
|
% (_removed_level[removed], level)
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-26 04:45:28 +05:30
|
|
|
return _niece_level[level] + _removed_level[removed] + " graad"
|
2006-12-30 02:22:33 +05:30
|
|
|
|
2007-10-16 14:11:25 +05:30
|
|
|
def get_male_cousin(self,removed):
|
2007-10-26 04:45:28 +05:30
|
|
|
"""Specific Dutch thing, the nieces/nephews on same level are called
|
|
|
|
going sideways in a branch as the nieces/newphews going downward
|
|
|
|
from your brother/sisters. This used to be called "kozijn"
|
|
|
|
"""
|
|
|
|
removed = removed - 1
|
|
|
|
if removed > len(_removed_level)-1:
|
|
|
|
return "verre neef (kozijn, %d graden)" % removed
|
2007-10-16 14:11:25 +05:30
|
|
|
elif removed == 0:
|
|
|
|
return "broer"
|
|
|
|
else:
|
2007-10-26 04:45:28 +05:30
|
|
|
return "neef (kozijn)"+_removed_level[removed] + " graad"
|
2007-10-16 14:11:25 +05:30
|
|
|
|
|
|
|
def get_female_cousin(self,removed):
|
2007-10-26 04:45:28 +05:30
|
|
|
"""Specific Dutch thing, the nieces/nephews on same level are called
|
|
|
|
going sideways in a branch as the nieces/newphews going downward
|
|
|
|
from your brother/sisters. This used to be called "kozijn"
|
|
|
|
"""
|
|
|
|
removed = removed - 1
|
|
|
|
if removed > len(_removed_level)-1:
|
|
|
|
return "verre nicht (kozijn, %d graden)" % removed
|
|
|
|
elif removed == 0:
|
|
|
|
return "zus"
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-26 04:45:28 +05:30
|
|
|
return "nicht (kozijn)"+ _removed_level[removed] + " graad"
|
2006-12-30 02:22:33 +05:30
|
|
|
|
2007-10-16 14:11:25 +05:30
|
|
|
def get_relationship(self, db, orig_person, other_person):
|
2006-12-30 02:22:33 +05:30
|
|
|
"""
|
|
|
|
Returns a string representing the relationshp between the two people,
|
|
|
|
along with a list of common ancestors (typically father,mother)
|
2007-10-16 14:11:25 +05:30
|
|
|
|
2006-12-30 02:22:33 +05:30
|
|
|
Special cases: relation strings "", "undefined" and "spouse".
|
|
|
|
"""
|
|
|
|
if orig_person == None:
|
2007-10-16 14:11:25 +05:30
|
|
|
return ("niet bepaald",[])
|
2006-12-30 02:22:33 +05:30
|
|
|
|
|
|
|
if orig_person.get_handle() == other_person.get_handle():
|
|
|
|
return ('', [])
|
|
|
|
|
2007-10-16 14:11:25 +05:30
|
|
|
is_spouse = self.is_spouse(db, orig_person, other_person)
|
2006-12-30 02:22:33 +05:30
|
|
|
if is_spouse:
|
|
|
|
return (is_spouse,[])
|
|
|
|
|
2007-10-24 18:22:07 +05:30
|
|
|
#get_relationship_distance changed, first data is relation to
|
|
|
|
#orig person, apperently secondRel in this function
|
|
|
|
(secondRel,firstRel,common) = self.get_relationship_distance(db,
|
2007-10-16 14:11:25 +05:30
|
|
|
orig_person,other_person)
|
2006-12-30 02:22:33 +05:30
|
|
|
|
2007-10-16 14:11:25 +05:30
|
|
|
if (type(common) == types.StringType or
|
|
|
|
type(common) == types.UnicodeType):
|
2006-12-30 02:22:33 +05:30
|
|
|
return (common,[])
|
|
|
|
elif common:
|
|
|
|
person_handle = common[0]
|
|
|
|
else:
|
|
|
|
return ("",[])
|
|
|
|
|
|
|
|
firstRel = len(firstRel)
|
|
|
|
secondRel = len(secondRel)
|
|
|
|
|
|
|
|
if firstRel == 0:
|
2007-10-26 04:45:28 +05:30
|
|
|
#other person is ancestor
|
2006-12-30 02:22:33 +05:30
|
|
|
if secondRel == 0:
|
|
|
|
return ('',common)
|
2007-10-08 22:11:39 +05:30
|
|
|
elif other_person.get_gender() == gen.lib.Person.MALE:
|
2007-10-16 14:11:25 +05:30
|
|
|
return (self.get_father(secondRel), common)
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-16 14:11:25 +05:30
|
|
|
return (self.get_mother(secondRel), common)
|
2006-12-30 02:22:33 +05:30
|
|
|
elif secondRel == 0:
|
2007-10-26 04:45:28 +05:30
|
|
|
#other person is descendant
|
2007-10-08 22:11:39 +05:30
|
|
|
if other_person.get_gender() == gen.lib.Person.MALE:
|
2007-10-16 14:11:25 +05:30
|
|
|
return (self.get_son(firstRel), common)
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-16 14:11:25 +05:30
|
|
|
return (self.get_daughter(firstRel), common)
|
|
|
|
elif secondRel > firstRel:
|
2007-10-26 04:45:28 +05:30
|
|
|
#other person is higher in the branch, in english uncle/aunt or
|
|
|
|
#cousin up, in dutch always 'oom/tante'
|
2007-10-08 22:11:39 +05:30
|
|
|
if other_person.get_gender() == gen.lib.Person.MALE:
|
2007-10-16 14:11:25 +05:30
|
|
|
return (self.get_uncle(secondRel - firstRel,firstRel), common)
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-16 14:11:25 +05:30
|
|
|
return (self.get_aunt(secondRel - firstRel, firstRel), common)
|
|
|
|
elif secondRel < firstRel:
|
2007-10-26 04:45:28 +05:30
|
|
|
#other person is lower in the branch, in english niece/nephew or
|
|
|
|
#cousin down, in dutch always 'neef/nicht'
|
2007-10-08 22:11:39 +05:30
|
|
|
if other_person.get_gender() == gen.lib.Person.MALE:
|
2007-10-16 14:11:25 +05:30
|
|
|
return (self.get_nephew(firstRel - secondRel, secondRel), common)
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-16 14:11:25 +05:30
|
|
|
return (self.get_niece(firstRel - secondRel, secondRel), common)
|
2006-12-30 02:22:33 +05:30
|
|
|
else:
|
2007-10-26 04:45:28 +05:30
|
|
|
# people on the same level secondRel == firstRel
|
|
|
|
if other_person.get_gender() == gen.lib.Person.MALE:
|
|
|
|
return (self.get_male_cousin(firstRel), common)
|
|
|
|
else:
|
|
|
|
return (self.get_female_cousin(firstRel), common)
|
2006-12-30 02:22:33 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Register this class with the Plugins system
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
register_relcalc(RelationshipCalculator,
|
2007-10-16 14:11:25 +05:30
|
|
|
["nl", "NL", "nl_NL", "nl_BE", "nederlands", "Nederlands", "nl_NL.UTF8",
|
|
|
|
"nl_BE.UTF8","nl_NL@euro", "nl_NL.UTF8@euro","nl_BE@euro",
|
|
|
|
"dutch","Dutch", "nl_NL.UTF-8", "nl_BE.UTF-8","nl_NL.utf-8",
|
|
|
|
"nl_BE.utf-8","nl_NL.utf8", "nl_BE.UTF-8", "nl_BE.UTF8@euro"])
|