From 10d597094abac772b661f5e766d6f5a8fb1a87c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Tue, 28 Oct 2008 08:41:43 +0000 Subject: [PATCH] 2465: More rules according to User Interface Object tabs svn: r11207 --- src/Filters/Rules/Family/_HasGallery.py | 44 ++++++++++++++++++ src/Filters/Rules/Family/_HasLDS.py | 47 +++++++++++++++++++ src/Filters/Rules/Family/__init__.py | 6 ++- src/Filters/Rules/Person/_HasAddress.py | 51 +++++++++++++++++++++ src/Filters/Rules/Person/_HasAssociation.py | 51 +++++++++++++++++++++ src/Filters/Rules/Person/_HasLDS.py | 47 +++++++++++++++++++ src/Filters/Rules/Person/_HavePhotos.py | 12 ++--- src/Filters/Rules/Person/__init__.py | 9 +++- src/Filters/Rules/_HasGalleryBase.py | 48 +++++++++++++++++++ src/Filters/Rules/_HasLDSBase.py | 51 +++++++++++++++++++++ 10 files changed, 356 insertions(+), 10 deletions(-) create mode 100755 src/Filters/Rules/Family/_HasGallery.py create mode 100755 src/Filters/Rules/Family/_HasLDS.py create mode 100755 src/Filters/Rules/Person/_HasAddress.py create mode 100755 src/Filters/Rules/Person/_HasAssociation.py create mode 100755 src/Filters/Rules/Person/_HasLDS.py create mode 100755 src/Filters/Rules/_HasGalleryBase.py create mode 100755 src/Filters/Rules/_HasLDSBase.py diff --git a/src/Filters/Rules/Family/_HasGallery.py b/src/Filters/Rules/Family/_HasGallery.py new file mode 100755 index 000000000..f80cb982b --- /dev/null +++ b/src/Filters/Rules/Family/_HasGallery.py @@ -0,0 +1,44 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2008 Brian G. Matherly +# Copyright (C) 2008 Jerome Rapinat +# Copyright (C) 2008 Benny Malengier +# +# 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 +# + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._HasGalleryBase import HasGalleryBase + +#------------------------------------------------------------------------- +# "Families who have images" +#------------------------------------------------------------------------- +class HasGallery(HasGalleryBase): + """Rule that checks for families who have Media object reference""" + + name = _('Family with images') + description = _("Matches family with images in the gallery") diff --git a/src/Filters/Rules/Family/_HasLDS.py b/src/Filters/Rules/Family/_HasLDS.py new file mode 100755 index 000000000..e73ceb580 --- /dev/null +++ b/src/Filters/Rules/Family/_HasLDS.py @@ -0,0 +1,47 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2008 Brian G. Matherly +# Copyright (C) 2008 Jerome Rapinat +# Copyright (C) 2008 Benny Malengier +# +# 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 +# + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- + +from Filters.Rules._HasLDSBase import HasLDSBase + +#------------------------------------------------------------------------- +# +# HasLDS +# +#------------------------------------------------------------------------- +class HasLDS(HasLDSBase): + """Rule that checks for family with a LDS event""" + + name = _('Family with LDS event') + description = _("Matches family with LDS event") diff --git a/src/Filters/Rules/Family/__init__.py b/src/Filters/Rules/Family/__init__.py index b3c0383be..9a4eec2af 100644 --- a/src/Filters/Rules/Family/__init__.py +++ b/src/Filters/Rules/Family/__init__.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 @@ -33,7 +34,9 @@ from _RegExpChildName import RegExpChildName from _HasRelType import HasRelType from _AllFamilies import AllFamilies +from _HasGallery import HasGallery from _HasIdOf import HasIdOf +from _HasLDS import HasLDS from _RegExpIdOf import RegExpIdOf from _HasNoteRegexp import HasNoteRegexp from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf @@ -55,6 +58,7 @@ editor_rule_list = [ AllFamilies, HasRelType, HasIdOf, + HasLDS, RegExpIdOf, HasNoteRegexp, HasNoteMatchingSubstringOf, diff --git a/src/Filters/Rules/Person/_HasAddress.py b/src/Filters/Rules/Person/_HasAddress.py new file mode 100755 index 000000000..d160c5956 --- /dev/null +++ b/src/Filters/Rules/Person/_HasAddress.py @@ -0,0 +1,51 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2008 Brian G. Matherly +# Copyright (C) 2008 Jerome Rapinat +# Copyright (C) 2008 Benny Malengier +# +# 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 +# + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- + +from Filters.Rules import Rule + +#------------------------------------------------------------------------- +# +# HasAddress +# +#------------------------------------------------------------------------- +class HasAddress(Rule): + """Rule that checks for a person with a personal address""" + + name = _('People with the personal address') + description = _("Matches people with the personal address") + category = _('General filters') + + def apply(self, db, person): + return len( person.get_address_list()) > 0 diff --git a/src/Filters/Rules/Person/_HasAssociation.py b/src/Filters/Rules/Person/_HasAssociation.py new file mode 100755 index 000000000..441528bc3 --- /dev/null +++ b/src/Filters/Rules/Person/_HasAssociation.py @@ -0,0 +1,51 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2008 Brian G. Matherly +# Copyright (C) 2008 Jerome Rapinat +# Copyright (C) 2008 Benny Malengier +# +# 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 +# + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- + +from Filters.Rules import Rule + +#------------------------------------------------------------------------- +# +# HasAssociation +# +#------------------------------------------------------------------------- +class HasAssociation(Rule): + """Rule that checks for a person with a personal association""" + + name = _('People with association') + description = _("Matches people with association") + category = _('General filters') + + def apply(self, db, person): + return len( person.get_person_ref_list()) > 0 diff --git a/src/Filters/Rules/Person/_HasLDS.py b/src/Filters/Rules/Person/_HasLDS.py new file mode 100755 index 000000000..6bcac5401 --- /dev/null +++ b/src/Filters/Rules/Person/_HasLDS.py @@ -0,0 +1,47 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2008 Brian G. Matherly +# Copyright (C) 2008 Jerome Rapinat +# Copyright (C) 2008 Benny Malengier +# +# 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 +# + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- + +from Filters.Rules._HasLDSBase import HasLDSBase + +#------------------------------------------------------------------------- +# +# HasLDS +# +#------------------------------------------------------------------------- +class HasLDS(HasLDSBase): + """Rule that checks for a person with a LDS event""" + + name = _('People with LDS event') + description = _("Matches people with LDS event") diff --git a/src/Filters/Rules/Person/_HavePhotos.py b/src/Filters/Rules/Person/_HavePhotos.py index bc0f7fdfd..b9822bc73 100644 --- a/src/Filters/Rules/Person/_HavePhotos.py +++ b/src/Filters/Rules/Person/_HavePhotos.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 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 @@ -32,17 +32,13 @@ from gettext import gettext as _ # GRAMPS modules # #------------------------------------------------------------------------- -from Filters.Rules._Rule import Rule +from Filters.Rules._HasGalleryBase import HasGalleryBase #------------------------------------------------------------------------- # "People who have images" #------------------------------------------------------------------------- -class HavePhotos(Rule): - """People who have images""" +class HavePhotos(HasGalleryBase): + """Rule that checks for people who have Media object reference""" name = _('People with images') description = _("Matches people with images in the gallery") - category = _('General filters') - - def apply(self,db,person): - return len( person.get_media_list()) > 0 diff --git a/src/Filters/Rules/Person/__init__.py b/src/Filters/Rules/Person/__init__.py index d86b7117d..d0d451093 100644 --- a/src/Filters/Rules/Person/__init__.py +++ b/src/Filters/Rules/Person/__init__.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 @@ -27,6 +28,8 @@ Package providing filter rules for GRAMPS. from _Disconnected import Disconnected from _Everyone import Everyone from _FamilyWithIncompleteEvent import FamilyWithIncompleteEvent +from _HasAddress import HasAddress +from _HasAssociation import HasAssociation from _HasAttribute import HasAttribute from _HasBirth import HasBirth from _HasCommonAncestorWith import HasCommonAncestorWith @@ -37,6 +40,7 @@ from _HasEvent import HasEvent from _HasFamilyAttribute import HasFamilyAttribute from _HasFamilyEvent import HasFamilyEvent from _HasIdOf import HasIdOf +from _HasLDS import HasLDS from _HasNameOf import HasNameOf from _HasNote import HasNote from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf @@ -107,7 +111,10 @@ editor_rule_list = [ IsMale, IsDefaultPerson, IsBookmarked, + HasAddress, + HasAssociation, HasIdOf, + HasLDS, HasNameOf, HasRelationship, HasDeath, diff --git a/src/Filters/Rules/_HasGalleryBase.py b/src/Filters/Rules/_HasGalleryBase.py new file mode 100755 index 000000000..04238f5ca --- /dev/null +++ b/src/Filters/Rules/_HasGalleryBase.py @@ -0,0 +1,48 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2008 Brian G. Matherly +# Copyright (C) 2008 Jerome Rapinat +# Copyright (C) 2008 Benny Malengier +# +# 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 +# + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules import Rule + +#------------------------------------------------------------------------- +# "People who have images" +#------------------------------------------------------------------------- +class HasGalleryBase(Rule): + """Objects who have Media Object""" + + name = _('Object with Media reference') + description = _("Matches objects with reference in the gallery") + category = _('General filters') + + def apply(self, db, obj): + return len( obj.get_media_list()) > 0 diff --git a/src/Filters/Rules/_HasLDSBase.py b/src/Filters/Rules/_HasLDSBase.py new file mode 100755 index 000000000..2a8cb510b --- /dev/null +++ b/src/Filters/Rules/_HasLDSBase.py @@ -0,0 +1,51 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2008 Brian G. Matherly +# Copyright (C) 2008 Jerome Rapinat +# Copyright (C) 2008 Benny Malengier +# +# 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 +# + +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- + +from Filters.Rules import Rule + +#------------------------------------------------------------------------- +# +# HasLDSBase +# +#------------------------------------------------------------------------- +class HasLDSBase(Rule): + """Rule that checks for object with a LDS event""" + + name = _('Object with LDS event') + description = _("Matches object with LDS event") + category = _('General filters') + + def apply(self, db, obj): + return len( obj.get_media_list()) > 0