* 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.
* NEWS: Update.
* 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>
* src/GenericFilter.py: optimize a few filters

View File

@@ -1,7 +1,7 @@
#
# 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
# 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",
" 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",
" thirteen times removed", " fourteen times removed", " fifteen times removed",
" sixteen times removed", " seventeen times removed", " eighteen times removed",
@@ -240,12 +240,20 @@ class RelationshipCalculator:
def is_spouse(self,orig,other):
for f in orig.get_family_handle_list():
family = self.db.get_family_from_handle(f)
if family:
if other.get_handle() == family.get_father_handle() or other.get_handle() == family.get_mother_handle():
return 1
if family and other.get_handle() in [family.get_father_handle(),
family.get_mother_handle()]:
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:
return 0
return 0
return None
return None
def get_relationship_distance(self,orig_person,other_person):
"""
@@ -304,8 +312,9 @@ class RelationshipCalculator:
if orig_person.get_handle() == other_person.get_handle():
return ('', [])
if self.is_spouse(orig_person,other_person):
return ("spouse",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
#
# 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
# 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():
return ('', [])
if self.is_spouse(orig_person,other_person):
if other_person.get_gender() == RelLib.Person.MALE:
return ("ægtefælle",[])
else:
return ("hustru",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
#
# 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
# 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():
return ('', [])
if self.is_spouse(orig_person,other_person):
return ("spouse",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
#
# 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
# 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():
return ('', [])
if self.is_spouse(orig_person,other_person):
if other_person.get_gender() == RelLib.Person.MALE:
return ("marido",[])
else:
return ("mujer",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
#
# 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
# 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():
return ('', [])
if self.is_spouse(orig_person,other_person):
return ("puoliso",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
(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():
return ('', [])
if self.is_spouse(orig_person,other_person):
if other_person.get_gender() == RelLib.Person.MALE:
return ("le mari",[])
else:
return ("la femme",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
#
# 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
# 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():
return ('', [])
if self.is_spouse(orig_person,other_person):
if other_person.get_gender() == RelLib.Person.MALE:
#FIXME: husband
return ("spouse",[])
else:
#FIXME: wife
return ("spouse",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
if self.is_fathermother_in_law(other_person,orig_person):
if other_person.getGender() == RelLib.Person.MALE:

View File

@@ -2,7 +2,7 @@
#
# 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
# 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():
return ('', [])
if self.is_spouse(orig_person,other_person):
return ("coniuge",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
#
# 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
# 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():
return ('', [])
if self.is_spouse(orig_person,other_person):
return ('spouse', [])
# FIXME: need Norwegian term for spouse. If gender-specific, use the code below.
# 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",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
#
# 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
# 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():
return ('', [])
if self.is_spouse(orig_person,other_person):
return ("spouse",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)

View File

@@ -2,7 +2,7 @@
#
# 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
# 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():
return ('', [])
if self.is_spouse(orig_person,other_person):
if other_person.get_gender() == RelLib.Person.MALE:
return ("make",[])
else:
return ("maka",[])
is_spouse = self.is_spouse(orig_person,other_person)
if is_spouse:
return (is_spouse,[])
(firstRel,secondRel,common) = self.get_relationship_distance(orig_person,other_person)