update rules according to current name fields

svn: r11227
This commit is contained in:
Jérôme Rapinat 2008-10-31 14:55:49 +00:00
parent e99de3069a
commit 1ed6d38e1c
3 changed files with 29 additions and 14 deletions

View File

@ -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 <name>')
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

View File

@ -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:

View File

@ -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: