In .:
* src/Filters/Rules/Family/__init__.py (editor_rule_list): Import and use new rule. * src/Filters/Rules/Family/Makefile.am (pkgdata_PYTHON): Ship new file. * src/Filters/Rules/Family/_HasAttribute.py: Add new rule. * src/Filters/Rules/Makefile.am (pkgdata_PYTHON): Ship new file. * src/Filters/Rules/_HasAttributeBase.py: Add base module. * src/Filters/Rules/_HasEventBase.py (apply): Use new API. In po: Add new files. svn: r7125
This commit is contained in:
parent
2b070e9e5a
commit
19a3a5fea4
@ -1,4 +1,11 @@
|
|||||||
2006-08-04 Alex Roitman <shura@gramps-project.org>
|
2006-08-04 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/Filters/Rules/Family/__init__.py (editor_rule_list): Import
|
||||||
|
and use new rule.
|
||||||
|
* src/Filters/Rules/Family/Makefile.am (pkgdata_PYTHON): Ship new file.
|
||||||
|
* src/Filters/Rules/Family/_HasAttribute.py: Add new rule.
|
||||||
|
* src/Filters/Rules/Makefile.am (pkgdata_PYTHON): Ship new file.
|
||||||
|
* src/Filters/Rules/_HasAttributeBase.py: Add base module.
|
||||||
|
* src/Filters/Rules/_HasEventBase.py (apply): Use new API.
|
||||||
* src/Filters/Rules/Person/_HasFamilyEvent.py (apply): Use new API.
|
* src/Filters/Rules/Person/_HasFamilyEvent.py (apply): Use new API.
|
||||||
* src/Filters/Rules/Person/_PersonWithIncompleteEvent.py
|
* src/Filters/Rules/Person/_PersonWithIncompleteEvent.py
|
||||||
(apply): Do not double-handle birth and death events.
|
(apply): Do not double-handle birth and death events.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
2006-08-04 Alex Roitman <shura@gramps-project.org>
|
2006-08-04 Alex Roitman <shura@gramps-project.org>
|
||||||
* POTFILES.in: Unlist plugins that are not shipped.
|
* POTFILES.in: Unlist plugins that are not shipped.
|
||||||
|
Add new files.
|
||||||
|
|
||||||
2006-08-03 Alex Roitman <shura@gramps-project.org>
|
2006-08-03 Alex Roitman <shura@gramps-project.org>
|
||||||
* POTFILES.in: Add new files.
|
* POTFILES.in: Add new files.
|
||||||
|
@ -372,6 +372,7 @@ src/Filters/_SearchBar.py
|
|||||||
src/Filters/_SearchFilter.py
|
src/Filters/_SearchFilter.py
|
||||||
src/Filters/_SidebarFilter.py
|
src/Filters/_SidebarFilter.py
|
||||||
src/Filters/Rules/_Everything.py
|
src/Filters/Rules/_Everything.py
|
||||||
|
src/Filters/Rules/_HasAttributeBase.py
|
||||||
src/Filters/Rules/_HasEventBase.py
|
src/Filters/Rules/_HasEventBase.py
|
||||||
src/Filters/Rules/_HasGrampsId.py
|
src/Filters/Rules/_HasGrampsId.py
|
||||||
src/Filters/Rules/_HasNoteRegexBase.py
|
src/Filters/Rules/_HasNoteRegexBase.py
|
||||||
@ -447,6 +448,7 @@ src/Filters/Rules/Person/_SearchName.py
|
|||||||
src/Filters/Rules/Family/__init__.py
|
src/Filters/Rules/Family/__init__.py
|
||||||
src/Filters/Rules/Family/_AllFamilies.py
|
src/Filters/Rules/Family/_AllFamilies.py
|
||||||
src/Filters/Rules/Family/_FamilyPrivate.py
|
src/Filters/Rules/Family/_FamilyPrivate.py
|
||||||
|
src/Filters/Rules/Family/_HasAttribute.py
|
||||||
src/Filters/Rules/Family/_HasEvent.py
|
src/Filters/Rules/Family/_HasEvent.py
|
||||||
src/Filters/Rules/Family/_HasIdOf.py
|
src/Filters/Rules/Family/_HasIdOf.py
|
||||||
src/Filters/Rules/Family/_HasNoteMatchingSubstringOf.py
|
src/Filters/Rules/Family/_HasNoteMatchingSubstringOf.py
|
||||||
|
@ -6,6 +6,7 @@ pkgdata_PYTHON = \
|
|||||||
_AllFamilies.py\
|
_AllFamilies.py\
|
||||||
_FamilyPrivate.py\
|
_FamilyPrivate.py\
|
||||||
_HasEvent.py\
|
_HasEvent.py\
|
||||||
|
_HasAttribute.py\
|
||||||
_HasIdOf.py\
|
_HasIdOf.py\
|
||||||
_HasNoteMatchingSubstringOf.py\
|
_HasNoteMatchingSubstringOf.py\
|
||||||
_HasNoteRegexp.py\
|
_HasNoteRegexp.py\
|
||||||
|
48
src/Filters/Rules/Family/_HasAttribute.py
Normal file
48
src/Filters/Rules/Family/_HasAttribute.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#
|
||||||
|
# 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: _HasAttribute.py 6529 2006-05-03 06:29:07Z rshura $
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from Filters.Rules._HasAttributeBase import HasAttributeBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasAttribute
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasAttribute(HasAttributeBase):
|
||||||
|
"""Rule that checks for a family with a particular family attribute"""
|
||||||
|
|
||||||
|
labels = [ _('Family attribute:'), _('Value:') ]
|
||||||
|
name = _('Families with the family <attribute>')
|
||||||
|
description = _("Matches families with the family attribute "
|
||||||
|
"of a particular value")
|
@ -48,4 +48,3 @@ class HasEvent(HasEventBase):
|
|||||||
_('Description:') ]
|
_('Description:') ]
|
||||||
name = _('Families with the <event>')
|
name = _('Families with the <event>')
|
||||||
description = _("Matches families with an event of a particular value")
|
description = _("Matches families with an event of a particular value")
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ from _RegExpIdOf import RegExpIdOf
|
|||||||
from _HasNoteRegexp import HasNoteRegexp
|
from _HasNoteRegexp import HasNoteRegexp
|
||||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
|
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
|
||||||
from _FamilyPrivate import FamilyPrivate
|
from _FamilyPrivate import FamilyPrivate
|
||||||
|
from _HasAttribute import HasAttribute
|
||||||
from _HasEvent import HasEvent
|
from _HasEvent import HasEvent
|
||||||
from _MatchesFilter import MatchesFilter
|
from _MatchesFilter import MatchesFilter
|
||||||
from _FatherHasNameOf import FatherHasNameOf
|
from _FatherHasNameOf import FatherHasNameOf
|
||||||
@ -51,6 +52,7 @@ editor_rule_list = [
|
|||||||
HasNoteMatchingSubstringOf,
|
HasNoteMatchingSubstringOf,
|
||||||
FamilyPrivate,
|
FamilyPrivate,
|
||||||
HasEvent,
|
HasEvent,
|
||||||
|
HasAttribute,
|
||||||
MatchesFilter,
|
MatchesFilter,
|
||||||
FatherHasNameOf,
|
FatherHasNameOf,
|
||||||
FatherHasIdOf,
|
FatherHasIdOf,
|
||||||
|
@ -7,6 +7,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules
|
|||||||
pkgdata_PYTHON = \
|
pkgdata_PYTHON = \
|
||||||
_Everything.py\
|
_Everything.py\
|
||||||
_HasEventBase.py\
|
_HasEventBase.py\
|
||||||
|
_HasAttributeBase.py\
|
||||||
_HasGrampsId.py\
|
_HasGrampsId.py\
|
||||||
_HasNoteRegexBase.py\
|
_HasNoteRegexBase.py\
|
||||||
_HasNoteSubstrBase.py\
|
_HasNoteSubstrBase.py\
|
||||||
|
@ -32,29 +32,17 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules._HasAttributeBase import HasAttributeBase
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# HasAttribute
|
# HasAttribute
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class HasAttribute(Rule):
|
class HasAttribute(HasAttributeBase):
|
||||||
"""Rule that checks for a person with a particular personal attribute"""
|
"""Rule that checks for a person with a particular personal attribute"""
|
||||||
|
|
||||||
labels = [ _('Personal attribute:'), _('Value:') ]
|
labels = [ _('Personal attribute:'), _('Value:') ]
|
||||||
name = _('People with the personal <attribute>')
|
name = _('People with the personal <attribute>')
|
||||||
description = _("Matches people with the personal attribute "
|
description = _("Matches people with the personal attribute "
|
||||||
"of a particular value")
|
"of a particular value")
|
||||||
category = _('General filters')
|
|
||||||
|
|
||||||
def apply(self,db,person):
|
|
||||||
if not self.list[0]:
|
|
||||||
return False
|
|
||||||
for attr in person.get_attribute_list():
|
|
||||||
name_match = self.list[0] == attr.get_type()
|
|
||||||
value_match = \
|
|
||||||
attr.get_value().upper().find(self.list[1].upper()) != -1
|
|
||||||
if name_match and value_match:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
64
src/Filters/Rules/_HasAttributeBase.py
Normal file
64
src/Filters/Rules/_HasAttributeBase.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#
|
||||||
|
# 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: _HasAttributeBase.py,v 1.1 2006/08/04 23:08:14 shura Exp $
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from RelLib import AttributeType
|
||||||
|
from Filters.Rules._Rule import Rule
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasAttribute
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasAttributeBase(Rule):
|
||||||
|
"""Rule that checks for an object with a particular attribute"""
|
||||||
|
|
||||||
|
labels = [ _('Attribute:'), _('Value:') ]
|
||||||
|
name = _('Objects with the <attribute>')
|
||||||
|
description = _("Matches objects with the given attribute "
|
||||||
|
"of a particular value")
|
||||||
|
category = _('General filters')
|
||||||
|
|
||||||
|
def apply(self,db,obj):
|
||||||
|
if not self.list[0]:
|
||||||
|
return False
|
||||||
|
for attr in obj.get_attribute_list():
|
||||||
|
specified_type = AttributeType()
|
||||||
|
specified_type.set_from_xml_str(self.list[0])
|
||||||
|
name_match = attr.get_type() == specified_type
|
||||||
|
|
||||||
|
value_match = \
|
||||||
|
attr.get_value().upper().find(self.list[1].upper()) != -1
|
||||||
|
if name_match and value_match:
|
||||||
|
return True
|
||||||
|
return False
|
@ -33,6 +33,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import DateHandler
|
import DateHandler
|
||||||
|
from RelLib import EventType
|
||||||
from Filters.Rules._Rule import Rule
|
from Filters.Rules._Rule import Rule
|
||||||
from Filters.Rules._RuleUtils import date_cmp
|
from Filters.Rules._RuleUtils import date_cmp
|
||||||
|
|
||||||
@ -69,8 +70,11 @@ class HasEventBase(Rule):
|
|||||||
continue
|
continue
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
val = True
|
val = True
|
||||||
if self.etype and event.get_type() != self.etype:
|
if self.etype:
|
||||||
val = False
|
specified_type = EventType()
|
||||||
|
specified_type.set_from_xml_str(self.etype)
|
||||||
|
if event.type != specified_type:
|
||||||
|
val = False
|
||||||
if self.list[3] and event.get_description().upper().find(
|
if self.list[3] and event.get_description().upper().find(
|
||||||
self.list[3].upper())==-1:
|
self.list[3].upper())==-1:
|
||||||
val = False
|
val = False
|
||||||
|
Loading…
Reference in New Issue
Block a user