From 5719832f36921e0e96793f1abb854b30f8331e91 Mon Sep 17 00:00:00 2001 From: Tim G L Lyons Date: Tue, 20 Sep 2011 22:05:41 +0000 Subject: [PATCH] Citation filters svn: r18182 --- src/Filters/Rules/Citation/Makefile.am | 32 ++++++++ src/Filters/Rules/Citation/_AllCitations.py | 47 +++++++++++ src/Filters/Rules/Citation/_ChangedSince.py | 50 ++++++++++++ .../Rules/Citation/_CitationPrivate.py | 45 +++++++++++ src/Filters/Rules/Citation/_HasGallery.py | 47 +++++++++++ src/Filters/Rules/Citation/_HasIdOf.py | 47 +++++++++++ src/Filters/Rules/Citation/_HasNote.py | 48 ++++++++++++ .../Citation/_HasNoteMatchingSubstringOf.py | 47 +++++++++++ src/Filters/Rules/Citation/_HasNoteRegexp.py | 45 +++++++++++ .../Rules/Citation/_HasReferenceCountOf.py | 46 +++++++++++ src/Filters/Rules/Citation/_MatchesFilter.py | 48 ++++++++++++ .../Rules/Citation/_MatchesPageSubstringOf.py | 54 +++++++++++++ .../Citation/_MatchesRepositoryFilter.py | 72 +++++++++++++++++ .../Rules/Citation/_MatchesSourceFilter.py | 56 +++++++++++++ src/Filters/Rules/Citation/_RegExpIdOf.py | 51 ++++++++++++ src/Filters/Rules/Citation/__init__.py | 61 +++++++++++++++ src/Filters/Rules/Makefile.am | 7 +- src/Filters/Rules/_HasCitationBase.py | 78 +++++++++++++++++++ src/Filters/Rules/_HasGalleryBase.py | 2 + src/Filters/Rules/_HasLDSBase.py | 2 + src/Filters/Rules/_HasNoteBase.py | 2 + src/Filters/Rules/_HasSourceBase.py | 2 + src/Filters/Rules/__init__.py | 4 +- src/Filters/SideBar/_CitationSidebarFilter.py | 69 ++++++++++------ src/Filters/SideBar/_SidebarFilter.py | 9 +++ src/Filters/_GenericFilter.py | 16 ++++ src/gen/lib/citation.py | 10 +++ src/gui/filtereditor.py | 15 ++++ src/plugins/lib/libcitationview.py | 1 + 29 files changed, 984 insertions(+), 29 deletions(-) create mode 100644 src/Filters/Rules/Citation/Makefile.am create mode 100644 src/Filters/Rules/Citation/_AllCitations.py create mode 100644 src/Filters/Rules/Citation/_ChangedSince.py create mode 100644 src/Filters/Rules/Citation/_CitationPrivate.py create mode 100755 src/Filters/Rules/Citation/_HasGallery.py create mode 100644 src/Filters/Rules/Citation/_HasIdOf.py create mode 100755 src/Filters/Rules/Citation/_HasNote.py create mode 100644 src/Filters/Rules/Citation/_HasNoteMatchingSubstringOf.py create mode 100644 src/Filters/Rules/Citation/_HasNoteRegexp.py create mode 100644 src/Filters/Rules/Citation/_HasReferenceCountOf.py create mode 100644 src/Filters/Rules/Citation/_MatchesFilter.py create mode 100644 src/Filters/Rules/Citation/_MatchesPageSubstringOf.py create mode 100644 src/Filters/Rules/Citation/_MatchesRepositoryFilter.py create mode 100644 src/Filters/Rules/Citation/_MatchesSourceFilter.py create mode 100644 src/Filters/Rules/Citation/_RegExpIdOf.py create mode 100644 src/Filters/Rules/Citation/__init__.py create mode 100644 src/Filters/Rules/_HasCitationBase.py diff --git a/src/Filters/Rules/Citation/Makefile.am b/src/Filters/Rules/Citation/Makefile.am new file mode 100644 index 000000000..aad86615c --- /dev/null +++ b/src/Filters/Rules/Citation/Makefile.am @@ -0,0 +1,32 @@ +# This is the src/Filters/Rules/Citation level Makefile for Gramps + +pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Citation + +pkgdata_PYTHON = \ + __init__.py \ + _AllCitations.py \ + _ChangedSince.py \ + _CitationPrivate.py \ + _HasGallery.py \ + _HasIdOf.py \ + _HasNote.py \ + _HasNoteMatchingSubstringOf.py \ + _HasNoteRegexp.py \ + _HasReferenceCountOf.py \ + _MatchesFilter.py \ + _MatchesPageSubstringOf.py \ + _MatchesRepositoryFilter.py \ + _MatchesSourceFilter.py \ + _RegExpIdOf.py \ + +pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Citation +pkgpythondir = @pkgpythondir@/Filters/Rules/Citation + +# Clean up all the byte-compiled files +MOSTLYCLEANFILES = *pyc *pyo + +GRAMPS_PY_MODPATH = "../../../" + +pycheck: + (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \ + pychecker $(pkgdata_PYTHON)); diff --git a/src/Filters/Rules/Citation/_AllCitations.py b/src/Filters/Rules/Citation/_AllCitations.py new file mode 100644 index 000000000..4e5b72909 --- /dev/null +++ b/src/Filters/Rules/Citation/_AllCitations.py @@ -0,0 +1,47 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._Everything import Everything + +#------------------------------------------------------------------------- +# +# Everyone +# +#------------------------------------------------------------------------- +class AllCitations(Everything): + """Matches every citation""" + + name = _('Every citation') + description = _('Matches every citation in the database') diff --git a/src/Filters/Rules/Citation/_ChangedSince.py b/src/Filters/Rules/Citation/_ChangedSince.py new file mode 100644 index 000000000..b96c75474 --- /dev/null +++ b/src/Filters/Rules/Citation/_ChangedSince.py @@ -0,0 +1,50 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._ChangedSinceBase import ChangedSinceBase + +#------------------------------------------------------------------------- +# +# ChangedSince +# +#------------------------------------------------------------------------- +class ChangedSince(ChangedSinceBase): + """Rule that checks for citations changed since a specific time.""" + + labels = [ _('Changed after:'), _('but before:') ] + name = _('Citations changed after ') + description = _("Matches citation records changed after a specified " + "date-time (yyyy-mm-dd hh:mm:ss) or in the range, if a second " + "date-time is given.") diff --git a/src/Filters/Rules/Citation/_CitationPrivate.py b/src/Filters/Rules/Citation/_CitationPrivate.py new file mode 100644 index 000000000..b4276fc3a --- /dev/null +++ b/src/Filters/Rules/Citation/_CitationPrivate.py @@ -0,0 +1,45 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._IsPrivate import IsPrivate + +#------------------------------------------------------------------------- +# "Family marked private" +#------------------------------------------------------------------------- +class CitationPrivate(IsPrivate): + """Citation marked private""" + + name = _('Citations marked private') + description = _("Matches citations that are indicated as private") diff --git a/src/Filters/Rules/Citation/_HasGallery.py b/src/Filters/Rules/Citation/_HasGallery.py new file mode 100755 index 000000000..48f3a1902 --- /dev/null +++ b/src/Filters/Rules/Citation/_HasGallery.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 +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._HasGalleryBase import HasGalleryBase + +#------------------------------------------------------------------------- +# "Sources who have media object reference" +#------------------------------------------------------------------------- +class HasGallery(HasGalleryBase): + """Rule that checks for citation who has media object reference""" + + name = _('Citations with media') + description = _("Matches citations with a certain number of items in the gallery") diff --git a/src/Filters/Rules/Citation/_HasIdOf.py b/src/Filters/Rules/Citation/_HasIdOf.py new file mode 100644 index 000000000..10bdf5f02 --- /dev/null +++ b/src/Filters/Rules/Citation/_HasIdOf.py @@ -0,0 +1,47 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules import HasGrampsId + +#------------------------------------------------------------------------- +# +# HasIdOf +# +#------------------------------------------------------------------------- +class HasIdOf(HasGrampsId): + """Rule that checks for a citation with a specific GRAMPS ID""" + + name = _('Citation with ') + description = _("Matches a citation with a specified Gramps ID") diff --git a/src/Filters/Rules/Citation/_HasNote.py b/src/Filters/Rules/Citation/_HasNote.py new file mode 100755 index 000000000..46324e3b2 --- /dev/null +++ b/src/Filters/Rules/Citation/_HasNote.py @@ -0,0 +1,48 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2007 Donald N. Allingham +# Copyright (C) 2007-2008 Brian G. Matherly +# Copyright (C) 2008 Jerome Rapinat +# Copyright (C) 2008 Benny Malengier +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._HasNoteBase import HasNoteBase + +#------------------------------------------------------------------------- +# "Sources having notes" +#------------------------------------------------------------------------- +class HasNote(HasNoteBase): + """Citations having notes""" + + name = _('Citations having notes') + description = _("Matches citations having a certain number of notes") diff --git a/src/Filters/Rules/Citation/_HasNoteMatchingSubstringOf.py b/src/Filters/Rules/Citation/_HasNoteMatchingSubstringOf.py new file mode 100644 index 000000000..870d5fdae --- /dev/null +++ b/src/Filters/Rules/Citation/_HasNoteMatchingSubstringOf.py @@ -0,0 +1,47 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._HasNoteSubstrBase import HasNoteSubstrBase + +#------------------------------------------------------------------------- +# "Events having notes that contain a substring" +#------------------------------------------------------------------------- +class HasNoteMatchingSubstringOf(HasNoteSubstrBase): + """Citations having notes containing """ + + name = _('Citations having notes containing ') + description = _("Matches citations whose notes contain text " + "matching a substring") + diff --git a/src/Filters/Rules/Citation/_HasNoteRegexp.py b/src/Filters/Rules/Citation/_HasNoteRegexp.py new file mode 100644 index 000000000..727bca318 --- /dev/null +++ b/src/Filters/Rules/Citation/_HasNoteRegexp.py @@ -0,0 +1,45 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._HasNoteRegexBase import HasNoteRegexBase + +#------------------------------------------------------------------------- +# "Sources having notes that contain a substring" +#------------------------------------------------------------------------- +class HasNoteRegexp(HasNoteRegexBase): + + name = _('Citations having notes containing ') + description = _("Matches citations whose notes contain text " + "matching a regular expression") diff --git a/src/Filters/Rules/Citation/_HasReferenceCountOf.py b/src/Filters/Rules/Citation/_HasReferenceCountOf.py new file mode 100644 index 000000000..88681cc6a --- /dev/null +++ b/src/Filters/Rules/Citation/_HasReferenceCountOf.py @@ -0,0 +1,46 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2007 Stephane Charette +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._HasReferenceCountBase import HasReferenceCountBase + +#------------------------------------------------------------------------- +# "Source objects with a certain reference count" +#------------------------------------------------------------------------- +class HasReferenceCountOf(HasReferenceCountBase): + """Citation objects with a reference count of """ + + name = _('Citations with a reference count of ') + description = _("Matches citations with a certain reference count") + diff --git a/src/Filters/Rules/Citation/_MatchesFilter.py b/src/Filters/Rules/Citation/_MatchesFilter.py new file mode 100644 index 000000000..50bf757a1 --- /dev/null +++ b/src/Filters/Rules/Citation/_MatchesFilter.py @@ -0,0 +1,48 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._MatchesFilterBase import MatchesFilterBase + +#------------------------------------------------------------------------- +# +# MatchesFilter +# +#------------------------------------------------------------------------- +class MatchesFilter(MatchesFilterBase): + """Rule that checks against another filter""" + + name = _('Citations matching the ') + description = _("Matches citations matched by the specified filter name") + namespace = 'Citation' diff --git a/src/Filters/Rules/Citation/_MatchesPageSubstringOf.py b/src/Filters/Rules/Citation/_MatchesPageSubstringOf.py new file mode 100644 index 000000000..d58c2eec8 --- /dev/null +++ b/src/Filters/Rules/Citation/_MatchesPageSubstringOf.py @@ -0,0 +1,54 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2011 Helge Herz +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules import Rule + +#------------------------------------------------------------------------- +# "Sources having a title that contain a substring" +#------------------------------------------------------------------------- +class MatchesPageSubstringOf(Rule): + """Citation Volume/Page title containing """ + + labels = [ _('Substring:')] + name = _('Citation Volume/Page containing ') + description = _("Matches citations whose Volume/Page contains a " + "certain substring") + category = _('General filters') + + def apply(self, db, object): + """ Apply the filter """ + title = object.get_page() + if title.upper().find(self.list[0].upper()) != -1: + return True + return False diff --git a/src/Filters/Rules/Citation/_MatchesRepositoryFilter.py b/src/Filters/Rules/Citation/_MatchesRepositoryFilter.py new file mode 100644 index 000000000..17d315c47 --- /dev/null +++ b/src/Filters/Rules/Citation/_MatchesRepositoryFilter.py @@ -0,0 +1,72 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2011 Benny Malengier +# Copyright (C) 2011 Tim G L Lyons +# +# 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 +# +#------------------------------------------------------------------------- +import logging +LOG = logging.getLogger(".citation") +from gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules import MatchesFilterBase + +#------------------------------------------------------------------------- +# "Sources which reference a repository by selection" +#------------------------------------------------------------------------- +class MatchesRepositoryFilter(MatchesFilterBase): + """Citations which have a source which references the selected repository""" + + labels = [ _('Repository filter name:') ] + name = _('Citations with a source with a repository reference ' + 'matching the ') + description = _("Matches citations with sources with a repository " + "reference that match a certain repository filter") + category = _('General filters') + + # we want to have this filter show repository filters + namespace = 'Repository' + + + def prepare(self, db): + MatchesFilterBase.prepare(self, db) + self.MRF_filt = self.find_filter() + + def apply(self, db, object): + if self.MRF_filt is None : + return False + + source_handle = object.source_handle + source = db.get_source_from_handle(source_handle) + repolist = [x.ref for x in source.get_reporef_list()] + for repohandle in repolist: + #check if repo in repository filter + if self.MRF_filt.check(db, repohandle): + return True + return False diff --git a/src/Filters/Rules/Citation/_MatchesSourceFilter.py b/src/Filters/Rules/Citation/_MatchesSourceFilter.py new file mode 100644 index 000000000..c0fac2499 --- /dev/null +++ b/src/Filters/Rules/Citation/_MatchesSourceFilter.py @@ -0,0 +1,56 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2010 Benny Malengier +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules import MatchesSourceFilterBase + +#------------------------------------------------------------------------- +# +# MatchesFilter +# +#------------------------------------------------------------------------- +class MatchesSourceFilter(MatchesSourceFilterBase): + """ + Rule that checks against another filter. + """ + + labels = [_('Source filter name:')] + name = _('Events with source matching the ') + description = _("Matches events with sources that match the " + "specified source filter name") + category = _('General filters') + + # we want to have this filter show source filters + namespace = 'Source' diff --git a/src/Filters/Rules/Citation/_RegExpIdOf.py b/src/Filters/Rules/Citation/_RegExpIdOf.py new file mode 100644 index 000000000..d2fd256b0 --- /dev/null +++ b/src/Filters/Rules/Citation/_RegExpIdOf.py @@ -0,0 +1,51 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +from Filters.Rules._RegExpIdBase import RegExpIdBase + +#------------------------------------------------------------------------- +# +# HasIdOf +# +#------------------------------------------------------------------------- +class RegExpIdOf(RegExpIdBase): + """ + Rule that checks for a citation whose GRAMPS ID + matches regular expression. + """ + + name = _('Citations with matching regular expression') + description = _("Matches citations whose Gramps ID matches " + "the regular expression") diff --git a/src/Filters/Rules/Citation/__init__.py b/src/Filters/Rules/Citation/__init__.py new file mode 100644 index 000000000..f36aeac52 --- /dev/null +++ b/src/Filters/Rules/Citation/__init__.py @@ -0,0 +1,61 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2007 Donald N. Allingham +# Copyright (C) 2007-2008 Brian G. Matherly +# Copyright (C) 2011 Tim G L Lyons +# +# 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$ + +""" +Package providing filter rules for GRAMPS. +""" + +from Filters.Rules._HasCitationBase import HasCitationBase as HasCitation + +from _AllCitations import AllCitations +from _ChangedSince import ChangedSince +from _CitationPrivate import CitationPrivate +from _HasGallery import HasGallery +from _HasIdOf import HasIdOf +from _HasNote import HasNote +from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf +from _HasNoteRegexp import HasNoteRegexp +from _HasReferenceCountOf import HasReferenceCountOf +from _MatchesFilter import MatchesFilter +from _MatchesPageSubstringOf import MatchesPageSubstringOf +from _MatchesRepositoryFilter import MatchesRepositoryFilter +from _MatchesSourceFilter import MatchesSourceFilter +from _RegExpIdOf import RegExpIdOf + +editor_rule_list = [ + AllCitations, + ChangedSince, + CitationPrivate, + HasGallery, + HasIdOf, + HasNote, + HasNoteMatchingSubstringOf, + HasNoteRegexp, + HasReferenceCountOf, + MatchesFilter, + MatchesPageSubstringOf, + MatchesRepositoryFilter, + MatchesSourceFilter, + RegExpIdOf +] diff --git a/src/Filters/Rules/Makefile.am b/src/Filters/Rules/Makefile.am index 552ff18fa..6e0af49b2 100644 --- a/src/Filters/Rules/Makefile.am +++ b/src/Filters/Rules/Makefile.am @@ -25,9 +25,10 @@ pkgdata_PYTHON = \ _RegExpIdBase.py\ _Rule.py\ _MatchesFilterBase.py\ - _MatchesEventFilterBase.py \ - _MatchesSourceConfidenceBase.py \ - _MatchesSourceFilterBase.py + _MatchesEventFilterBase.py \ + _MatchesSourceConfidenceBase.py \ + _MatchesSourceFilterBase.py \ + _HasCitationBase.py pkgpyexecdir = @pkgpyexecdir@/Filters/Rules diff --git a/src/Filters/Rules/_HasCitationBase.py b/src/Filters/Rules/_HasCitationBase.py new file mode 100644 index 000000000..49df54336 --- /dev/null +++ b/src/Filters/Rules/_HasCitationBase.py @@ -0,0 +1,78 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2011 Tim G L Lyons +# +# 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 gen.ggettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +import DateHandler +from Filters.Rules._Rule import Rule + +#------------------------------------------------------------------------- +# +# HasCitation +# +#------------------------------------------------------------------------- +class HasCitationBase(Rule): + """Rule that checks for a citation with a particular value + + First parameter is [Volume/page, Date, Confidence] + """ + + + labels = [ _('Volume/Page:'), + _('Date:'), + _('Confidence:') ] + name = _('Citations matching parameters') + description = _("Matches citations with particular parameters") + category = _('General filters') + + def prepare(self, db): + self.date = None + try: + if self.list[1]: + self.date = DateHandler.parser.parse(self.list[1]) + except: + pass + + def apply(self,db,citation): + if not self.match_substring(0,citation.get_page()): + return False + + if self.date: + if not citation.get_date_object().match(self.date): + return False + + if self.list[2]: + if citation.get_confidence_level() > int(self.list[2]): + return False + + return True diff --git a/src/Filters/Rules/_HasGalleryBase.py b/src/Filters/Rules/_HasGalleryBase.py index dbdc52982..e91ba9efc 100755 --- a/src/Filters/Rules/_HasGalleryBase.py +++ b/src/Filters/Rules/_HasGalleryBase.py @@ -20,6 +20,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + #------------------------------------------------------------------------- # # Standard Python modules diff --git a/src/Filters/Rules/_HasLDSBase.py b/src/Filters/Rules/_HasLDSBase.py index 99a064453..c80ca9fe7 100755 --- a/src/Filters/Rules/_HasLDSBase.py +++ b/src/Filters/Rules/_HasLDSBase.py @@ -20,6 +20,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + #------------------------------------------------------------------------- # # Standard Python modules diff --git a/src/Filters/Rules/_HasNoteBase.py b/src/Filters/Rules/_HasNoteBase.py index b09b5a25b..4a181d4b7 100755 --- a/src/Filters/Rules/_HasNoteBase.py +++ b/src/Filters/Rules/_HasNoteBase.py @@ -21,6 +21,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + #------------------------------------------------------------------------- # # Standard Python modules diff --git a/src/Filters/Rules/_HasSourceBase.py b/src/Filters/Rules/_HasSourceBase.py index aae9a9777..39bfe9cce 100755 --- a/src/Filters/Rules/_HasSourceBase.py +++ b/src/Filters/Rules/_HasSourceBase.py @@ -21,6 +21,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + #------------------------------------------------------------------------- # # Standard Python modules diff --git a/src/Filters/Rules/__init__.py b/src/Filters/Rules/__init__.py index 06126339e..30cebdaff 100644 --- a/src/Filters/Rules/__init__.py +++ b/src/Filters/Rules/__init__.py @@ -39,5 +39,5 @@ from Filters.Rules._MatchesSourceConfidenceBase import MatchesSourceConfidenceBa from Filters.Rules._MatchesSourceFilterBase import MatchesSourceFilterBase from Filters.Rules._ChangedSinceBase import ChangedSinceBase -from Filters.Rules import (Person, Family, Event, Source, Place, MediaObject, - Repository, Note) +from Filters.Rules import (Person, Family, Event, Source, Citation, Place, + MediaObject, Repository, Note) diff --git a/src/Filters/SideBar/_CitationSidebarFilter.py b/src/Filters/SideBar/_CitationSidebarFilter.py index 9cbb80674..a6cf7fe7e 100644 --- a/src/Filters/SideBar/_CitationSidebarFilter.py +++ b/src/Filters/SideBar/_CitationSidebarFilter.py @@ -1,6 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # +# Copyright (C) 2002-2006 Donald N. Allingham # Copyright (C) 2011 Tim G L Lyons # # This program is free software; you can redistribute it and/or modify @@ -39,13 +40,15 @@ import gtk # GRAMPS modules # #------------------------------------------------------------------------- +from gui.widgets import MonitoredMenu +import gen.lib from Filters.SideBar import SidebarFilter from Filters import GenericFilterFactory, build_filter_model, Rules -from Filters.Rules.Source import (RegExpIdOf, HasIdOf, HasSource, +from Filters.Rules.Citation import (RegExpIdOf, HasIdOf, HasCitation, HasNoteMatchingSubstringOf, HasNoteRegexp, MatchesFilter) -# FIXME: need to add Citation filter rules. -GenericSourceFilter = GenericFilterFactory('Citation') +from Utils import confidence +GenericCitationFilter = GenericFilterFactory('Citation') #------------------------------------------------------------------------- # # PersonSidebarFilter class @@ -56,16 +59,19 @@ class CitationSidebarFilter(SidebarFilter): def __init__(self, dbstate, uistate, clicked): self.clicked_func = clicked self.filter_id = gtk.Entry() - self.filter_title = gtk.Entry() - self.filter_author = gtk.Entry() - self.filter_pub = gtk.Entry() + self.filter_page = gtk.Entry() + self.filter_date = gtk.Entry() + + self.citn = gen.lib.Citation() + self.filter_conf = gtk.ComboBox() + self.filter_note = gtk.Entry() self.filter_regex = gtk.CheckButton(_('Use regular expressions')) self.generic = gtk.ComboBox() - SidebarFilter.__init__(self, dbstate, uistate, "Source") + SidebarFilter.__init__(self, dbstate, uistate, "Citation") def create_widget(self): cell = gtk.CellRendererText() @@ -73,38 +79,53 @@ class CitationSidebarFilter(SidebarFilter): cell.set_property('ellipsize', self._FILTER_ELLIPSIZE) self.generic.pack_start(cell, True) self.generic.add_attribute(cell, 'text', 0) - self.on_filters_changed('Source') + self.on_filters_changed('Citation') self.add_text_entry(_('ID'), self.filter_id) - self.add_text_entry(_('Title'), self.filter_title) - self.add_text_entry(_('Author'), self.filter_author) - self.add_text_entry(_('Publication'), self.filter_pub) + self.add_text_entry(_('Volume/Page'), self.filter_page) + self.add_text_entry(_('Date'), self.filter_date) + # FIXME: The confidence combo-box is not populated with any entries. + # I have no idea why this should be, as the code here seems + # entirely analogous to src/gui/editors/editcitation, + # which itself is derived from src/gui/editors/editsourceref.py + # and edit citation displays the confidence selectors correctly. + # There is some different code in src/gui/filtereditor.py. + self.type_mon = MonitoredMenu( + self.filter_conf, + self.citn.set_confidence_level, + self.citn.get_confidence_level, [ + (_('Very Low'), gen.lib.Citation.CONF_VERY_LOW), + (_('Low'), gen.lib.Citation.CONF_LOW), + (_('Normal'), gen.lib.Citation.CONF_NORMAL), + (_('High'), gen.lib.Citation.CONF_HIGH), + (_('Very High'), gen.lib.Citation.CONF_VERY_HIGH)]) + self.add_combo_entry(_('Confidence'), self.filter_conf) self.add_text_entry(_('Note'), self.filter_note) self.add_filter_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_author.set_text('') - self.filter_pub.set_text('') + self.filter_page.set_text('') + self.filter_date.set_text('') + self.filter_conf.set_active(0) self.filter_note.set_text('') self.generic.set_active(0) def get_filter(self): gid = unicode(self.filter_id.get_text()).strip() - title = unicode(self.filter_title.get_text()).strip() - author = unicode(self.filter_author.get_text()).strip() - pub = unicode(self.filter_pub.get_text()).strip() + page = unicode(self.filter_page.get_text()).strip() + date = unicode(self.filter_date.get_text()).strip() + conf = self.citn.get_confidence_level() 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 author or pub or note or regex or gen) + empty = not (gid or page or date or conf or note or regex or gen) if empty: generic_filter = None else: - generic_filter = GenericSourceFilter() + generic_filter = GenericCitationFilter() if gid: if regex: rule = RegExpIdOf([gid]) @@ -112,7 +133,7 @@ class CitationSidebarFilter(SidebarFilter): rule = HasIdOf([gid]) generic_filter.add_rule(rule) - rule = HasSource([title, author, pub], use_regex=regex) + rule = HasCitation([page, date, conf], use_regex=regex) generic_filter.add_rule(rule) if note: @@ -132,9 +153,9 @@ class CitationSidebarFilter(SidebarFilter): return generic_filter def on_filters_changed(self, name_space): - if name_space == 'Source': - all_filter = GenericSourceFilter() + if name_space == 'Citation': + all_filter = GenericCitationFilter() all_filter.set_name(_("None")) - all_filter.add_rule(Rules.Source.AllSources([])) - self.generic.set_model(build_filter_model('Source', [all_filter])) + all_filter.add_rule(Rules.Citation.AllCitations([])) + self.generic.set_model(build_filter_model('Citation', [all_filter])) self.generic.set_active(0) diff --git a/src/Filters/SideBar/_SidebarFilter.py b/src/Filters/SideBar/_SidebarFilter.py index f5a102121..abdb05e98 100644 --- a/src/Filters/SideBar/_SidebarFilter.py +++ b/src/Filters/SideBar/_SidebarFilter.py @@ -132,6 +132,15 @@ class SidebarFilter(DbGUIElement): xoptions=gtk.FILL, yoptions=0) self.position += 1 + def add_combo_entry(self, name, widget): + if name: + self.table.attach(widgets.BasicLabel(name), + 1, 2, self.position, self.position+1, + xoptions=gtk.FILL, yoptions=0) + self.table.attach(widget, 2, 4, self.position, self.position+1, + xoptions=gtk.FILL|gtk.EXPAND, yoptions=0) + self.position += 1 + def on_filters_changed(self, namespace): """ Called when filters are changed. diff --git a/src/Filters/_GenericFilter.py b/src/Filters/_GenericFilter.py index 03304d1c3..c41c34945 100644 --- a/src/Filters/_GenericFilter.py +++ b/src/Filters/_GenericFilter.py @@ -277,6 +277,20 @@ class GenericSourceFilter(GenericFilter): def find_from_handle(self, db, handle): return db.get_source_from_handle(handle) +class GenericCitationFilter(GenericFilter): + + def __init__(self, source=None): + GenericFilter.__init__(self, source) + + def get_cursor(self, db): + return db.get_citation_cursor() + + def make_obj(self): + return gen.lib.Citation() + + def find_from_handle(self, db, handle): + return db.get_citation_from_handle(handle) + class GenericPlaceFilter(GenericFilter): def __init__(self, source=None): @@ -343,6 +357,8 @@ def GenericFilterFactory(namespace): return GenericEventFilter elif namespace == 'Source': return GenericSourceFilter + elif namespace == 'Citation': + return GenericCitationFilter elif namespace == 'Place': return GenericPlaceFilter elif namespace == 'MediaObject': diff --git a/src/gen/lib/citation.py b/src/gen/lib/citation.py index 9ab24ed52..b16225ba2 100644 --- a/src/gen/lib/citation.py +++ b/src/gen/lib/citation.py @@ -193,6 +193,16 @@ class Citation(MediaBase, NoteBase, PrimaryObject, DateBase): # """ # return [] + def get_source_references(self) : + """ + Return the list of source references associated with the object. + + :returns: Returns the list of :class:`~gen.lib.srcref.SourceRef` objects associated with + the object. + :rtype: list + """ + return [self.source_handle] + def get_note_child_list(self): """ Return the list of child secondary objects that may refer notes. diff --git a/src/gui/filtereditor.py b/src/gui/filtereditor.py index 25d0740f7..2256ba690 100644 --- a/src/gui/filtereditor.py +++ b/src/gui/filtereditor.py @@ -85,6 +85,7 @@ _TITLES = { 'MediaObject' : _('Media Object Filters'), 'Repository' : _('Repository Filters'), 'Note' : _('Note Filters'), + 'Citation' : _('Citation Filters'), } _name2typeclass = { @@ -293,6 +294,7 @@ class MyID(gtk.HBox): 'MediaObject' : _('Media Object'), 'Repository' : _('Repository'), 'Note' : _('Note'), + 'Citation' : _('Citation'), } def __init__(self, dbstate, uistate, track, namespace='Person'): @@ -345,6 +347,9 @@ class MyID(gtk.HBox): elif self.namespace == 'Source': source = self.db.get_source_from_gramps_id(gramps_id) name = source.get_title() + elif self.namespace == 'Citation': + citation = self.db.get_citation_from_gramps_id(gramps_id) + name = citation.get_page() elif self.namespace == 'MediaObject': obj = self.db.get_object_from_gramps_id(gramps_id) name = obj.get_path() @@ -461,6 +466,8 @@ class EditRule(ManagedWindow.ManagedWindow): class_list = Rules.Event.editor_rule_list elif self.namespace == 'Source': class_list = Rules.Source.editor_rule_list + elif self.namespace == 'Citation': + class_list = Rules.Citation.editor_rule_list elif self.namespace == 'Place': class_list = Rules.Place.editor_rule_list elif self.namespace == 'MediaObject': @@ -915,6 +922,10 @@ class ShowResults(ManagedWindow.ManagedWindow): source = self.db.get_source_from_handle(handle) name = source.get_title() gid = source.get_gramps_id() + elif self.namespace == 'Citation': + citation = self.db.get_citation_from_handle(handle) + name = citation.get_title() + gid = citation.get_gramps_id() elif self.namespace == 'Place': place = self.db.get_place_from_handle(handle) name = place.get_title() @@ -946,6 +957,8 @@ class ShowResults(ManagedWindow.ManagedWindow): sortname = self.db.get_event_from_handle(handle).get_description() elif self.namespace == 'Source': sortname = self.db.get_source_from_handle(handle).get_title() + elif self.namespace == 'Citation': + sortname = self.db.get_citation_from_handle(handle).get_title() elif self.namespace == 'Place': sortname = self.db.get_place_from_handle(handle).get_title() elif self.namespace == 'MediaObject': @@ -1133,6 +1146,8 @@ class FilterEditor(ManagedWindow.ManagedWindow): return self.db.get_event_handles() elif self.namespace == 'Source': return self.db.get_source_handles() + elif self.namespace == 'Citation': + return self.db.get_citation_handles() elif self.namespace == 'Place': return self.db.iter_place_handles() elif self.namespace == 'MediaObject': diff --git a/src/plugins/lib/libcitationview.py b/src/plugins/lib/libcitationview.py index a5501f5ac..ae07a5d2f 100644 --- a/src/plugins/lib/libcitationview.py +++ b/src/plugins/lib/libcitationview.py @@ -419,6 +419,7 @@ class BaseCitationView(ListView): def get_default_gramplets(self): """ Define the default gramplets for the sidebar and bottombar. + This is overridden for the tree view to give 'Source Filter' """ return (("Citation Filter",), ("Citation Gallery",