From 6d4ca28dbffa08623753e472ae1da8ef2797cf34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Fri, 31 Oct 2008 14:55:20 +0000 Subject: [PATCH] update rules according to current name fields svn: r11226 --- src/Filters/Rules/Person/_HasNameOf.py | 33 +++++++++++++++++-------- src/Filters/Rules/Person/_RegExpName.py | 5 ++-- src/Filters/Rules/Person/_SearchName.py | 5 ++-- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/Filters/Rules/Person/_HasNameOf.py b/src/Filters/Rules/Person/_HasNameOf.py index 5bb65747d..461ffe237 100644 --- a/src/Filters/Rules/Person/_HasNameOf.py +++ b/src/Filters/Rules/Person/_HasNameOf.py @@ -1,7 +1,8 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2002-2007 Donald N. Allingham +# Copyright (C) 2007-2008 Brian G. Matherly # # 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 @@ -45,25 +46,37 @@ class HasNameOf(Rule): labels = [ _('Given name:'), _('Family name:'), _('Suffix:'), - _('person|Title:')] + _('person|Title:'), + _('Prefix:'), + _('Patronymic:'), + _('Call Name:'),] name = _('People with the ') description = _("Matches people with a specified (partial) name") category = _('General filters') def apply(self,db,person): - self.f = self.list[0] - self.l = self.list[1] - self.s = self.list[2] - self.t = self.list[3] + self.firstn = self.list[0] + self.lastn = self.list[1] + self.surn = self.list[2] + self.title = self.list[3] + self.prefix = self.list[4] + self.patr = self.list[5] + self.calln = self.list[6] for name in [person.get_primary_name()] + person.get_alternate_names(): val = 1 - if self.f and name.get_first_name().upper().find(self.f.upper()) == -1: + if self.firstn and name.get_first_name().upper().find(self.firstn.upper()) == -1: val = 0 - if self.l and name.get_surname().upper().find(self.l.upper()) == -1: + if self.lastn and name.get_surname().upper().find(self.lastn.upper()) == -1: val = 0 - if self.s and name.get_suffix().upper().find(self.s.upper()) == -1: + if self.surn and name.get_suffix().upper().find(self.surn.upper()) == -1: val = 0 - if self.t and name.get_title().upper().find(self.t.upper()) == -1: + if self.title and name.get_title().upper().find(self.title.upper()) == -1: + val = 0 + if self.prefix and name.get_prefix().upper().find(self.prefix.upper()) == -1: + val = 0 + if self.patr and name.get_patronymic().upper().find(self.patr.upper()) == -1: + val = 0 + if self.calln and name.get_call_name().upper().find(self.calln.upper()) == -1: val = 0 if val == 1: return True diff --git a/src/Filters/Rules/Person/_RegExpName.py b/src/Filters/Rules/Person/_RegExpName.py index 84e06662d..d6ae70acc 100644 --- a/src/Filters/Rules/Person/_RegExpName.py +++ b/src/Filters/Rules/Person/_RegExpName.py @@ -1,7 +1,8 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2002-2007 Donald N. Allingham +# Copyright (C) 2007-2008 Brian G. Matherly # # 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 @@ -59,7 +60,7 @@ class RegExpName(Rule): def apply(self,db,person): for name in [person.get_primary_name()] + person.get_alternate_names(): for field in [name.first_name, name.surname, name.suffix, name.title, - name.prefix, name.patronymic]: + name.prefix, name.patronymic, name.call_name]: if self.match.match(field): return True else: diff --git a/src/Filters/Rules/Person/_SearchName.py b/src/Filters/Rules/Person/_SearchName.py index a5d79af85..0ca762433 100644 --- a/src/Filters/Rules/Person/_SearchName.py +++ b/src/Filters/Rules/Person/_SearchName.py @@ -1,7 +1,8 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2002-2007 Donald N. Allingham +# Copyright (C) 2007-2008 Brian G. Matherly # # 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 @@ -53,7 +54,7 @@ class SearchName(Rule): for name in [person.get_primary_name()] + person.get_alternate_names(): for field in [name.first_name, name.surname, name.suffix, name.title, - name.prefix, name.patronymic]: + name.prefix, name.patronymic, name.call_name]: if src and field.upper().find(src) != -1: return True else: