Add extra GrampsBar functionality.
svn: r16502
This commit is contained in:
146
src/plugins/gramplet/Filter.py
Normal file
146
src/plugins/gramplet/Filter.py
Normal file
@@ -0,0 +1,146 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2010 Doug Blank <doug.blank@gmail.com>
|
||||
# Copyright (C) 2011 Nick Hall
|
||||
#
|
||||
# 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$
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.plug import Gramplet
|
||||
from Filters.SideBar import (PersonSidebarFilter, FamilySidebarFilter,
|
||||
EventSidebarFilter, SourceSidebarFilter,
|
||||
PlaceSidebarFilter, MediaSidebarFilter,
|
||||
RepoSidebarFilter, NoteSidebarFilter)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Filter class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Filter(Gramplet):
|
||||
"""
|
||||
The base class for all filter gramplets.
|
||||
"""
|
||||
FILTER_CLASS = None
|
||||
|
||||
def init(self):
|
||||
self.filter = self.FILTER_CLASS(self.dbstate, self.uistate,
|
||||
self.__filter_clicked)
|
||||
self.widget = self.filter.get_widget()
|
||||
self.gui.get_container_widget().remove(self.gui.textview)
|
||||
self.gui.get_container_widget().add_with_viewport(self.widget)
|
||||
self.widget.show_all()
|
||||
|
||||
def __filter_clicked(self):
|
||||
"""
|
||||
Called when the filter apply button is clicked.
|
||||
"""
|
||||
self.gui.view.generic_filter = self.filter.get_filter()
|
||||
self.gui.view.build_tree()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PersonFilter class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class PersonFilter(Filter):
|
||||
"""
|
||||
A gramplet providing a Person Filter.
|
||||
"""
|
||||
FILTER_CLASS = PersonSidebarFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# FamilyFilter class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class FamilyFilter(Filter):
|
||||
"""
|
||||
A gramplet providing a Family Filter.
|
||||
"""
|
||||
FILTER_CLASS = FamilySidebarFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# EventFilter class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class EventFilter(Filter):
|
||||
"""
|
||||
A gramplet providing a Event Filter.
|
||||
"""
|
||||
FILTER_CLASS = EventSidebarFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# SourceFilter class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class SourceFilter(Filter):
|
||||
"""
|
||||
A gramplet providing a Source Filter.
|
||||
"""
|
||||
FILTER_CLASS = SourceSidebarFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PlaceFilter class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class PlaceFilter(Filter):
|
||||
"""
|
||||
A gramplet providing a Place Filter.
|
||||
"""
|
||||
FILTER_CLASS = PlaceSidebarFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# MediaFilter class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class MediaFilter(Filter):
|
||||
"""
|
||||
A gramplet providing a Media Filter.
|
||||
"""
|
||||
FILTER_CLASS = MediaSidebarFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# RepositoryFilter class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RepositoryFilter(Filter):
|
||||
"""
|
||||
A gramplet providing a Repository Filter.
|
||||
"""
|
||||
FILTER_CLASS = RepoSidebarFilter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# NoteFilter class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class NoteFilter(Filter):
|
||||
"""
|
||||
A gramplet providing a Note Filter.
|
||||
"""
|
||||
FILTER_CLASS = NoteSidebarFilter
|
||||
@@ -41,7 +41,7 @@ class PersonAttributes(Gramplet):
|
||||
"""
|
||||
tip = _('Double-click on a row to view a quick report showing '
|
||||
'all people with the selected attribute.')
|
||||
self.gui.tooltip = tip
|
||||
self.set_tooltip(tip)
|
||||
top = gtk.TreeView()
|
||||
titles = [(_('Key'), 1, 100),
|
||||
(_('Value'), 2, 100)]
|
||||
|
||||
@@ -42,7 +42,6 @@ class PersonDetails(Gramplet):
|
||||
"""
|
||||
Build the GUI interface.
|
||||
"""
|
||||
self.gui.tooltip = ''
|
||||
self.load_obj = None
|
||||
self.load_rect = None
|
||||
self.top = gtk.HBox()
|
||||
|
||||
@@ -39,7 +39,7 @@ class PersonGallery(Gramplet):
|
||||
"""
|
||||
tip = _('Double-click on a picture to view it in the default image '
|
||||
'viewer application.')
|
||||
self.gui.tooltip = tip
|
||||
self.set_tooltip(tip)
|
||||
self.image_list = []
|
||||
self.top = gtk.HBox(False, 3)
|
||||
return self.top
|
||||
|
||||
@@ -42,7 +42,7 @@ class PersonResidence(Gramplet):
|
||||
Build the GUI interface.
|
||||
"""
|
||||
tip = _('Double-click on a row to edit the selected event.')
|
||||
self.gui.tooltip = tip
|
||||
self.set_tooltip(tip)
|
||||
top = gtk.TreeView()
|
||||
titles = [('', NOSORT, 50,),
|
||||
(_('Date'), 1, 200),
|
||||
|
||||
@@ -76,3 +76,107 @@ register(GRAMPLET,
|
||||
gramplet = 'PersonAttributes',
|
||||
gramplet_title=_("Attributes"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Person Filter Gramplet",
|
||||
name=_("Person Filter Gramplet"),
|
||||
description = _("Gramplet providing a person filter"),
|
||||
version="1.0.0",
|
||||
gramps_target_version="3.3",
|
||||
status = STABLE,
|
||||
fname="Filter.py",
|
||||
height=200,
|
||||
gramplet = 'PersonFilter',
|
||||
gramplet_title=_("Filter"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Family Filter Gramplet",
|
||||
name=_("Family Filter Gramplet"),
|
||||
description = _("Gramplet providing a family filter"),
|
||||
version="1.0.0",
|
||||
gramps_target_version="3.3",
|
||||
status = STABLE,
|
||||
fname="Filter.py",
|
||||
height=200,
|
||||
gramplet = 'FamilyFilter',
|
||||
gramplet_title=_("Filter"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Event Filter Gramplet",
|
||||
name=_("Event Filter Gramplet"),
|
||||
description = _("Gramplet providing an event filter"),
|
||||
version="1.0.0",
|
||||
gramps_target_version="3.3",
|
||||
status = STABLE,
|
||||
fname="Filter.py",
|
||||
height=200,
|
||||
gramplet = 'EventFilter',
|
||||
gramplet_title=_("Filter"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Source Filter Gramplet",
|
||||
name=_("Source Filter Gramplet"),
|
||||
description = _("Gramplet providing a source filter"),
|
||||
version="1.0.0",
|
||||
gramps_target_version="3.3",
|
||||
status = STABLE,
|
||||
fname="Filter.py",
|
||||
height=200,
|
||||
gramplet = 'SourceFilter',
|
||||
gramplet_title=_("Filter"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Place Filter Gramplet",
|
||||
name=_("Place Filter Gramplet"),
|
||||
description = _("Gramplet providing a place filter"),
|
||||
version="1.0.0",
|
||||
gramps_target_version="3.3",
|
||||
status = STABLE,
|
||||
fname="Filter.py",
|
||||
height=200,
|
||||
gramplet = 'PlaceFilter',
|
||||
gramplet_title=_("Filter"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Media Filter Gramplet",
|
||||
name=_("Media Filter Gramplet"),
|
||||
description = _("Gramplet providing a media filter"),
|
||||
version="1.0.0",
|
||||
gramps_target_version="3.3",
|
||||
status = STABLE,
|
||||
fname="Filter.py",
|
||||
height=200,
|
||||
gramplet = 'MediaFilter',
|
||||
gramplet_title=_("Filter"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Repository Filter Gramplet",
|
||||
name=_("Repository Filter Gramplet"),
|
||||
description = _("Gramplet providing a repository filter"),
|
||||
version="1.0.0",
|
||||
gramps_target_version="3.3",
|
||||
status = STABLE,
|
||||
fname="Filter.py",
|
||||
height=200,
|
||||
gramplet = 'RepositoryFilter',
|
||||
gramplet_title=_("Filter"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Note Filter Gramplet",
|
||||
name=_("Note Filter Gramplet"),
|
||||
description = _("Gramplet providing a note filter"),
|
||||
version="1.0.0",
|
||||
gramps_target_version="3.3",
|
||||
status = STABLE,
|
||||
fname="Filter.py",
|
||||
height=200,
|
||||
gramplet = 'NoteFilter',
|
||||
gramplet_title=_("Filter"),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user