In .:
* src/DataViews/_PlaceView.py: Add sidebar filter. * src/FilterEditor/_EditRule.py: Support place filters. * src/FilterEditor/_FilterEditor.py: Support place filters. * src/FilterEditor/_ShowResults.py: Support place filters. * src/Filters/_GenericFilter.py: Support place filters. * src/Filters/SideBar/__init__.py: Expose new module. * src/Filters/SideBar/Makefile.am (pkgdata_PYTHON): Ship new file. * src/Filters/SideBar/_PlaceSidebarFilter.py: Add module. * src/Filters/Rules/Place/Makefile.am (pkgdata_PYTHON): Ship new files. * src/Filters/Rules/Place/_AllPlaces.py: Add module. * src/Filters/Rules/Place/_HasIdOf.py: Add module. * src/Filters/Rules/Place/_HasNoteMatchingSubstringOf.py: Add module. * src/Filters/Rules/Place/_HasNoteRegexp.py: Add module. * src/Filters/Rules/Place/_MatchesFilter.py: Add module. * src/Filters/Rules/Place/_RegExpIdOf.py: Add module. * src/Filters/Rules/Place/_PlacePrivate.py: Add module. * src/Filters/Rules/Place/_HasPlace.py: Add module. * src/Filters/Rules/Place/__init__.py (editor_rule_list): Expose new module. In po: 2006-08-06 Alex Roitman <shura@gramps-project.org> * POTFILES.in: Add new files. svn: r7142
This commit is contained in:
parent
096c7dde80
commit
7c742ec66a
20
ChangeLog
20
ChangeLog
@ -1,4 +1,24 @@
|
|||||||
2006-08-06 Alex Roitman <shura@gramps-project.org>
|
2006-08-06 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/DataViews/_PlaceView.py: Add sidebar filter.
|
||||||
|
* src/FilterEditor/_EditRule.py: Support place filters.
|
||||||
|
* src/FilterEditor/_FilterEditor.py: Support place filters.
|
||||||
|
* src/FilterEditor/_ShowResults.py: Support place filters.
|
||||||
|
* src/Filters/_GenericFilter.py: Support place filters.
|
||||||
|
* src/Filters/SideBar/__init__.py: Expose new module.
|
||||||
|
* src/Filters/SideBar/Makefile.am (pkgdata_PYTHON): Ship new file.
|
||||||
|
* src/Filters/SideBar/_PlaceSidebarFilter.py: Add module.
|
||||||
|
* src/Filters/Rules/Place/Makefile.am (pkgdata_PYTHON): Ship new files.
|
||||||
|
* src/Filters/Rules/Place/_AllPlaces.py: Add module.
|
||||||
|
* src/Filters/Rules/Place/_HasIdOf.py: Add module.
|
||||||
|
* src/Filters/Rules/Place/_HasNoteMatchingSubstringOf.py: Add module.
|
||||||
|
* src/Filters/Rules/Place/_HasNoteRegexp.py: Add module.
|
||||||
|
* src/Filters/Rules/Place/_MatchesFilter.py: Add module.
|
||||||
|
* src/Filters/Rules/Place/_RegExpIdOf.py: Add module.
|
||||||
|
* src/Filters/Rules/Place/_PlacePrivate.py: Add module.
|
||||||
|
* src/Filters/Rules/Place/_HasPlace.py: Add module.
|
||||||
|
* src/Filters/Rules/Place/__init__.py (editor_rule_list): Expose
|
||||||
|
new module.
|
||||||
|
|
||||||
* src/GrampsDb/_GrampsBSDDB.py (GrampsBSDDB.close): Try to reset
|
* src/GrampsDb/_GrampsBSDDB.py (GrampsBSDDB.close): Try to reset
|
||||||
the log sequence numbers to make grdb file portable.
|
the log sequence numbers to make grdb file portable.
|
||||||
* data/gramps.schemas.in: Typo.
|
* data/gramps.schemas.in: Typo.
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
2006-08-06 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* POTFILES.in: Add new files.
|
||||||
|
|
||||||
2006-08-05 Alex Roitman <shura@gramps-project.org>
|
2006-08-05 Alex Roitman <shura@gramps-project.org>
|
||||||
* POTFILES.in: Add new files.
|
* POTFILES.in: Add new files.
|
||||||
|
|
||||||
|
@ -520,6 +520,14 @@ src/Filters/Rules/Event/_HasNoteMatchingSubstringOf.py
|
|||||||
src/Filters/Rules/Event/__init__.py
|
src/Filters/Rules/Event/__init__.py
|
||||||
|
|
||||||
# Filters.Rules.Place package
|
# Filters.Rules.Place package
|
||||||
|
src/Filters/Rules/Place/_AllPlaces.py
|
||||||
|
src/Filters/Rules/Place/_HasIdOf.py
|
||||||
|
src/Filters/Rules/Place/_HasNoteMatchingSubstringOf.py
|
||||||
|
src/Filters/Rules/Place/_HasNoteRegexp.py
|
||||||
|
src/Filters/Rules/Place/_HasPlace.py
|
||||||
|
src/Filters/Rules/Place/_MatchesFilter.py
|
||||||
|
src/Filters/Rules/Place/_PlacePrivate.py
|
||||||
|
src/Filters/Rules/Place/_RegExpIdOf.py
|
||||||
src/Filters/Rules/Place/__init__.py
|
src/Filters/Rules/Place/__init__.py
|
||||||
|
|
||||||
# Filters.Rules.Source package
|
# Filters.Rules.Source package
|
||||||
@ -545,6 +553,7 @@ src/Filters/SideBar/_FamilySidebarFilter.py
|
|||||||
src/Filters/SideBar/_PersonSidebarFilter.py
|
src/Filters/SideBar/_PersonSidebarFilter.py
|
||||||
src/Filters/SideBar/_SidebarFilter.py
|
src/Filters/SideBar/_SidebarFilter.py
|
||||||
src/Filters/SideBar/_SourceSidebarFilter.py
|
src/Filters/SideBar/_SourceSidebarFilter.py
|
||||||
|
src/Filters/SideBar/_PlaceSidebarFilter.py
|
||||||
|
|
||||||
# FilterEditor package
|
# FilterEditor package
|
||||||
src/FilterEditor/_FilterEditor.py
|
src/FilterEditor/_FilterEditor.py
|
||||||
|
@ -37,9 +37,11 @@ import DisplayModels
|
|||||||
import Utils
|
import Utils
|
||||||
import Errors
|
import Errors
|
||||||
import Bookmarks
|
import Bookmarks
|
||||||
|
import const
|
||||||
|
import Config
|
||||||
from Editors import EditPlace, DeletePlaceQuery
|
from Editors import EditPlace, DeletePlaceQuery
|
||||||
from QuestionDialog import QuestionDialog, ErrorDialog
|
from QuestionDialog import QuestionDialog, ErrorDialog
|
||||||
|
from Filters.SideBar import PlaceSidebarFilter
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -87,7 +89,11 @@ class PlaceView(PageView.ListView):
|
|||||||
len(column_names), DisplayModels.PlaceModel, signal_map,
|
len(column_names), DisplayModels.PlaceModel, signal_map,
|
||||||
dbstate.db.get_place_bookmarks(),
|
dbstate.db.get_place_bookmarks(),
|
||||||
Bookmarks.PlaceBookmarks,
|
Bookmarks.PlaceBookmarks,
|
||||||
multiple=True)
|
multiple=True,
|
||||||
|
filter_class=PlaceSidebarFilter)
|
||||||
|
|
||||||
|
Config.client.notify_add("/apps/gramps/interface/filter",
|
||||||
|
self.filter_toggle)
|
||||||
|
|
||||||
def get_bookmarks(self):
|
def get_bookmarks(self):
|
||||||
return self.dbstate.db.get_place_bookmarks()
|
return self.dbstate.db.get_place_bookmarks()
|
||||||
@ -101,6 +107,27 @@ class PlaceView(PageView.ListView):
|
|||||||
self.add_action('GoogleMaps', gtk.STOCK_JUMP_TO, _('_Google Maps'),
|
self.add_action('GoogleMaps', gtk.STOCK_JUMP_TO, _('_Google Maps'),
|
||||||
callback=self.google,
|
callback=self.google,
|
||||||
tip=_("Attempt to map location on Google Maps"))
|
tip=_("Attempt to map location on Google Maps"))
|
||||||
|
self.add_action('FilterEdit', None, _('Place Filter Editor'),
|
||||||
|
callback=self.filter_editor,)
|
||||||
|
|
||||||
|
def filter_toggle(self, client, cnxn_id, etnry, data):
|
||||||
|
if Config.get(Config.FILTER):
|
||||||
|
self.search_bar.hide()
|
||||||
|
self.filter_pane.show()
|
||||||
|
active = True
|
||||||
|
else:
|
||||||
|
self.search_bar.show()
|
||||||
|
self.filter_pane.hide()
|
||||||
|
active = False
|
||||||
|
|
||||||
|
def filter_editor(self,obj):
|
||||||
|
from FilterEditor import FilterEditor
|
||||||
|
|
||||||
|
try:
|
||||||
|
FilterEditor('Place',const.custom_filters,
|
||||||
|
self.dbstate,self.uistate)
|
||||||
|
except Errors.WindowActiveError:
|
||||||
|
pass
|
||||||
|
|
||||||
def google(self, obj):
|
def google(self, obj):
|
||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
@ -156,6 +183,7 @@ class PlaceView(PageView.ListView):
|
|||||||
<menuitem action="Remove"/>
|
<menuitem action="Remove"/>
|
||||||
</placeholder>
|
</placeholder>
|
||||||
<menuitem action="ColumnEdit"/>
|
<menuitem action="ColumnEdit"/>
|
||||||
|
<menuitem action="FilterEdit"/>
|
||||||
<placeholder name="Merge">
|
<placeholder name="Merge">
|
||||||
<menuitem action="FastMerge"/>
|
<menuitem action="FastMerge"/>
|
||||||
</placeholder>
|
</placeholder>
|
||||||
|
@ -375,6 +375,8 @@ class EditRule(ManagedWindow.ManagedWindow):
|
|||||||
class_list = Rules.Event.editor_rule_list
|
class_list = Rules.Event.editor_rule_list
|
||||||
elif self.space == 'Source':
|
elif self.space == 'Source':
|
||||||
class_list = Rules.Source.editor_rule_list
|
class_list = Rules.Source.editor_rule_list
|
||||||
|
elif self.space == 'Place':
|
||||||
|
class_list = Rules.Place.editor_rule_list
|
||||||
|
|
||||||
for class_obj in class_list:
|
for class_obj in class_list:
|
||||||
arglist = class_obj.labels
|
arglist = class_obj.labels
|
||||||
|
@ -176,3 +176,5 @@ class FilterEditor(ManagedWindow.ManagedWindow):
|
|||||||
return self.db.get_event_handles()
|
return self.db.get_event_handles()
|
||||||
elif self.space == 'Source':
|
elif self.space == 'Source':
|
||||||
return self.db.get_source_handles()
|
return self.db.get_source_handles()
|
||||||
|
elif self.space == 'Place':
|
||||||
|
return self.db.get_place_handles()
|
||||||
|
@ -119,6 +119,10 @@ class ShowResults(ManagedWindow.ManagedWindow):
|
|||||||
source = self.db.get_source_from_handle(handle)
|
source = self.db.get_source_from_handle(handle)
|
||||||
name = source.get_title()
|
name = source.get_title()
|
||||||
gid = source.get_gramps_id()
|
gid = source.get_gramps_id()
|
||||||
|
elif self.space == 'Place':
|
||||||
|
place = self.db.get_place_from_handle(handle)
|
||||||
|
name = place.get_title()
|
||||||
|
gid = place.get_gramps_id()
|
||||||
return (name,gid)
|
return (name,gid)
|
||||||
|
|
||||||
def sort_val_from_handle(self, handle):
|
def sort_val_from_handle(self, handle):
|
||||||
@ -135,4 +139,7 @@ class ShowResults(ManagedWindow.ManagedWindow):
|
|||||||
elif self.space == 'Source':
|
elif self.space == 'Source':
|
||||||
name = self.db.get_source_from_handle(handle).get_title()
|
name = self.db.get_source_from_handle(handle).get_title()
|
||||||
sortname = locale.strxfrm(name)
|
sortname = locale.strxfrm(name)
|
||||||
|
elif self.space == 'Place':
|
||||||
|
name = self.db.get_place_from_handle(handle).get_title()
|
||||||
|
sortname = locale.strxfrm(name)
|
||||||
return (sortname,handle)
|
return (sortname,handle)
|
||||||
|
@ -3,6 +3,14 @@
|
|||||||
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Place
|
pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Place
|
||||||
|
|
||||||
pkgdata_PYTHON = \
|
pkgdata_PYTHON = \
|
||||||
|
_AllPlaces.py\
|
||||||
|
_HasIdOf.py\
|
||||||
|
_HasNoteMatchingSubstringOf.py\
|
||||||
|
_HasNoteRegexp.py\
|
||||||
|
_HasPlace.py\
|
||||||
|
_MatchesFilter.py\
|
||||||
|
_PlacePrivate.py\
|
||||||
|
_RegExpIdOf.py\
|
||||||
__init__.py
|
__init__.py
|
||||||
|
|
||||||
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Place
|
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Place
|
||||||
|
46
src/Filters/Rules/Place/_AllPlaces.py
Normal file
46
src/Filters/Rules/Place/_AllPlaces.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#
|
||||||
|
# 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._Everything import Everything
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Everyone
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class AllPlaces(Everything):
|
||||||
|
"""Matches Everyone"""
|
||||||
|
|
||||||
|
name = _('Every place')
|
||||||
|
description = _('Matches every place in the database')
|
46
src/Filters/Rules/Place/_HasIdOf.py
Normal file
46
src/Filters/Rules/Place/_HasIdOf.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#
|
||||||
|
# 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 import HasGrampsId
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasIdOf
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasIdOf(HasGrampsId):
|
||||||
|
"""Rule that checks for a place with a specific GRAMPS ID"""
|
||||||
|
|
||||||
|
name = _('Place with <Id>')
|
||||||
|
description = _("Matches a place with a specified GRAMPS ID")
|
46
src/Filters/Rules/Place/_HasNoteMatchingSubstringOf.py
Normal file
46
src/Filters/Rules/Place/_HasNoteMatchingSubstringOf.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#
|
||||||
|
# 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._HasNoteSubstrBase import HasNoteSubstrBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# "Events having notes that contain a substring"
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasNoteMatchingSubstringOf(HasNoteSubstrBase):
|
||||||
|
"""Places having notes containing <subtring>"""
|
||||||
|
|
||||||
|
name = _('Places having notes containing <substring>')
|
||||||
|
description = _("Matches places whose notes contain text "
|
||||||
|
"matching a substring")
|
||||||
|
|
44
src/Filters/Rules/Place/_HasNoteRegexp.py
Normal file
44
src/Filters/Rules/Place/_HasNoteRegexp.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#
|
||||||
|
# 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._HasNoteRegexBase import HasNoteRegexBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# "Places having notes that contain a substring"
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasNoteRegexp(HasNoteRegexBase):
|
||||||
|
|
||||||
|
name = _('Places having notes containing <regular expression>')
|
||||||
|
description = _("Matches places whose notes contain text "
|
||||||
|
"matching a regular expression")
|
87
src/Filters/Rules/Place/_HasPlace.py
Normal file
87
src/Filters/Rules/Place/_HasPlace.py
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
#
|
||||||
|
# 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._Rule import Rule
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasEvent
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class HasPlace(Rule):
|
||||||
|
"""Rule that checks for a place with a particular value"""
|
||||||
|
|
||||||
|
|
||||||
|
labels = [ _('Name:'),
|
||||||
|
_('Church Parish:'),
|
||||||
|
_('ZIP/Postal Code:'),
|
||||||
|
_('City:'),
|
||||||
|
_('County:'),
|
||||||
|
_('State:'),
|
||||||
|
_('Country:'),
|
||||||
|
]
|
||||||
|
name = _('Places matching parameters')
|
||||||
|
description = _("Matches places with particular parameters")
|
||||||
|
category = _('General filters')
|
||||||
|
|
||||||
|
def apply(self,db,place):
|
||||||
|
if not self.match_substring(0,place.get_title()):
|
||||||
|
return False
|
||||||
|
|
||||||
|
for loc in [place.main_loc] + place.alt_loc:
|
||||||
|
if not loc:
|
||||||
|
# Empty mail locaiton does not contradict any parameters
|
||||||
|
return True
|
||||||
|
|
||||||
|
if not self.match_substring(1,loc.get_parish()):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not self.match_substring(2,loc.get_postal_code()):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not self.match_substring(3,loc.get_city()):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not self.match_substring(4,loc.get_county()):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not self.match_substring(5,loc.get_state()):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not self.match_substring(6,loc.get_country()):
|
||||||
|
continue
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
47
src/Filters/Rules/Place/_MatchesFilter.py
Normal file
47
src/Filters/Rules/Place/_MatchesFilter.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#
|
||||||
|
# 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._MatchesFilterBase import MatchesFilterBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# MatchesFilter
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class MatchesFilter(MatchesFilterBase):
|
||||||
|
"""Rule that checks against another filter"""
|
||||||
|
|
||||||
|
name = _('Places matching the <filter>')
|
||||||
|
description = _("Matches places macthed by the specified filter name")
|
||||||
|
namespace = 'Place'
|
44
src/Filters/Rules/Place/_PlacePrivate.py
Normal file
44
src/Filters/Rules/Place/_PlacePrivate.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#
|
||||||
|
# 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._IsPrivate import IsPrivate
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# "Family marked private"
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class PlacePrivate(IsPrivate):
|
||||||
|
"""Place marked private"""
|
||||||
|
|
||||||
|
name = _('Places marked private')
|
||||||
|
description = _("Matches places that are indicated as private")
|
50
src/Filters/Rules/Place/_RegExpIdOf.py
Normal file
50
src/Filters/Rules/Place/_RegExpIdOf.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#
|
||||||
|
# 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._RegExpIdBase import RegExpIdBase
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# HasIdOf
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class RegExpIdOf(RegExpIdBase):
|
||||||
|
"""
|
||||||
|
Rule that checks for a place whose GRAMPS ID
|
||||||
|
matches regular expression.
|
||||||
|
"""
|
||||||
|
|
||||||
|
name = _('Places with <Id> matching regular expression')
|
||||||
|
description = _("Matches places whose GRAMPS ID matches "
|
||||||
|
"the regular expression")
|
@ -25,3 +25,22 @@ Package providing filter rules for GRAMPS.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = "Don Allingham"
|
__author__ = "Don Allingham"
|
||||||
|
|
||||||
|
from _AllPlaces import AllPlaces
|
||||||
|
from _HasIdOf import HasIdOf
|
||||||
|
from _RegExpIdOf import RegExpIdOf
|
||||||
|
from _HasNoteRegexp import HasNoteRegexp
|
||||||
|
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
|
||||||
|
from _PlacePrivate import PlacePrivate
|
||||||
|
from _MatchesFilter import MatchesFilter
|
||||||
|
from _HasPlace import HasPlace
|
||||||
|
|
||||||
|
editor_rule_list = [
|
||||||
|
AllPlaces,
|
||||||
|
HasIdOf,
|
||||||
|
RegExpIdOf,
|
||||||
|
HasNoteRegexp,
|
||||||
|
HasNoteMatchingSubstringOf,
|
||||||
|
PlacePrivate,
|
||||||
|
MatchesFilter,
|
||||||
|
]
|
||||||
|
@ -8,7 +8,8 @@ pkgdata_PYTHON = \
|
|||||||
__init__.py \
|
__init__.py \
|
||||||
_SidebarFilter.py \
|
_SidebarFilter.py \
|
||||||
_PersonSidebarFilter.py\
|
_PersonSidebarFilter.py\
|
||||||
_SourceSidebarFilter.py
|
_SourceSidebarFilter.py\
|
||||||
|
_PlaceSidebarFilter.py
|
||||||
|
|
||||||
pkgpyexecdir = @pkgpyexecdir@/Filters/SideBar
|
pkgpyexecdir = @pkgpyexecdir@/Filters/SideBar
|
||||||
pkgpythondir = @pkgpythondir@/Filters/SideBar
|
pkgpythondir = @pkgpythondir@/Filters/SideBar
|
||||||
|
156
src/Filters/SideBar/_PlaceSidebarFilter.py
Normal file
156
src/Filters/SideBar/_PlaceSidebarFilter.py
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
#
|
||||||
|
# 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$
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# gtk
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
import gtk
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
import GrampsWidgets
|
||||||
|
import RelLib
|
||||||
|
|
||||||
|
from _SidebarFilter import SidebarFilter
|
||||||
|
from Filters import GenericFilterFactory, build_filter_model, Rules
|
||||||
|
from Filters.Rules.Place import *
|
||||||
|
|
||||||
|
GenericPlaceFilter = GenericFilterFactory('Place')
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# PersonSidebarFilter class
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class PlaceSidebarFilter(SidebarFilter):
|
||||||
|
|
||||||
|
def __init__(self, clicked):
|
||||||
|
SidebarFilter.__init__(self)
|
||||||
|
self.clicked_func = clicked
|
||||||
|
|
||||||
|
def create_widget(self):
|
||||||
|
self.filter_id = gtk.Entry()
|
||||||
|
self.filter_title = gtk.Entry()
|
||||||
|
self.filter_parish = gtk.Entry()
|
||||||
|
self.filter_zip = gtk.Entry()
|
||||||
|
self.filter_city = gtk.Entry()
|
||||||
|
self.filter_county = gtk.Entry()
|
||||||
|
self.filter_state = gtk.Entry()
|
||||||
|
self.filter_country = gtk.Entry()
|
||||||
|
|
||||||
|
self.filter_note = gtk.Entry()
|
||||||
|
|
||||||
|
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
||||||
|
|
||||||
|
all = GenericPlaceFilter()
|
||||||
|
all.set_name(_("None"))
|
||||||
|
all.add_rule(Rules.Place.AllPlaces([]))
|
||||||
|
|
||||||
|
self.generic = gtk.ComboBox()
|
||||||
|
cell = gtk.CellRendererText()
|
||||||
|
self.generic.pack_start(cell, True)
|
||||||
|
self.generic.add_attribute(cell, 'text', 0)
|
||||||
|
self.generic.set_model(build_filter_model('Place', [all]))
|
||||||
|
self.generic.set_active(0)
|
||||||
|
|
||||||
|
self.add_text_entry(_('ID'), self.filter_id)
|
||||||
|
self.add_text_entry(_('Name'), self.filter_title)
|
||||||
|
self.add_text_entry(_('Church parish'), self.filter_parish)
|
||||||
|
self.add_text_entry(_('Zip/Postal code'), self.filter_zip)
|
||||||
|
self.add_text_entry(_('City'), self.filter_city)
|
||||||
|
self.add_text_entry(_('County'), self.filter_county)
|
||||||
|
self.add_text_entry(_('State'), self.filter_state)
|
||||||
|
self.add_text_entry(_('Country'), self.filter_country)
|
||||||
|
self.add_text_entry(_('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_title.set_text('')
|
||||||
|
self.filter_parish.set_text('')
|
||||||
|
self.filter_zip.set_text('')
|
||||||
|
self.filter_city.set_text('')
|
||||||
|
self.filter_county.set_text('')
|
||||||
|
self.filter_state.set_text('')
|
||||||
|
self.filter_country.set_text('')
|
||||||
|
self.filter_note.set_text('')
|
||||||
|
self.generic.set_active(0)
|
||||||
|
|
||||||
|
def clicked(self, obj):
|
||||||
|
self.clicked_func()
|
||||||
|
|
||||||
|
def get_filter(self):
|
||||||
|
gid = unicode(self.filter_id.get_text()).strip()
|
||||||
|
title = unicode(self.filter_title.get_text()).strip()
|
||||||
|
parish = unicode(self.filter_parish.get_text()).strip()
|
||||||
|
zipc = unicode(self.filter_zip.get_text()).strip()
|
||||||
|
city = unicode(self.filter_city.get_text()).strip()
|
||||||
|
county = unicode(self.filter_county.get_text()).strip()
|
||||||
|
state = unicode(self.filter_state.get_text()).strip()
|
||||||
|
country = unicode(self.filter_country.get_text()).strip()
|
||||||
|
note = unicode(self.filter_note.get_text()).strip()
|
||||||
|
regex = self.filter_regex.get_active()
|
||||||
|
gen = self.generic.get_active() > 0
|
||||||
|
|
||||||
|
empty = not (gid or title or parish or zipc or city or county
|
||||||
|
or state or country or note or regex or gen)
|
||||||
|
if empty:
|
||||||
|
generic_filter = None
|
||||||
|
else:
|
||||||
|
generic_filter = GenericPlaceFilter()
|
||||||
|
if gid:
|
||||||
|
if regex:
|
||||||
|
rule = RegExpIdOf([gid])
|
||||||
|
else:
|
||||||
|
rule = HasIdOf([gid])
|
||||||
|
generic_filter.add_rule(rule)
|
||||||
|
|
||||||
|
rule = HasPlace([title,parish,zipc,city,county,state,country])
|
||||||
|
generic_filter.add_rule(rule)
|
||||||
|
|
||||||
|
if note:
|
||||||
|
if regex:
|
||||||
|
rule = HasNoteRegexp([note])
|
||||||
|
else:
|
||||||
|
rule = HasNoteMatchingSubstringOf([note])
|
||||||
|
generic_filter.add_rule(rule)
|
||||||
|
|
||||||
|
if self.generic.get_active() != 0:
|
||||||
|
model = self.generic.get_model()
|
||||||
|
iter = self.generic.get_active_iter()
|
||||||
|
obj = model.get_value(iter, 0)
|
||||||
|
rule = MatchesFilter([obj])
|
||||||
|
generic_filter.add_rule(rule)
|
||||||
|
|
||||||
|
return generic_filter
|
@ -31,3 +31,4 @@ from _PersonSidebarFilter import PersonSidebarFilter
|
|||||||
from _FamilySidebarFilter import FamilySidebarFilter
|
from _FamilySidebarFilter import FamilySidebarFilter
|
||||||
from _EventSidebarFilter import EventSidebarFilter
|
from _EventSidebarFilter import EventSidebarFilter
|
||||||
from _SourceSidebarFilter import SourceSidebarFilter
|
from _SourceSidebarFilter import SourceSidebarFilter
|
||||||
|
from _PlaceSidebarFilter import PlaceSidebarFilter
|
||||||
|
@ -246,6 +246,21 @@ class GenericSourceFilter(GenericFilter):
|
|||||||
def find_from_handle(self, db, handle):
|
def find_from_handle(self, db, handle):
|
||||||
return db.get_source_from_handle(handle)
|
return db.get_source_from_handle(handle)
|
||||||
|
|
||||||
|
class GenericPlaceFilter(GenericFilter):
|
||||||
|
|
||||||
|
def __init__(self, source=None):
|
||||||
|
GenericFilter.__init__(self, source)
|
||||||
|
|
||||||
|
def get_cursor(db, self):
|
||||||
|
return db.get_place_cursor()
|
||||||
|
|
||||||
|
def make_obj(self):
|
||||||
|
return RelLib.Place()
|
||||||
|
|
||||||
|
def find_from_handle(self, db, handle):
|
||||||
|
return db.get_place_from_handle(handle)
|
||||||
|
|
||||||
|
|
||||||
def GenericFilterFactory(namespace):
|
def GenericFilterFactory(namespace):
|
||||||
if namespace == 'Person':
|
if namespace == 'Person':
|
||||||
return GenericFilter
|
return GenericFilter
|
||||||
@ -255,3 +270,5 @@ def GenericFilterFactory(namespace):
|
|||||||
return GenericEventFilter
|
return GenericEventFilter
|
||||||
elif namespace == 'Source':
|
elif namespace == 'Source':
|
||||||
return GenericSourceFilter
|
return GenericSourceFilter
|
||||||
|
elif namespace == 'Place':
|
||||||
|
return GenericPlaceFilter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user