2007-12-24 20:26:15 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
|
|
|
# Copyright (C) 2000-2007 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
|
|
|
|
#
|
|
|
|
|
2008-01-22 14:47:46 +05:30
|
|
|
# $Id$
|
2007-12-24 20:26:15 +05:30
|
|
|
|
|
|
|
"""
|
2008-01-25 02:08:10 +05:30
|
|
|
GrampletView interface.
|
2007-12-24 20:26:15 +05:30
|
|
|
"""
|
|
|
|
|
2008-02-19 01:37:09 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2009-02-09 09:36:33 +05:30
|
|
|
# Python modules
|
2008-02-19 01:37:09 +05:30
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2007-12-24 20:26:15 +05:30
|
|
|
import gtk
|
2007-12-25 10:04:42 +05:30
|
|
|
|
2009-02-09 09:36:33 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2009-10-08 02:21:12 +05:30
|
|
|
from gui.views.pageview import PageView
|
2010-02-07 10:14:33 +05:30
|
|
|
from gen.ggettext import gettext as _
|
|
|
|
from gui.widgets.grampletpane import GrampletPane
|
2010-02-07 09:34:48 +05:30
|
|
|
|
|
|
|
class GrampletView(PageView):
|
|
|
|
"""
|
|
|
|
GrampletView interface
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate):
|
|
|
|
"""
|
|
|
|
Create a GrampletView, with the current dbstate and uistate
|
|
|
|
"""
|
|
|
|
PageView.__init__(self, _('Gramplets'), dbstate, uistate)
|
|
|
|
|
|
|
|
def build_widget(self):
|
|
|
|
"""
|
|
|
|
Builds the container widget for the interface. Must be overridden by the
|
|
|
|
the base class. Returns a gtk container widget.
|
|
|
|
"""
|
|
|
|
# load the user's gramplets and set columns, etc
|
|
|
|
return GrampletPane(self, self.dbstate, self.uistate)
|
|
|
|
|
|
|
|
def define_actions(self):
|
|
|
|
"""
|
|
|
|
Defines the UIManager actions. Called by the ViewManager to set up the
|
|
|
|
View. The user typically defines self.action_list and
|
|
|
|
self.action_toggle_list in this function.
|
|
|
|
"""
|
|
|
|
self.action = gtk.ActionGroup(self.title + "/Gramplets")
|
|
|
|
self.action.add_actions([('AddGramplet',gtk.STOCK_ADD,_("_Add a gramplet")),
|
|
|
|
('RestoreGramplet',None,_("_Undelete gramplet")),
|
|
|
|
('Columns1',None,_("Set Columns to _1"),
|
|
|
|
None,None,
|
|
|
|
lambda obj:self.widget.set_columns(1)),
|
|
|
|
('Columns2',None,_("Set Columns to _2"),
|
|
|
|
None,None,
|
|
|
|
lambda obj:self.widget.set_columns(2)),
|
|
|
|
('Columns3',None,_("Set Columns to _3"),
|
|
|
|
None,None,
|
|
|
|
lambda obj:self.widget.set_columns(3)),
|
|
|
|
])
|
|
|
|
self._add_action_group(self.action)
|
|
|
|
|
|
|
|
def get_stock(self):
|
|
|
|
"""
|
|
|
|
Return image associated with the view, which is used for the
|
|
|
|
icon for the button.
|
|
|
|
"""
|
|
|
|
return 'gramps-gramplet'
|
|
|
|
|
|
|
|
def get_viewtype_stock(self):
|
|
|
|
"""Type of view in category
|
|
|
|
"""
|
|
|
|
return 'gramps-gramplet'
|
|
|
|
|
|
|
|
def set_inactive(self):
|
|
|
|
self.active = False
|
|
|
|
self.widget.set_inactive()
|
|
|
|
|
|
|
|
def set_active(self):
|
|
|
|
self.active = True
|
|
|
|
self.widget.set_active()
|
|
|
|
|
|
|
|
def ui_definition(self):
|
|
|
|
return """
|
|
|
|
<ui>
|
|
|
|
<menubar name="MenuBar">
|
|
|
|
<menu action="ViewMenu">
|
|
|
|
<menuitem action="Columns1"/>
|
|
|
|
<menuitem action="Columns2"/>
|
|
|
|
<menuitem action="Columns3"/>
|
|
|
|
</menu>
|
|
|
|
</menubar>
|
|
|
|
<popup name="Popup">
|
|
|
|
<menuitem action="AddGramplet"/>
|
|
|
|
<menuitem action="RestoreGramplet"/>
|
|
|
|
<separator/>
|
|
|
|
<menuitem action="Columns1"/>
|
|
|
|
<menuitem action="Columns2"/>
|
|
|
|
<menuitem action="Columns3"/>
|
|
|
|
</popup>
|
|
|
|
</ui>
|
|
|
|
"""
|
|
|
|
|
|
|
|
def on_delete(self):
|
|
|
|
self.widget.on_delete()
|