gramps/src/PageView.py

74 lines
2.3 KiB
Python
Raw Normal View History

#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2005 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$
import gtk
class PageView:
def __init__(self,title,state):
self.title = title
self.state = state
self.action_list = []
self.action_toggle_list = []
self.action_group = None
self.widget = None
self.ui = ""
def get_stock(self):
return gtk.STOCK_MEDIA_MISSING
def get_ui(self):
return self.ui
def get_title(self):
return self.title
def get_display(self):
if not self.widget:
self.widget = self.build_widget()
return self.widget
def build_widget(self):
assert False
def define_actions(self):
assert False
def _build_action_group(self):
self.action_group = gtk.ActionGroup(self.title)
if len(self.action_list) > 0:
self.action_group.add_actions(self.action_list)
if len(self.action_toggle_list) > 0:
self.action_group.add_toggle_actions(self.action_toggle_list)
def add_action(self, name, stock_icon, label, accel=None, tip=None, callback=None):
self.action_list.append((name,stock_icon,label,accel,tip,callback))
def add_toggle_action(self, name, stock_icon, label, accel=None, tip=None, callback=None):
self.action_toggle_list.append((name,stock_icon,label,accel,tip,callback))
def get_actions(self):
if not self.action_group:
self.define_actions()
self._build_action_group()
return self.action_group