From b00fb3e75fcc96c7b428148f27a1b065b2f9a2a0 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 14 Dec 2006 07:04:53 +0000 Subject: [PATCH] In .: * src/Filters/Rules/Family/_RegExpFatherName.py: Add new module. * src/Filters/Rules/Family/_RegExpMotherName.py: Add new module. * src/Filters/Rules/Family/_RegExpChildName.py: Add new module. * src/Filters/SideBar/_FamilySidebarFilter.py (get_filter): Use regex filters. * src/Filters/Rules/Family/__init__.py: Expose new modules. * src/Filters/Rules/Family/Makefile.am: Ship new files. In po: 2006-12-13 Alex Roitman * POTFILES.in: List new files. svn: r7799 --- gramps2/ChangeLog | 7 +++ gramps2/po/ChangeLog | 3 ++ gramps2/po/POTFILES.in | 3 ++ gramps2/src/Filters/Rules/Family/Makefile.am | 3 ++ .../Filters/Rules/Family/_RegExpChildName.py | 51 +++++++++++++++++++ .../Filters/Rules/Family/_RegExpFatherName.py | 51 +++++++++++++++++++ .../Filters/Rules/Family/_RegExpMotherName.py | 51 +++++++++++++++++++ gramps2/src/Filters/Rules/Family/__init__.py | 3 ++ .../Filters/SideBar/_FamilySidebarFilter.py | 15 ++++-- 9 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 gramps2/src/Filters/Rules/Family/_RegExpChildName.py create mode 100644 gramps2/src/Filters/Rules/Family/_RegExpFatherName.py create mode 100644 gramps2/src/Filters/Rules/Family/_RegExpMotherName.py diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index f96ec12a6..a963e4b96 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,11 @@ 2006-12-13 Alex Roitman + * src/Filters/Rules/Family/_RegExpFatherName.py: Add new module. + * src/Filters/Rules/Family/_RegExpMotherName.py: Add new module. + * src/Filters/Rules/Family/_RegExpChildName.py: Add new module. + * src/Filters/SideBar/_FamilySidebarFilter.py (get_filter): Use + regex filters. + * src/Filters/Rules/Family/__init__.py: Expose new modules. + * src/Filters/Rules/Family/Makefile.am: Ship new files. * src/GrampsDb/_GrampsDbBase.py (_set_column_order): Correctly check for metadata being None. diff --git a/gramps2/po/ChangeLog b/gramps2/po/ChangeLog index ac3a343e0..18a5dfd71 100644 --- a/gramps2/po/ChangeLog +++ b/gramps2/po/ChangeLog @@ -1,3 +1,6 @@ +2006-12-13 Alex Roitman + * POTFILES.in: List new files. + 2006-12-10 Eero Tamminen * fi.po: merge with latest, fix all % mismatches and repo translations diff --git a/gramps2/po/POTFILES.in b/gramps2/po/POTFILES.in index 16a4378dd..9eb5fca3e 100644 --- a/gramps2/po/POTFILES.in +++ b/gramps2/po/POTFILES.in @@ -512,6 +512,9 @@ 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/_RegExpFatherName.py +src/Filters/Rules/Family/_RegExpMotherName.py +src/Filters/Rules/Family/_RegExpChildName.py src/Filters/Rules/Family/_MemberBase.py src/Filters/Rules/Family/_HasMarkerOf.py diff --git a/gramps2/src/Filters/Rules/Family/Makefile.am b/gramps2/src/Filters/Rules/Family/Makefile.am index 7a23ec7e0..a005d30a1 100644 --- a/gramps2/src/Filters/Rules/Family/Makefile.am +++ b/gramps2/src/Filters/Rules/Family/Makefile.am @@ -23,6 +23,9 @@ pkgdata_PYTHON = \ _SearchFatherName.py\ _SearchMotherName.py\ _SearchChildName.py\ + _RegExpFatherName.py\ + _RegExpMotherName.py\ + _RegExpChildName.py\ _MemberBase.py\ _HasMarkerOf.py diff --git a/gramps2/src/Filters/Rules/Family/_RegExpChildName.py b/gramps2/src/Filters/Rules/Family/_RegExpChildName.py new file mode 100644 index 000000000..2cda5441e --- /dev/null +++ b/gramps2/src/Filters/Rules/Family/_RegExpChildName.py @@ -0,0 +1,51 @@ +# +# 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$ + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules.Person import RegExpName +from _MemberBase import child_base + +#------------------------------------------------------------------------- +# +# RegExpChildName +# +#------------------------------------------------------------------------- +class RegExpChildName(RegExpName): + """Rule that checks for full or partial name matches""" + + name = _('Families with child matching the ') + description = _("Matches families where child has a name " + "matching a specified regular expression") + category = _('Child filters') + base_class = RegExpName + apply = child_base diff --git a/gramps2/src/Filters/Rules/Family/_RegExpFatherName.py b/gramps2/src/Filters/Rules/Family/_RegExpFatherName.py new file mode 100644 index 000000000..1f289d11d --- /dev/null +++ b/gramps2/src/Filters/Rules/Family/_RegExpFatherName.py @@ -0,0 +1,51 @@ +# +# 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$ + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules.Person import RegExpName +from _MemberBase import father_base + +#------------------------------------------------------------------------- +# +# RegExpFatherName +# +#------------------------------------------------------------------------- +class RegExpFatherName(RegExpName): + """Rule that checks for full or partial name matches""" + + name = _('Families with father matching the ') + description = _("Matches families whose father has a name " + "matching a specified regular expression") + category = _('Father filters') + base_class = RegExpName + apply = father_base diff --git a/gramps2/src/Filters/Rules/Family/_RegExpMotherName.py b/gramps2/src/Filters/Rules/Family/_RegExpMotherName.py new file mode 100644 index 000000000..e35c8620b --- /dev/null +++ b/gramps2/src/Filters/Rules/Family/_RegExpMotherName.py @@ -0,0 +1,51 @@ +# +# 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$ + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules.Person import RegExpName +from _MemberBase import mother_base + +#------------------------------------------------------------------------- +# +# RegExpMotherName +# +#------------------------------------------------------------------------- +class RegExpMotherName(RegExpName): + """Rule that checks for full or partial name matches""" + + name = _('Families with mother matching the ') + description = _("Matches families whose mother has a name " + "matching a specified regular expression") + category = _('Mother filters') + base_class = RegExpName + apply = mother_base diff --git a/gramps2/src/Filters/Rules/Family/__init__.py b/gramps2/src/Filters/Rules/Family/__init__.py index 9285aef27..cc2cec33a 100644 --- a/gramps2/src/Filters/Rules/Family/__init__.py +++ b/gramps2/src/Filters/Rules/Family/__init__.py @@ -29,6 +29,9 @@ __author__ = "Don Allingham" from _SearchFatherName import SearchFatherName from _SearchMotherName import SearchMotherName from _SearchChildName import SearchChildName +from _RegExpFatherName import RegExpFatherName +from _RegExpMotherName import RegExpMotherName +from _RegExpChildName import RegExpChildName from _HasRelType import HasRelType from _AllFamilies import AllFamilies diff --git a/gramps2/src/Filters/SideBar/_FamilySidebarFilter.py b/gramps2/src/Filters/SideBar/_FamilySidebarFilter.py index 85c981bd4..ca7bfbf32 100644 --- a/gramps2/src/Filters/SideBar/_FamilySidebarFilter.py +++ b/gramps2/src/Filters/SideBar/_FamilySidebarFilter.py @@ -148,15 +148,24 @@ class FamilySidebarFilter(SidebarFilter): generic_filter.add_rule(rule) if father: - rule = SearchFatherName([father]) + if regex: + rule = RegExpFatherName([father]) + else: + rule = SearchFatherName([father]) generic_filter.add_rule(rule) if mother: - rule = SearchMotherName([mother]) + if regex: + rule = RegExpMotherName([mother]) + else: + rule = SearchMotherName([mother]) generic_filter.add_rule(rule) if child: - rule = SearchChildName([child]) + if regex: + rule = RegExpChildName([child]) + else: + rule = SearchChildName([child]) generic_filter.add_rule(rule) if etype: