In .:
* src/Filters/SideBar/_PersonSidebarFilter.py: Minor changes. * src/Filters/SideBar/_FamilySidebarFilter.py: Add father, mother, and child search options. * src/Filters/Rules/Family/__init__.py: Expose new modules. * src/Filters/Rules/Family/_Search*Name.py: add new modules. * src/Filters/Rules/Family/Makefile.am (pkgdata_PYTHON): Ship new files In po: 2006-08-05 Alex Roitman <shura@gramps-project.org> * POTFILES.in: Add new files. svn: r7135
This commit is contained in:
		| @@ -1,4 +1,10 @@ | ||||
| 2006-08-05  Alex Roitman  <shura@gramps-project.org> | ||||
| 	* src/Filters/SideBar/_PersonSidebarFilter.py: Minor changes. | ||||
| 	* src/Filters/SideBar/_FamilySidebarFilter.py: Add father, mother, | ||||
| 	and child search options. | ||||
| 	* src/Filters/Rules/Family/__init__.py: Expose new modules. | ||||
| 	* src/Filters/Rules/Family/_Search*Name.py: add new modules. | ||||
| 	* src/Filters/Rules/Family/Makefile.am (pkgdata_PYTHON): Ship new files | ||||
| 	* src/Filters/Rules/Family/_MotherHasNameOf.py (apply): Handle | ||||
| 	missing parents. | ||||
| 	* src/Filters/Rules/Family/_MotherHasIdOf.py (apply): Handle | ||||
|   | ||||
| @@ -1,3 +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. | ||||
|   | ||||
| @@ -503,6 +503,9 @@ src/Filters/Rules/Family/_MotherHasNameOf.py | ||||
| src/Filters/Rules/Family/_ChildHasIdOf.py | ||||
| src/Filters/Rules/Family/_FatherHasNameOf.py | ||||
| src/Filters/Rules/Family/_ChildHasNameOf.py | ||||
| src/Filters/Rules/Family/_SearchFatherName.py | ||||
| src/Filters/Rules/Family/_SearchChildName.py | ||||
| src/Filters/Rules/Family/_SearchMotherName.py | ||||
|  | ||||
| # Filters.Rules.Event package | ||||
| src/Filters/Rules/Event/_MatchesFilter.py | ||||
|   | ||||
| @@ -19,7 +19,10 @@ pkgdata_PYTHON = \ | ||||
| 	_MotherHasNameOf.py\ | ||||
| 	_MotherHasIdOf.py\ | ||||
| 	_ChildHasNameOf.py\ | ||||
| 	_ChildHasIdOf.py | ||||
| 	_ChildHasIdOf.py\ | ||||
| 	_SearchFatherName\ | ||||
| 	_SearchMotherName\ | ||||
| 	_SearchChildName | ||||
|  | ||||
|  | ||||
| pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Family | ||||
|   | ||||
							
								
								
									
										55
									
								
								gramps2/src/Filters/Rules/Family/_SearchChildName.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								gramps2/src/Filters/Rules/Family/_SearchChildName.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | ||||
| # | ||||
| # 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 SearchName | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # HasNameOf | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| class SearchChildName(SearchName): | ||||
|     """Rule that checks for full or partial name matches""" | ||||
|  | ||||
|     name        = _('Families with any child matching the <name>') | ||||
|     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 | ||||
							
								
								
									
										56
									
								
								gramps2/src/Filters/Rules/Family/_SearchFatherName.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								gramps2/src/Filters/Rules/Family/_SearchFatherName.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| # | ||||
| # 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 SearchName | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # HasNameOf | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| class SearchFatherName(SearchName): | ||||
|     """Rule that checks for full or partial name matches""" | ||||
|  | ||||
|     name        = _('Families with father matching the <name>') | ||||
|     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 | ||||
							
								
								
									
										56
									
								
								gramps2/src/Filters/Rules/Family/_SearchMotherName.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								gramps2/src/Filters/Rules/Family/_SearchMotherName.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| # | ||||
| # 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 SearchName | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # HasNameOf | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| class SearchMotherName(SearchName): | ||||
|     """Rule that checks for full or partial name matches""" | ||||
|  | ||||
|     name        = _('Families with mother matching the <name>') | ||||
|     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 | ||||
| @@ -26,6 +26,10 @@ Package providing filter rules for GRAMPS. | ||||
|  | ||||
| __author__ = "Don Allingham" | ||||
|  | ||||
| from _SearchFatherName import SearchFatherName | ||||
| from _SearchMotherName import SearchMotherName | ||||
| from _SearchChildName import SearchChildName | ||||
|  | ||||
| from _HasRelType import HasRelType | ||||
| from _AllFamilies import AllFamilies | ||||
| from _HasIdOf import HasIdOf | ||||
|   | ||||
| @@ -60,6 +60,10 @@ class FamilySidebarFilter(SidebarFilter): | ||||
|  | ||||
|     def create_widget(self): | ||||
|         self.filter_id = gtk.Entry() | ||||
|         self.filter_father = gtk.Entry() | ||||
|         self.filter_mother = gtk.Entry() | ||||
|         self.filter_child = gtk.Entry() | ||||
|          | ||||
|         self.filter_event = RelLib.Event() | ||||
|         self.filter_event.set_type((RelLib.EventType.CUSTOM,'')) | ||||
|         self.etype = gtk.ComboBoxEntry() | ||||
| @@ -94,14 +98,20 @@ class FamilySidebarFilter(SidebarFilter): | ||||
| 	self.generic.set_active(0) | ||||
|  | ||||
|         self.add_text_entry(_('ID'), self.filter_id) | ||||
|         self.add_text_entry(_('Father'), self.filter_father) | ||||
|         self.add_text_entry(_('Mother'), self.filter_mother) | ||||
|         self.add_text_entry(_('Child'), self.filter_child) | ||||
|         self.add_entry(_('Relationship'), self.rtype) | ||||
|         self.add_entry(_('Has Event'), self.etype) | ||||
|         self.add_text_entry(_('Note'), self.filter_note) | ||||
|         self.add_entry(_('Family Event'), self.etype) | ||||
|         self.add_text_entry(_('Family Note'), self.filter_note) | ||||
|         self.add_entry(_('Custom filter'), self.generic) | ||||
|         self.add_entry(None, self.filter_regex) | ||||
|  | ||||
|     def clear(self, obj): | ||||
|         self.filter_id.set_text('') | ||||
|         self.filter_father.set_text('') | ||||
|         self.filter_mother.set_text('') | ||||
|         self.filter_child.set_text('') | ||||
|         self.filter_note.set_text('') | ||||
|         self.etype.child.set_text('') | ||||
|         self.rtype.child.set_text('') | ||||
| @@ -112,13 +122,18 @@ class FamilySidebarFilter(SidebarFilter): | ||||
|  | ||||
|     def get_filter(self): | ||||
|         gid = unicode(self.filter_id.get_text()).strip() | ||||
|         father = unicode(self.filter_father.get_text()).strip() | ||||
|         mother = unicode(self.filter_mother.get_text()).strip() | ||||
|         child = unicode(self.filter_child.get_text()).strip() | ||||
|         note = unicode(self.filter_note.get_text()).strip() | ||||
|         etype = self.filter_event.get_type().xml_str() | ||||
|         rtype = self.family_stub.get_relationship().xml_str() | ||||
|         regex = self.filter_regex.get_active() | ||||
| 	gen = self.generic.get_active() > 0 | ||||
|  | ||||
|         if not gid and not self.filter_event.get_type().xml_str() and \ | ||||
|            not self.family_stub.get_relationship().xml_str() and not note \ | ||||
|            and not gen: | ||||
|         empty = not (gid or father or mother or child or note | ||||
|                      or regex or etype or rtype or gen) | ||||
|         if empty: | ||||
|             generic_filter = None | ||||
|         else: | ||||
|             generic_filter = GenericFamilyFilter() | ||||
| @@ -129,13 +144,23 @@ class FamilySidebarFilter(SidebarFilter): | ||||
|                     rule = HasIdOf([gid]) | ||||
|                 generic_filter.add_rule(rule) | ||||
|  | ||||
|             etype = self.filter_event.get_type().xml_str() | ||||
|             if str(etype): | ||||
|             if father: | ||||
|                 rule = SearchFatherName([father]) | ||||
|                 generic_filter.add_rule(rule) | ||||
|  | ||||
|             if mother: | ||||
|                 rule = SearchMotherName([mother]) | ||||
|                 generic_filter.add_rule(rule) | ||||
|  | ||||
|             if child: | ||||
|                 rule = SearchChildName([child]) | ||||
|                 generic_filter.add_rule(rule) | ||||
|  | ||||
|             if etype: | ||||
|                 rule = HasEvent([etype, '', '', '']) | ||||
|                 generic_filter.add_rule(rule) | ||||
|  | ||||
|             rtype = self.family_stub.get_relationship().xml_str() | ||||
|             if str(rtype): | ||||
|             if rtype: | ||||
|                 rule = HasRelType([rtype]) | ||||
|                 generic_filter.add_rule(rule) | ||||
|                  | ||||
|   | ||||
| @@ -95,7 +95,7 @@ class PersonSidebarFilter(SidebarFilter): | ||||
|         self.add_entry(_('Gender'), self.filter_gender) | ||||
|         self.add_text_entry(_('Birth date'), self.filter_birth) | ||||
|         self.add_text_entry(_('Death date'), self.filter_death) | ||||
|         self.add_entry(_('Has Event'), self.etype) | ||||
|         self.add_entry(_('Event'), self.etype) | ||||
|         self.add_text_entry(_('Note'), self.filter_note) | ||||
|         self.add_entry(_('Custom filter'), self.generic) | ||||
|         self.add_entry(None, self.filter_regex) | ||||
| @@ -118,14 +118,15 @@ class PersonSidebarFilter(SidebarFilter): | ||||
|         gid = unicode(self.filter_id.get_text()).strip() | ||||
|         birth = unicode(self.filter_birth.get_text()).strip() | ||||
|         death = unicode(self.filter_death.get_text()).strip() | ||||
|         etype = self.filter_event.get_type().xml_str() | ||||
|         note = unicode(self.filter_note.get_text()).strip() | ||||
|         gender = self.filter_gender.get_active() | ||||
|         regex = self.filter_regex.get_active() | ||||
| 	gen = self.generic.get_active() > 0 | ||||
|  | ||||
|         if not name and not gid and not birth and not death \ | ||||
|                and not self.filter_event.get_type().xml_str() and \ | ||||
|                not note and not gender > 0 and not gen: | ||||
|         empty = not (name or gid or birth or death or etype | ||||
|                      or note or gedner or regex or gen) | ||||
|         if empty: | ||||
|             generic_filter = None | ||||
|         else: | ||||
|             generic_filter = GenericFilter() | ||||
| @@ -141,6 +142,7 @@ class PersonSidebarFilter(SidebarFilter): | ||||
|                 else: | ||||
|                     rule = MatchIdOf([gid]) | ||||
|                 generic_filter.add_rule(rule) | ||||
|  | ||||
|             if gender > 0: | ||||
|                 if gender == 1: | ||||
|                     generic_filter.add_rule(IsMale([])) | ||||
| @@ -149,8 +151,7 @@ class PersonSidebarFilter(SidebarFilter): | ||||
|                 else: | ||||
|                     generic_filter.add_rule(HasUnknownGender([])) | ||||
|  | ||||
|             etype = self.filter_event.get_type().xml_str() | ||||
|             if str(etype): | ||||
|             if etype: | ||||
|                 rule = HasEvent([etype, '', '', '']) | ||||
|                 generic_filter.add_rule(rule) | ||||
|                  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user