fixes contributed by Frederik De Richter and Benny Malengier

svn: r9193
This commit is contained in:
Stéphane Charette 2007-10-16 03:51:36 +00:00
parent 7a81e60adc
commit e3e4075435
2 changed files with 248 additions and 127 deletions

View File

@ -1,3 +1,8 @@
2007-10-15 Stephane Charette <stephanecharette@gmail.com>
* src/plugins/rel_nl.py: fixes contributed by Frederik De
Richter <frederik.de.richter@googlemail.com> and Benny
Malengier <benny.malengier@gramps-project.org>
2007-10-14 Benny Malengier <benny.malengier@gramps-project.org>
* src/DataViews/_PedigreeView.py: home person action added twice, gives warnings
in new GTK

View File

@ -39,14 +39,14 @@ from PluginUtils import register_relcalc
#
#-------------------------------------------------------------------------
_level_name = [ "",
"eerste",
"tweede",
"derde",
"vierde",
"vijfde",
"zesde",
"zevende",
_removed_level = [ " ",
" eerste graad",
" tweede graad",
" derde graad",
" vierde graad",
" vijfde graad",
" zesde graad",
" zevende graad",
" achtste",
" negende",
" tiende",
@ -57,7 +57,7 @@ _level_name = [ "",
" vijftiende",
" zestiende",
" zeventiende",
"acttiende",
" achttiende",
" negentiende",
" twintigste",
" eenentwintigste",
@ -75,48 +75,146 @@ _parents_level = [ "",
"ouders",
"grootouders",
"overgrootouders",
"betovergrootouders", ]
"betovergrootouders",
"oudouders",
"oudgrootouders",
"oudovergrootouders",
"oudbetovergrootouders",
"stamouders",
"stamgrootouders",
"stamovergrootouders",
"stambetovergrootouders",
"stamoudouders",
"stamoudgrootouders",
"stamoudovergrootouders",
"stamoudbetovergrootouders",
"edelouders",
"edelgrootoders",
"edelovergrootoudouders",
"edelbetovergrootouders",
"edeloudouders",
"edeloudgrootouders",
"edeloudvergrootouders",
"edeloudbetovergrootouders",
"edelstamouders",
"edelstamgrootouders",
"edelstamovergrootouders",
"edelstambetovergrootouders",
"edelstamoudouders" ]
_father_level = [ "",
"vader",
"grootvader",
"overgrootvader",
"betovergrootvader", ]
"vader (graad 1)",
"grootvader (graad 2)",
"overgrootvader (graad 3)",
"betovergrootvader (graad 4)",
"oudvader (graad 5)",
"oudgrootvader (graad 6)",
"oudovergrootvader(graad 7)",
"oudbetovergrootvader (graad 8)",
"stamvader graad 9)",
"stamgrootvader",
"stamovergrootvader",
"stambetovergrootvader",
"stamoudvader",
"stamoudgrootvader",
"stamoudovergrootvader",
"stamoudbetovergrootvader",
"edelvader",
"edelgrootvader",
"edelovergrootoudvader",
"edelbetovergrootvader",
"edeloudvader",
"edeloudgrootvader",
"edeloudvergrootvader",
"edeloudbetovergrootvader",
"edelstamvader",
"edelstamgrootvader",
"edelstamovergrootvader",
"edelstambetovergrootvader",
"edelstamoudvader" ]
_mother_level = [ "",
"moeder",
"grootmoeder",
"overgrootmoeder",
"betovergrootmoeder", ]
"moeder (graad 1)",
"grootmoeder (graad 2)",
"overgrootmoeder (graad 3)",
"betovergrootmoeder (graad 4)",
"oudmoeder",
"oudgrootmoeder",
"oudovergrootmoeder",
"oudbetovergrootmoeder",
"stammoeder",
"stamgrootmoeder",
"stamovergrootmoeder",
"stambetovergrootmoeder",
"stamoudmoeder",
"stamoudgrootmoeder",
"stamoudovergrootmoeder",
"stamoudbetovergrootmoeder",
"edelmoeder",
"edelgrootmoeder",
"edelovergrootoudmoeder",
"edelbetovergrootmoeder",
"edeloudmoeder",
"edeloudgrootmoeder",
"edeloudvergrootmoeder",
"edeloudbetovergrootmoeder",
"edelstammoeder",
"edelstamgrootmoeder",
"edelstamovergrootmoeder",
"edelstambetovergrootmoeder",
"edelstamoudmoeder" ]
_son_level = [ "",
"zoon",
"kleinzoon",
"achterkleinzoon", ]
"achterkleinzoon",
"achterachterkleinzoon",
"achterachterachterkleinzoon"]
_daughter_level = [ "",
"dochter",
"kleindochter",
"achterkleindochter", ]
"achterkleindochter",
"achterachterkleindochter",
"achterachterachterkleindochter"]
_sister_level = [ "",
"zuster",
"tante",
"groottante", ]
##_sister_level = [ "",
## "zuster",
## "tante",
## "groottante",
## "overgroottante" ,
## "betovergroottante",
## "oudtante"]
_brother_level = [ "",
"broer",
"oom",
"grootoom", ]
##_brother_level = [ "",
## "broer",
## "oom",
## "grootoom",
## "overgrootoom",
## "betovergrootoom",
## "oudoom" ]
_nephew_level = [ "",
"neef",
"achterneef", ]
"achterneef",
"achterachterneef" ]
_niece_level = [ "",
"nicht",
"achternicht", ]
"achternicht",
"achterachtenicht"]
_aunt_level = [ "",
"tante",
"groottante",
"overgroottante",
"betovergroottante",
"oudtante"]
_uncle_level = [ "",
"oom",
"grootoom",
"overgrootoom",
"betovergrootoom"]
#-------------------------------------------------------------------------
#
#
@ -127,24 +225,11 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
def __init__(self,db):
Relationship.RelationshipCalculator.__init__(self,db)
def get_male_cousin(self,level):
if level>len(_level_name)-1:
return "le parent lointain"
else:
return "neef in de %s graad" % (_level_name[level])
def get_female_cousin(self,level):
if level>len(_level_name)-1:
return "la parente lointaine"
else:
return "nicht in de %s graad" % (_level_name[level])
def get_parents(self, level):
if level>len(_parents_level)-1:
return "verre voorouders"
else:
return _parents_level[level]
def get_father(self, level):
if level>len(_father_level)-1:
return "verre voorouder"
@ -169,40 +254,55 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
else:
return _daughter_level[level]
def get_aunt(self,level):
if level>len(_sister_level)-1:
def get_aunt(self, level, removed):
if level>len(_aunt_level)-1 or removed > len(_removed_level) -1:
return "verre voorouder"
else:
return _sister_level[level]
def get_uncle(self,level):
if level>len(_brother_level)-1:
return _aunt_level[level] + _removed_level[removed]
def get_uncle(self, level, removed):
if level>len(_uncle_level)-1 or removed > len(_removed_level) -1:
return "verre voorouder"
else:
return _brother_level[level]
return _uncle_level[level] + _removed_level[removed]
def get_nephew(self,level):
if level>len(_nephew_level)-1:
return "verre afstammelling"
def get_nephew(self,level, removed):
if level>len(_nephew_level)-1 or removed > len(_removed_level) -1:
return "verre voorouder"
else:
return _nephew_level[level]
return _nephew_level[level] + _removed_level[removed]
def get_niece(self,level):
if level>len(_niece_level)-1:
def get_niece(self,level, removed):
if level>len(_niece_level)-1 or removed > len(_removed_level) -1:
return "verre afstammelinge"
else:
return _niece_level[level]
return _niece_level[level] + _removed_level[removed]
def get_male_cousin(self,removed):
if removed>len(_removed_level)-1:
return "verre afstammeling"
elif removed == 0:
return "broer"
else:
return "neef "+_removed_level[removed]
def get_female_cousin(self,removed):
if removed>len(_removed_level)-1:
return "verre afstammelinge"
elif removed == 0:
return " zus"
else:
return "nicht "+ _removed_level[removed]
def get_relationship(self,orig_person,other_person):
"""
Returns a string representing the relationshp between the two people,
Returns a string representing the relationshp between the two peopl
e,
along with a list of common ancestors (typically father,mother)
Special cases: relation strings "", "undefined" and "spouse".
"""
if orig_person == None:
return ("niet bepaalde",[])
return ("niet bepaald",[])
if orig_person.get_handle() == other_person.get_handle():
return ('', [])
@ -211,9 +311,11 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if is_spouse:
return (is_spouse,[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)
(firstRel,secondRel,common) = self.get_relationship_distance(orig
_person,other_person)
if type(common) == types.StringType or type(common) == types.UnicodeType:
if type(common) == types.StringType or type(common) == type
s.UnicodeType:
return (common,[])
elif common:
person_handle = common[0]
@ -235,42 +337,53 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
return (self.get_son(firstRel), common)
else:
return (self.get_daughter(firstRel), common)
elif firstRel == 1:
elif secondRel > firstRel:
if other_person.get_gender() == RelLib.Person.MALE:
return (self.get_uncle(secondRel),common)
return (self.get_uncle(secondRel - firstRel,firstRel), comm
on)
else:
return (self.get_aunt(secondRel),common)
elif secondRel == 1:
return (self.get_aunt(secondRel - firstRel, firstRel), comm
on)
elif secondRel < firstRel:
if other_person.get_gender() == RelLib.Person.MALE:
return (self.get_nephew(firstRel-1),common)
return (self.get_nephew(firstRel - secondRel, secondRel), c
ommon)
else:
return (self.get_niece(firstRel-1),common)
elif firstRel == 2 and secondRel == 2:
if other_person.get_gender() == RelLib.Person.MALE:
return ('le cousin germain',common)
else:
return ('la cousine germaine',common)
elif firstRel == 3 and secondRel == 2:
if other_person.get_gender() == RelLib.Person.MALE:
return ('le neveu à la mode de Bretagne',common)
else:
return ('la nièce à la mode de Bretagne',common)
elif firstRel == 2 and secondRel == 3:
if other_person.get_gender() == RelLib.Person.MALE:
return ('l\'oncle à la mode de Bretagne',common)
else:
return ('la tante à la mode de Bretagne',common)
return (self.get_niece(firstRel - secondRel, secondRel), co
mmon)
else:
if other_person.get_gender() == RelLib.Person.MALE:
if firstRel+secondRel>len(_level_name)-1:
return (self.get_male_cousin(firstRel+secondRel),common)
return (self.get_male_cousin(firstRel -1), common)
else:
return ('verre neef',common)
else:
if firstRel+secondRel>len(_level_name)-1:
return (self.get_female_cousin(firstRel+secondRel),common)
else:
return ('verre nicht',common)
return (self.get_female_cousin(firstRel -1), common)
## elif firstRel == 2 and secondRel == 2:
## if other_person.get_gender() == RelLib.Person.MALE:
## return ('de neef',common)
## else:
## return ('de nicht',common)
## elif firstRel == 3 and secondRel == 2:
## if other_person.get_gender() == RelLib.Person.MALE:
## return ('neef',common)
## else:
## return ('nicht',common)
## elif firstRel == 2 and secondRel == 3:
## if other_person.get_gender() == RelLib.Person.MALE:
## return ('de oom',common)
## else:
## return ('de tante',common)
## else:
## if other_person.get_gender() == RelLib.Person.MALE:
## if firstRel+secondRel>len(_level_name)-1:
## return (self.get_male_cousin(firstRel+secondRel),comm
on)
## else:
## return ('verre neef',common)
## else:
## if firstRel+secondRel>len(_level_name)-1:
## return (self.get_female_cousin(firstRel+secondRel),co
mmon)
## else:
## return ('verre nicht',common)
#-------------------------------------------------------------------------
#
@ -278,5 +391,8 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
#
#-------------------------------------------------------------------------
register_relcalc(RelationshipCalculator,
["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"])
["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"])