Fix Polish relationship problem

svn: r8719
This commit is contained in:
Alex Roitman 2007-07-16 21:17:57 +00:00
parent 6bc548cfb9
commit 01f50143d8
2 changed files with 66 additions and 61 deletions

View File

@ -1,3 +1,6 @@
2007-07-16 Piotr Czubaszek <pioterus@gmail.com>
* src/plugins/rel_pl.py: Update.
2007-07-16 Alex Roitman <shura@gramps-project.org> 2007-07-16 Alex Roitman <shura@gramps-project.org>
* src/Filters/Rules/Person/Makefile.am (pkgdata_PYTHON): Typo. * src/Filters/Rules/Person/Makefile.am (pkgdata_PYTHON): Typo.

View File

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
@ -274,20 +274,20 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# other_level+orig_level=stopień pokrewieństwa (degree of kinship) # other_level+orig_level=stopień pokrewieństwa (degree of kinship)
def get_junior_male_cousin_father_uncle(self,other_level,orig_level): def get_junior_male_cousin_father_uncle(self,other_level,orig_level):
if other_level == orig_level == 2: if other_level == orig_level == 2:
return "brat stryjeczny" return "brat stryjeczny"
else: else:
return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level) return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level)
def get_junior_male_cousin_mother_uncle(self,other_level,orig_level): def get_junior_male_cousin_mother_uncle(self,other_level,orig_level):
if other_level == orig_level == 2: if other_level == orig_level == 2:
return "brat wujeczny" return "brat wujeczny"
else: else:
return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level) return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level)
def get_junior_male_cousin_aunt(self,other_level,orig_level): def get_junior_male_cousin_aunt(self,other_level,orig_level):
if other_level == orig_level == 2: if other_level == orig_level == 2:
return "brat cioteczny" return "brat cioteczny"
else: else:
return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level) return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level)
@ -304,20 +304,20 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
return "daleki %s (%d. stopień pokrewieństwa)" % (_brother_level_of_female[level],other_level+orig_level) return "daleki %s (%d. stopień pokrewieństwa)" % (_brother_level_of_female[level],other_level+orig_level)
def get_junior_female_cousin_father_uncle(self,other_level,orig_level): def get_junior_female_cousin_father_uncle(self,other_level,orig_level):
if other_level == orig_level == 2: if other_level == orig_level == 2:
return "siostra stryjeczna" return "siostra stryjeczna"
else: else:
return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level) return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level)
def get_junior_female_cousin_mother_uncle(self,other_level,orig_level): def get_junior_female_cousin_mother_uncle(self,other_level,orig_level):
if other_level == orig_level == 2: if other_level == orig_level == 2:
return "siostra wujeczna" return "siostra wujeczna"
else: else:
return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level) return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level)
def get_junior_female_cousin_aunt(self,other_level,orig_level): def get_junior_female_cousin_aunt(self,other_level,orig_level):
if other_level == orig_level == 2: if other_level == orig_level == 2:
return "siostra cioteczna" return "siostra cioteczna"
else: else:
return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level) return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level)
@ -334,29 +334,29 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
return "daleka %s (%d. stopień pokrewieństwa)" % (_sister_level_of_female[level],other_level+orig_level) return "daleka %s (%d. stopień pokrewieństwa)" % (_sister_level_of_female[level],other_level+orig_level)
def get_father(self,other_level,orig_level): def get_father(self,other_level,orig_level):
level=other_level level=other_level
if level>len(_father_level)-1: if level>len(_father_level)-1:
return "oddalony pra*dziadek (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalony pra*dziadek (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _father_level[level] return _father_level[level]
def get_son(self,other_level,orig_level): def get_son(self,other_level,orig_level):
level=other_level level=orig_level
if level>len(_son_level)-1: if level>len(_son_level)-1:
return "oddalony pra*wnuk (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalony pra*wnuk (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _son_level[level] return _son_level[level]
def get_mother(self,other_level,orig_level): def get_mother(self,other_level,orig_level):
level=other_level level=other_level
if level>len(_mother_level)-1: if level>len(_mother_level)-1:
return "oddalona pra*babcia (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalona pra*babcia (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _mother_level[level] return _mother_level[level]
def get_daughter(self,other_level,orig_level): def get_daughter(self,other_level,orig_level):
level=other_level level=orig_level
if level>len(_daughter_level)-1: if level>len(_daughter_level)-1:
return "oddalona pra*wnuczka (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalona pra*wnuczka (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _daughter_level[level] return _daughter_level[level]
@ -390,56 +390,56 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
return _brother_level_of_female[level] return _brother_level_of_female[level]
def get_nephew_of_brothers_son(self,other_level,orig_level): def get_nephew_of_brothers_son(self,other_level,orig_level):
level=orig_level-1 level=orig_level-1
if level>len(_nephew_level_of_brothers_son)-1: if level>len(_nephew_level_of_brothers_son)-1:
return "oddalony pra*wnuk bratanka (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalony pra*wnuk bratanka (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _nephew_level_of_brothers_son[level] return _nephew_level_of_brothers_son[level]
def get_nephew_of_brothers_daughter(self,other_level,orig_level): def get_nephew_of_brothers_daughter(self,other_level,orig_level):
level=orig_level-1 level=orig_level-1
if level>len(_nephew_level_of_brothers_daughter)-1: if level>len(_nephew_level_of_brothers_daughter)-1:
return "oddalony pra*wnuk bratanicy (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalony pra*wnuk bratanicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _nephew_level_of_brothers_daughter[level] return _nephew_level_of_brothers_daughter[level]
def get_nephew_of_sisters_son(self,other_level,orig_level): def get_nephew_of_sisters_son(self,other_level,orig_level):
level=orig_level-1 level=orig_level-1
if level>len(_nephew_level_of_sisters_son)-1: if level>len(_nephew_level_of_sisters_son)-1:
return "oddalony pra*wnuk siostrzeńca (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalony pra*wnuk siostrzeńca (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _nephew_level_of_sisters_son[level] return _nephew_level_of_sisters_son[level]
def get_nephew_of_sisters_daughter(self,other_level,orig_level): def get_nephew_of_sisters_daughter(self,other_level,orig_level):
level=orig_level-1 level=orig_level-1
if level>len(_nephew_level_of_sisters_daughter)-1: if level>len(_nephew_level_of_sisters_daughter)-1:
return "oddalony pra*wnuk siostrzenicy (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalony pra*wnuk siostrzenicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _nephew_level_of_sisters_daughter[level] return _nephew_level_of_sisters_daughter[level]
def get_niece_of_brothers_son(self,other_level,orig_level): def get_niece_of_brothers_son(self,other_level,orig_level):
level=orig_level-1 level=orig_level-1
if level>len(_niece_level_of_brothers_son)-1: if level>len(_niece_level_of_brothers_son)-1:
return "oddalona pra*wnuczka bratanka (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalona pra*wnuczka bratanka (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _niece_level_of_brothers_son[level] return _niece_level_of_brothers_son[level]
def get_niece_of_brothers_daughter(self,other_level,orig_level): def get_niece_of_brothers_daughter(self,other_level,orig_level):
level=orig_level-1 level=orig_level-1
if level>len(_niece_level_of_brothers_daughter)-1: if level>len(_niece_level_of_brothers_daughter)-1:
return "oddalona pra*wnuczka bratanicy (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalona pra*wnuczka bratanicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _niece_level_of_brothers_daughter[level] return _niece_level_of_brothers_daughter[level]
def get_niece_of_sisters_son(self,other_level,orig_level): def get_niece_of_sisters_son(self,other_level,orig_level):
level=orig_level-1 level=orig_level-1
if level>len(_niece_level_of_sisters_son)-1: if level>len(_niece_level_of_sisters_son)-1:
return "oddalona pra*wnuczka siostrzeńca (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalona pra*wnuczka siostrzeńca (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
return _niece_level_of_sisters_son[level] return _niece_level_of_sisters_son[level]
def get_niece_of_sisters_daughter(self,other_level,orig_level): def get_niece_of_sisters_daughter(self,other_level,orig_level):
level=orig_level-1 level=orig_level-1
if level>len(_niece_level_of_sisters_daughter)-1: if level>len(_niece_level_of_sisters_daughter)-1:
return "oddalona pra*wnuczka siostrzenicy (%d. stopień pokrewieństwa)" %(other_level+orig_level) return "oddalona pra*wnuczka siostrzenicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else: else:
@ -518,7 +518,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
return ("",[]) return ("",[])
firstRel = len(firstRel) firstRel = len(firstRel)
secondRelatives = secondRel secondRelatives = secondRel
secondRel = len(secondRel) secondRel = len(secondRel)
if firstRel == 0: if firstRel == 0:
@ -659,7 +659,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
else: else:
return (self.get_senior_female_cousin_of_female(secondRel-firstRel+1,firstRel,secondRel),common) return (self.get_senior_female_cousin_of_female(secondRel-firstRel+1,firstRel,secondRel),common)
else: else:
families1 = self.db.get_person_from_handle(common[0]).get_family_handle_list() families1 = self.db.get_person_from_handle(common[0]).get_family_handle_list()
families2 = None families2 = None
if len(common) >1: if len(common) >1:
families2 = self.db.get_person_from_handle(common[1]).get_family_handle_list() families2 = self.db.get_person_from_handle(common[1]).get_family_handle_list()
@ -671,35 +671,36 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
continue continue
else: else:
ancFamily = self.db.get_family_from_handle(ancFamily_handle) ancFamily = self.db.get_family_from_handle(ancFamily_handle)
children = ancFamily.get_child_ref_list()
for sibling_handle in children: children = ancFamily.get_child_ref_list()
for sibling_handle in children:
if sibling_handle.ref in firstList: if sibling_handle.ref in firstList:
for other_sibling_handle in children: for other_sibling_handle in children:
if other_sibling_handle.ref in secondList: if other_sibling_handle.ref in secondList:
sibling = self.db.get_person_from_handle(sibling_handle.ref) sibling = self.db.get_person_from_handle(sibling_handle.ref)
other_sibling = self.db.get_person_from_handle(other_sibling_handle.ref) other_sibling = self.db.get_person_from_handle(other_sibling_handle.ref)
if other_person.get_gender() == RelLib.Person.MALE: if other_person.get_gender() == RelLib.Person.MALE:
if other_sibling.get_gender() == RelLib.Person.MALE: if other_sibling.get_gender() == RelLib.Person.MALE:
if sibling.get_gender() == RelLib.Person.MALE: if sibling.get_gender() == RelLib.Person.MALE:
# brat stryjeczny # brat stryjeczny
return (self.get_junior_male_cousin_father_uncle(secondRel,firstRel),common) return (self.get_junior_male_cousin_father_uncle(secondRel,firstRel),common)
else: else:
# brat wujeczny # brat wujeczny
return (self.get_junior_male_cousin_mother_uncle(secondRel,firstRel),common) return (self.get_junior_male_cousin_mother_uncle(secondRel,firstRel),common)
else: else:
# brat cioteczny # brat cioteczny
return (self.get_junior_male_cousin_aunt(secondRel,firstRel),common) return (self.get_junior_male_cousin_aunt(secondRel,firstRel),common)
else: else:
if other_sibling.get_gender() == RelLib.Person.MALE: if other_sibling.get_gender() == RelLib.Person.MALE:
if sibling.get_gender() == RelLib.Person.MALE: if sibling.get_gender() == RelLib.Person.MALE:
# siostra stryjeczna # siostra stryjeczna
return (self.get_junior_female_cousin_father_uncle(secondRel,firstRel),common) return (self.get_junior_female_cousin_father_uncle(secondRel,firstRel),common)
else: else:
# siostra wujeczna # siostra wujeczna
return (self.get_junior_female_cousin_mother_uncle(secondRel,firstRel),common) return (self.get_junior_female_cousin_mother_uncle(secondRel,firstRel),common)
else: else:
# siostra cioteczna # siostra cioteczna
return (self.get_junior_female_cousin_aunt(secondRel,firstRel),common) return (self.get_junior_female_cousin_aunt(secondRel,firstRel),common)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -708,3 +709,4 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
register_relcalc(RelationshipCalculator, register_relcalc(RelationshipCalculator,
["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"]) ["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"])