* src/Relationship.py (is_spouse): return translated spouse name,

based on gender and family relation.
* src/plugins/rel_*.py (get_relationship): use new spouse scheme.


svn: r4864
This commit is contained in:
Alex Roitman
2005-06-23 03:09:57 +00:00
parent e7fbc6c85e
commit 5553c74092
12 changed files with 60 additions and 62 deletions

View File

@@ -9,6 +9,9 @@
* src/FamilyView.py (remove_child_clicked): Prevent signal race. * src/FamilyView.py (remove_child_clicked): Prevent signal race.
* NEWS: Update. * NEWS: Update.
* src/TarFile.py (extract_files): insert missing 'replace' call. * src/TarFile.py (extract_files): insert missing 'replace' call.
* src/Relationship.py (is_spouse): return translated spouse name,
based on gender and family relation.
* src/plugins/rel_*.py (get_relationship): use new spouse scheme.
2005-06-21 Don Allingham <don@gramps-project.org> 2005-06-21 Don Allingham <don@gramps-project.org>
* src/GenericFilter.py: optimize a few filters * src/GenericFilter.py: optimize a few filters

View File

@@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2004 Donald N. Allingham # Copyright (C) 2003-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ _level_name = [ "", "first", "second", "third", "fourth", "fifth", "sixth",
_removed_level = [ "", " once removed", " twice removed", " three times removed", _removed_level = [ "", " once removed", " twice removed", " three times removed",
" four times removed", " five times removed", " six times removed", " four times removed", " five times removed", " six times removed",
" sevent times removed", " eight times removed", " nine times removed", " sevent times removed", " eight times removed", " nine times removed",
" ten times removed", " eleven times removed", " twelve times removed", " ten times removed", " eleven times removed", " twelve times removed",
" thirteen times removed", " fourteen times removed", " fifteen times removed", " thirteen times removed", " fourteen times removed", " fifteen times removed",
" sixteen times removed", " seventeen times removed", " eighteen times removed", " sixteen times removed", " seventeen times removed", " eighteen times removed",
@@ -240,12 +240,20 @@ class RelationshipCalculator:
def is_spouse(self,orig,other): def is_spouse(self,orig,other):
for f in orig.get_family_handle_list(): for f in orig.get_family_handle_list():
family = self.db.get_family_from_handle(f) family = self.db.get_family_from_handle(f)
if family: if family and other.get_handle() in [family.get_father_handle(),
if other.get_handle() == family.get_father_handle() or other.get_handle() == family.get_mother_handle(): family.get_mother_handle()]:
return 1 family_rel = family.get_relationship()
if other.get_gender() == RelLib.Person.MALE \
and family_rel != RelLib.Family.CIVIL_UNION:
return _("husband")
elif other.get_gender() == RelLib.Person.FEMALE\
and family_rel != RelLib.Family.CIVIL_UNION:
return _("wife")
else:
return _("partner")
else: else:
return 0 return None
return 0 return None
def get_relationship_distance(self,orig_person,other_person): def get_relationship_distance(self,orig_person,other_person):
""" """
@@ -304,8 +312,9 @@ class RelationshipCalculator:
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
return ("spouse",[]) 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)

View File

@@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2004 Donald N. Allingham # Copyright (C) 2003-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -147,11 +147,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
if other_person.get_gender() == RelLib.Person.MALE: if is_spouse:
return ("ægtefælle",[]) return (is_spouse,[])
else:
return ("hustru",[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person) (firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2004 Donald N. Allingham # Copyright (C) 2003-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -338,8 +338,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
return ("spouse",[]) 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)

View File

@@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2004 Donald N. Allingham # Copyright (C) 2003-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -254,11 +254,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
if other_person.get_gender() == RelLib.Person.MALE: if is_spouse:
return ("marido",[]) return (is_spouse,[])
else:
return ("mujer",[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person) (firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2004 Donald N. Allingham # Copyright (C) 2003-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -182,8 +182,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
return ("puoliso",[]) 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)

View File

@@ -154,11 +154,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
if other_person.get_gender() == RelLib.Person.MALE: if is_spouse:
return ("le mari",[]) return (is_spouse,[])
else:
return ("la femme",[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person) (firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2004 Donald N. Allingham # Copyright (C) 2003-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -268,13 +268,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
if other_person.get_gender() == RelLib.Person.MALE: if is_spouse:
#FIXME: husband return (is_spouse,[])
return ("spouse",[])
else:
#FIXME: wife
return ("spouse",[])
if self.is_fathermother_in_law(other_person,orig_person): if self.is_fathermother_in_law(other_person,orig_person):
if other_person.getGender() == RelLib.Person.MALE: if other_person.getGender() == RelLib.Person.MALE:

View File

@@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2004 Donald N. Allingham # Copyright (C) 2003-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -151,8 +151,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
return ("coniuge",[]) 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)

View File

@@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2004 Donald N. Allingham # Copyright (C) 2003-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -232,15 +232,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
return ('spouse', []) if is_spouse:
# FIXME: need Norwegian term for spouse. If gender-specific, use the code below. return (is_spouse,[])
# UPDATE by Frode: unsure about how it's included in the finished code, so I need
# to see this running to know if it is the right words to use.
# if other_person.get_gender() == RelLib.Person.MALE:
# return ("ektemann",[])
# else:
# return ("hustru",[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person) (firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2004 Donald N. Allingham # Copyright (C) 2003-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -206,8 +206,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
return ("spouse",[]) 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)

View File

@@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2003-2004 Donald N. Allingham # Copyright (C) 2003-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -187,11 +187,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if orig_person.get_handle() == other_person.get_handle(): if orig_person.get_handle() == other_person.get_handle():
return ('', []) return ('', [])
if self.is_spouse(orig_person,other_person): is_spouse = self.is_spouse(orig_person,other_person)
if other_person.get_gender() == RelLib.Person.MALE: if is_spouse:
return ("make",[]) return (is_spouse,[])
else:
return ("maka",[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person) (firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)