In .:
* src/Filters/Rules/Family/Makefile.am (pkgdata_PYTHON): Ship new file. * src/Filters/Rules/Family/_MemberBase.py: Add new module. In po: svn: r7136
This commit is contained in:
parent
6137abcf43
commit
9f55696c0c
@ -1,4 +1,6 @@
|
||||
2006-08-05 Alex Roitman <shura@gramps-project.org>
|
||||
* src/Filters/Rules/Family/Makefile.am (pkgdata_PYTHON): Ship new file.
|
||||
* src/Filters/Rules/Family/_MemberBase.py: Add new module.
|
||||
* src/Filters/SideBar/_PersonSidebarFilter.py: Minor changes.
|
||||
* src/Filters/SideBar/_FamilySidebarFilter.py: Add father, mother,
|
||||
and child search options.
|
||||
|
@ -1,6 +1,6 @@
|
||||
2006-08-05 Alex Roitman <shura@gramps-project.org>
|
||||
* POTFILES.in: Add new files.
|
||||
|
||||
|
||||
2006-08-04 Alex Roitman <shura@gramps-project.org>
|
||||
* POTFILES.in: Unlist plugins that are not shipped.
|
||||
Add new files.
|
||||
|
@ -506,6 +506,7 @@ src/Filters/Rules/Family/_ChildHasNameOf.py
|
||||
src/Filters/Rules/Family/_SearchFatherName.py
|
||||
src/Filters/Rules/Family/_SearchChildName.py
|
||||
src/Filters/Rules/Family/_SearchMotherName.py
|
||||
src/Filters/Rules/Family/_MemberBase.py
|
||||
|
||||
# Filters.Rules.Event package
|
||||
src/Filters/Rules/Event/_MatchesFilter.py
|
||||
|
@ -20,9 +20,10 @@ pkgdata_PYTHON = \
|
||||
_MotherHasIdOf.py\
|
||||
_ChildHasNameOf.py\
|
||||
_ChildHasIdOf.py\
|
||||
_SearchFatherName\
|
||||
_SearchMotherName\
|
||||
_SearchChildName
|
||||
_SearchFatherName.py\
|
||||
_SearchMotherName.py\
|
||||
_SearchChildName.py\
|
||||
_MemberBase.py
|
||||
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Family
|
||||
|
@ -33,6 +33,7 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules import HasGrampsId
|
||||
from _MemberBase import child_base
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -47,10 +48,5 @@ class ChildHasIdOf(HasGrampsId):
|
||||
description = _("Matches familis where child has a specified "
|
||||
"GRAMPS ID")
|
||||
category = _('Child filters')
|
||||
|
||||
def apply(self,db,family):
|
||||
for child_ref in family.get_child_ref_list():
|
||||
child = db.get_person_from_handle(child_ref.ref)
|
||||
if HasGrampsId.apply(self,db,child):
|
||||
return True
|
||||
return False
|
||||
base_class = HasGrampsId
|
||||
apply = child_base
|
||||
|
@ -33,6 +33,7 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules.Person import HasNameOf
|
||||
from _MemberBase import child_base
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -46,10 +47,5 @@ class ChildHasNameOf(HasNameOf):
|
||||
description = _("Matches familis where child has a specified "
|
||||
"(partial) name")
|
||||
category = _('Child filters')
|
||||
|
||||
def apply(self,db,family):
|
||||
for child_ref in family.get_child_ref_list():
|
||||
child = db.get_person_from_handle(child_ref.ref)
|
||||
if HasNameOf.apply(self,db,child):
|
||||
return True
|
||||
return False
|
||||
base_class = HasNameOf
|
||||
apply = child_base
|
||||
|
@ -33,6 +33,7 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules import HasGrampsId
|
||||
from _MemberBase import father_base
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -47,11 +48,5 @@ class FatherHasIdOf(HasGrampsId):
|
||||
description = _("Matches familis whose father has a specified "
|
||||
"GRAMPS ID")
|
||||
category = _('Father filters')
|
||||
|
||||
def apply(self,db,family):
|
||||
father_handle = family.get_father_handle()
|
||||
father = db.get_person_from_handle(father_handle)
|
||||
if father:
|
||||
return HasGrampsId.apply(self,db,father)
|
||||
else:
|
||||
return False
|
||||
base_class = HasGrampsId
|
||||
apply = father_base
|
||||
|
@ -33,6 +33,7 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules.Person import HasNameOf
|
||||
from _MemberBase import father_base
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -46,11 +47,5 @@ class FatherHasNameOf(HasNameOf):
|
||||
description = _("Matches familis whose father has a specified "
|
||||
"(partial) name")
|
||||
category = _('Father filters')
|
||||
|
||||
def apply(self,db,family):
|
||||
father_handle = family.get_father_handle()
|
||||
father = db.get_person_from_handle(father_handle)
|
||||
if father:
|
||||
return HasNameOf.apply(self,db,father)
|
||||
else:
|
||||
return False
|
||||
base_class = HasNameOf
|
||||
apply = father_base
|
||||
|
57
gramps2/src/Filters/Rules/Family/_MemberBase.py
Normal file
57
gramps2/src/Filters/Rules/Family/_MemberBase.py
Normal file
@ -0,0 +1,57 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2002-2006 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Set of wrappers for family filter rules based on personal rules.
|
||||
|
||||
Any rule that matches family based on personal rule applied
|
||||
to father, mather, or any child, just needs to do two things:
|
||||
1. Set the class attribute 'base_class' to the personal rule
|
||||
2. Set apply method to be an appropriate wrapper below
|
||||
Example:
|
||||
in the class body, outside any method:
|
||||
base_class = SearchName
|
||||
apply = child_base
|
||||
"""
|
||||
|
||||
def father_base(self,db,family):
|
||||
father_handle = family.get_father_handle()
|
||||
father = db.get_person_from_handle(father_handle)
|
||||
if father:
|
||||
return self.base_class.apply(self,db,father)
|
||||
else:
|
||||
return False
|
||||
|
||||
def mother_base(self,db,family):
|
||||
mother_handle = family.get_mother_handle()
|
||||
mother = db.get_person_from_handle(mother_handle)
|
||||
if mother:
|
||||
return self.base_class.apply(self,db,mother)
|
||||
else:
|
||||
return False
|
||||
|
||||
def child_base(self,db,family):
|
||||
for child_ref in family.get_child_ref_list():
|
||||
child = db.get_person_from_handle(child_ref.ref)
|
||||
if self.base_class.apply(self,db,child):
|
||||
return True
|
||||
return False
|
@ -33,6 +33,7 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules import HasGrampsId
|
||||
from _MemberBase import mother_base
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -47,11 +48,5 @@ class MotherHasIdOf(HasGrampsId):
|
||||
description = _("Matches familis whose mother has a specified "
|
||||
"GRAMPS ID")
|
||||
category = _('Mother filters')
|
||||
|
||||
def apply(self,db,family):
|
||||
mother_handle = family.get_mother_handle()
|
||||
mother = db.get_person_from_handle(mother_handle)
|
||||
if mother:
|
||||
return HasGrampsId.apply(self,db,mother)
|
||||
else:
|
||||
return False
|
||||
base_class = HasGrampsId
|
||||
apply = mother_base
|
||||
|
@ -33,6 +33,7 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules.Person import HasNameOf
|
||||
from _MemberBase import mother_base
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -46,11 +47,5 @@ class MotherHasNameOf(HasNameOf):
|
||||
description = _("Matches familis whose mother has a specified "
|
||||
"(partial) name")
|
||||
category = _('Mother filters')
|
||||
|
||||
def apply(self,db,family):
|
||||
mother_handle = family.get_mother_handle()
|
||||
mother = db.get_person_from_handle(mother_handle)
|
||||
if mother:
|
||||
return HasNameOf.apply(self,db,mother)
|
||||
else:
|
||||
return False
|
||||
base_class = HasNameOf
|
||||
apply = mother_base
|
||||
|
@ -33,6 +33,7 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules.Person import SearchName
|
||||
from _MemberBase import child_base
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -46,10 +47,5 @@ class SearchChildName(SearchName):
|
||||
description = _("Matches families where any child has a specified "
|
||||
"(partial) name")
|
||||
category = _('Child filters')
|
||||
|
||||
def apply(self,db,family):
|
||||
for child_ref in family.get_child_ref_list():
|
||||
child = db.get_person_from_handle(child_ref.ref)
|
||||
if SearchName.apply(self,db,child):
|
||||
return True
|
||||
return False
|
||||
base_class = SearchName
|
||||
apply = child_base
|
||||
|
@ -33,6 +33,7 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules.Person import SearchName
|
||||
from _MemberBase import father_base
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -46,11 +47,5 @@ class SearchFatherName(SearchName):
|
||||
description = _("Matches families whose father has a specified "
|
||||
"(partial) name")
|
||||
category = _('Father filters')
|
||||
|
||||
def apply(self,db,family):
|
||||
father_handle = family.get_father_handle()
|
||||
father = db.get_person_from_handle(father_handle)
|
||||
if father:
|
||||
return SearchName.apply(self,db,father)
|
||||
else:
|
||||
return False
|
||||
base_class = SearchName
|
||||
apply = father_base
|
||||
|
@ -33,6 +33,7 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters.Rules.Person import SearchName
|
||||
from _MemberBase import mother_base
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -46,11 +47,5 @@ class SearchMotherName(SearchName):
|
||||
description = _("Matches families whose mother has a specified "
|
||||
"(partial) name")
|
||||
category = _('Mother filters')
|
||||
|
||||
def apply(self,db,family):
|
||||
mother_handle = family.get_mother_handle()
|
||||
mother = db.get_person_from_handle(mother_handle)
|
||||
if mother:
|
||||
return SearchName.apply(self,db,mother)
|
||||
else:
|
||||
return False
|
||||
base_class = SearchName
|
||||
apply = mother_base
|
||||
|
Loading…
Reference in New Issue
Block a user