diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5beaab5b0..cca6d1d87 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -89,7 +89,6 @@ src/gui/grampsgui.py
src/gui/makefilter.py
src/gui/utils.py
src/gui/viewmanager.py
-src/gui/workspace.py
# gui/editors - the GUI editors package
src/gui/editors/addmedia.py
diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am
index fd91c2104..45f208040 100644
--- a/src/gui/Makefile.am
+++ b/src/gui/Makefile.am
@@ -27,8 +27,7 @@ pkgdata_PYTHON = \
pluginmanager.py \
sidebar.py \
utils.py \
- viewmanager.py \
- workspace.py
+ viewmanager.py
pkgpyexecdir = @pkgpyexecdir@/gui
pkgpythondir = @pkgpythondir@/gui
diff --git a/src/gui/viewmanager.py b/src/gui/viewmanager.py
index 8bb65389a..0169a122a 100644
--- a/src/gui/viewmanager.py
+++ b/src/gui/viewmanager.py
@@ -92,7 +92,6 @@ from gui.configure import GrampsPreferences
from gen.db.backup import backup
from gen.db.exceptions import DbException
from GrampsAboutDialog import GrampsAboutDialog
-from workspace import Workspace
from gui.navigator import Navigator
from gui.views.tags import Tags
from gen.utils.configmanager import safe_eval
@@ -1149,21 +1148,13 @@ class ViewManager(CLIManager):
"""
Create a new page and set it as the current page.
"""
- wspace = Workspace(self.uistate, self.dbstate)
try:
- page = page_def(self.dbstate, self.uistate, wspace)
+ page = page_def(pdata, self.dbstate, self.uistate)
except:
import traceback
LOG.warn("View '%s' failed to load." % pdata.id)
traceback.print_exc()
return
- # Category is (string, trans):
- page.set_category(pdata.category)
- page.set_ident(page.get_category() + '_' + pdata.id)
- page_title = page.get_title()
- page_category = page.get_category()
- page_translated_category = page.get_translated_category()
- page_stock = page.get_stock()
page.define_actions()
try:
@@ -1173,22 +1164,18 @@ class ViewManager(CLIManager):
print("ERROR: '%s' failed to create view" % pdata.name)
traceback.print_exc()
return
- page_display.show_all()
page.post()
- wspace.add_view(page)
self.pages.append(page)
-
- wspace.define_actions()
# create icon/label for workspace notebook
hbox = gtk.HBox()
image = gtk.Image()
- image.set_from_stock(page_stock, gtk.ICON_SIZE_MENU)
+ image.set_from_stock(page.get_stock(), gtk.ICON_SIZE_MENU)
hbox.pack_start(image, False)
hbox.add(gtk.Label(pdata.name))
hbox.show_all()
- page_num = self.notebook.append_page(wspace.get_display(), hbox)
+ page_num = self.notebook.append_page(page.get_display(), hbox)
def view_changed(self, notebook, page, page_num):
"""
diff --git a/src/gui/views/listview.py b/src/gui/views/listview.py
index 31b216079..173a044a8 100644
--- a/src/gui/views/listview.py
+++ b/src/gui/views/listview.py
@@ -50,6 +50,7 @@ import pango
# GRAMPS
#
#----------------------------------------------------------------
+from gui.views.pageview import PageView, FILTER_PAGE
from gui.views.navigationview import NavigationView
from gui.columnorder import ColumnOrder
import config
@@ -91,10 +92,10 @@ class ListView(NavigationView):
FILTER_TYPE = None # Set in inheriting class
QR_CATEGORY = -1
- def __init__(self, title, dbstate, uistate, columns, handle_col,
+ def __init__(self, title, pdata, dbstate, uistate, columns, handle_col,
make_model, signal_map, get_bookmarks, bm_type, nav_group,
multiple=False, filter_class=None, markup=None):
- NavigationView.__init__(self, title, dbstate, uistate,
+ NavigationView.__init__(self, title, pdata, dbstate, uistate,
get_bookmarks, bm_type, nav_group)
#default is listviews keep themself in sync with database
self._dirty_on_change_inactive = False
@@ -861,6 +862,16 @@ class ListView(NavigationView):
self.edit_action.set_visible(True)
self.edit_action.set_sensitive(not self.dbstate.db.readonly)
+ def sidebar_changed(self, page_type, active, index):
+ """
+ Called when the sidebar page is changed.
+ """
+ PageView.sidebar_changed(self, page_type, active, index)
+ if active and page_type == FILTER_PAGE:
+ self.search_bar.hide()
+ else:
+ self.search_bar.show()
+
def on_delete(self):
"""
Save the column widths when the view is shutdown.
@@ -877,7 +888,7 @@ class ListView(NavigationView):
index += 1
newsize.append(size)
self._config.set('columns.size', newsize)
- self._config.save()
+ PageView.on_delete(self)
####################################################################
# Export data
diff --git a/src/gui/views/navigationview.py b/src/gui/views/navigationview.py
index 63007271f..e85e2eb0c 100644
--- a/src/gui/views/navigationview.py
+++ b/src/gui/views/navigationview.py
@@ -78,8 +78,8 @@ class NavigationView(PageView):
should derive from this class.
"""
- def __init__(self, title, state, uistate, bookmarks, bm_type, nav_group):
- PageView.__init__(self, title, state, uistate)
+ def __init__(self, title, pdata, state, uistate, bookmarks, bm_type, nav_group):
+ PageView.__init__(self, title, pdata, state, uistate)
self.bookmarks = bm_type(self.dbstate, self.uistate, bookmarks,
self.goto_handle)
@@ -107,6 +107,7 @@ class NavigationView(PageView):
"""
Define menu actions.
"""
+ PageView.define_actions(self)
self.bookmark_actions()
self.navigation_actions()
diff --git a/src/gui/views/pageview.py b/src/gui/views/pageview.py
index 9ef41ccef..413af9655 100644
--- a/src/gui/views/pageview.py
+++ b/src/gui/views/pageview.py
@@ -49,8 +49,19 @@ from gen.ggettext import gettext as _
import Errors
from gui.dbguielement import DbGUIElement
from gui.widgets.menutoolbuttonaction import MenuToolButtonAction
+from gui.sidebar import Sidebar
+from gui.widgets.grampletpane import GrampletPane
+from gui.configure import ConfigureDialog
from config import config
+#-------------------------------------------------------------------------
+#
+# Constants
+#
+#-------------------------------------------------------------------------
+GRAMPLET_PAGE = 0
+FILTER_PAGE = 1
+
#------------------------------------------------------------------------------
#
# PageView
@@ -88,8 +99,9 @@ class PageView(DbGUIElement):
CONFIGSETTINGS = []
- def __init__(self, title, dbstate, uistate):
+ def __init__(self, title, pdata, dbstate, uistate):
self.title = title
+ self.pdata = pdata
self.dbstate = dbstate
self.uistate = uistate
self.action_list = []
@@ -99,15 +111,29 @@ class PageView(DbGUIElement):
self.action_group = None
self.additional_action_groups = []
self.additional_uis = []
- self.widget = None
- self.ui_def = ''
+ self.ui_def = '''
+
+
+
+
+
+
+
+ '''
self.dirty = True
self.active = False
self._dirty_on_change_inactive = True
self.func_list = {}
- self.category = "Miscellaneous"
- self.ident = None
- self.translated_category = _("Miscellaneous")
+
+ if isinstance(self.pdata.category, tuple):
+ self.category, self.translated_category = self.pdata.category
+ else:
+ raise AttributeError("View category must be (name, translated-name)")
+ self.ident = self.category + '_' + self.pdata.id
self.dbstate.connect('no-database', self.disable_action_group)
self.dbstate.connect('database-changed', self.enable_action_group)
@@ -118,10 +144,108 @@ class PageView(DbGUIElement):
self.handle_col = 0
self._config = None
- self.__configure_content = None
+ self.init_config()
+
+ self.filter_class = None
+ self.top = None
+ self.gramplet_pane = None
+ self.sidebar = None
DbGUIElement.__init__(self, dbstate.db)
+ def build_interface(self):
+ """
+ Builds the container widget for the interface.
+ Returns a gtk container widget.
+ """
+ self.sidebar = Sidebar(self.sidebar_changed, self.sidebar_closed)
+ hpane = gtk.HPaned()
+ vpane = gtk.VPaned()
+ hpane.pack1(vpane, resize=True, shrink=True)
+ hpane.pack2(self.sidebar.get_display(), resize=False, shrink=False)
+ hpane.show()
+ vpane.show()
+
+ widget = self.build_widget()
+ widget.show_all()
+ vpane.add1(widget)
+ initial_page = self._config.get('sidebar.page')
+
+ self.gramplet_pane = self.__create_gramplet_pane()
+
+ if self.filter_class:
+ self.add_filter(self.filter_class)
+
+ self.sidebar.set_current_page(initial_page)
+ if self._config.get('sidebar.visible'):
+ self.sidebar.show()
+ else:
+ self.sidebar.hide()
+
+ return hpane
+
+ def add_filter(self, filter_class):
+ """
+ Add a filter to the workspace sidebar.
+ """
+ self.filter_sidebar = filter_class(self.dbstate, self.uistate,
+ self.__filter_clicked)
+ top = self.filter_sidebar.get_widget()
+ top.show_all()
+ self.sidebar.add(_('Filter'), top, FILTER_PAGE)
+
+ def remove_filter(self):
+ """
+ Remove the filter from the workspace sidebar.
+ """
+ self.filter_sidebar = None
+ self.sidebar.remove(FILTER_PAGE)
+
+ def __create_gramplet_pane(self):
+ """
+ Create a gramplet pane.
+ """
+ gramplet_pane = GrampletPane(self.ident + "_sidebar",
+ self, self.dbstate, self.uistate,
+ column_count=1)
+ gramplet_pane.show_all()
+ self.sidebar.add(_('Gramplets'), gramplet_pane, GRAMPLET_PAGE)
+ return gramplet_pane
+
+ def __filter_clicked(self):
+ """
+ Called when the filter 'Find' button is clicked.
+ """
+ self.generic_filter = self.filter_sidebar.get_filter()
+ self.build_tree()
+
+ def __sidebar_toggled(self, action):
+ """
+ Called when the sidebar is toggled.
+ """
+ active = action.get_active()
+ if active:
+ self.sidebar.show()
+ self.sidebar_changed(self.sidebar.get_page_type(), True, None)
+ else:
+ self.sidebar.hide()
+ self.sidebar_changed(None, False, None)
+ self._config.set('sidebar.visible', active)
+
+ def sidebar_changed(self, page_type, active, index):
+ """
+ Called when the sidebar page is changed.
+ """
+ if index is not None:
+ self._config.set('sidebar.page', index)
+
+ def sidebar_closed(self):
+ """
+ Called when the sidebar close button is clicked.
+ """
+ uimanager = self.uistate.uimanager
+ uimanager.get_action('/MenuBar/ViewMenu/Bars/Sidebar').activate()
+
def key_press_handler(self, widget, event):
"""
A general keypress handler. Override if you want to handle
@@ -212,6 +336,7 @@ class PageView(DbGUIElement):
Called with the PageView is set as active. If the page is "dirty",
then we rebuild the data.
"""
+ self.gramplet_pane.set_active()
self.active = True
if self.dirty:
self.uistate.set_busy_cursor(True)
@@ -222,6 +347,7 @@ class PageView(DbGUIElement):
"""
Marks page as being inactive (not currently displayed)
"""
+ self.gramplet_pane.set_inactive()
self.active = False
def build_tree(self):
@@ -279,20 +405,6 @@ class PageView(DbGUIElement):
"""
return self.title
-
- def set_category(self, category):
- """
- Set the category of the view. This is used to define the text for the
- button, and for the tab label.
-
- category - a tuple of the form (category, translated-category)
- """
- if isinstance(category, tuple):
- self.category = category[0]
- self.translated_category = category[1]
- else:
- raise AttributeError("View category must be (name, translated-name)")
-
def get_category(self):
"""
Return the category name of the view. This is used to define
@@ -307,25 +419,18 @@ class PageView(DbGUIElement):
"""
return self.translated_category
- def set_ident(self, ident):
- """
- Set the id of the view. This is an unique ident
- """
- self.ident = ident
- self.init_config()
-
def get_display(self):
"""
Builds the graphical display, returning the top level widget.
"""
- if not self.widget:
- self.widget = self.build_widget()
- return self.widget
+ if not self.top:
+ self.top = self.build_interface()
+ return self.top
def build_widget(self):
"""
- Builds the container widget for the interface. Must be overridden by the
- the base class. Returns a gtk container widget.
+ Builds the container widget for the main view pane. Must be overridden
+ by the the base class. Returns a gtk container widget.
"""
raise NotImplementedError
@@ -334,10 +439,12 @@ class PageView(DbGUIElement):
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.
-
- Derived classes must override this function.
"""
- raise NotImplementedError
+ self._add_toggle_action('Sidebar', None, _('_Sidebar'),
+ None, None, self.__sidebar_toggled,
+ self._config.get('sidebar.visible'))
+ self._add_action("AddGramplet", gtk.STOCK_ADD, _("Add a gramplet"))
+ self._add_action("RestoreGramplet", None, _("Restore a gramplet"))
def __build_action_group(self):
"""
@@ -454,7 +561,8 @@ class PageView(DbGUIElement):
Method called on shutdown. Data views should put code here
that should be called when quiting the main application.
"""
- pass
+ self.gramplet_pane.on_delete()
+ self._config.save()
def init_config(self):
"""
@@ -512,3 +620,56 @@ class PageView(DbGUIElement):
:return: list of functions
"""
raise NotImplementedError
+
+ def __get_configure_funcs(self):
+ """
+ Return a combined list of configuration functions for all of the panes
+ in the view.
+
+ :return: list of functions
+ """
+ retval = []
+ if self.can_configure():
+ other = self._get_configure_page_funcs()
+ if callable(other):
+ retval += other()
+ else:
+ retval += other
+
+ if self.gramplet_pane is not None:
+ func = self.gramplet_pane._get_configure_page_funcs()
+ retval += func()
+
+ return retval
+
+ def configure(self):
+ """
+ Open the configure dialog for the workspace.
+ """
+ title = _("Configure %(cat)s - %(view)s") % \
+ {'cat': self.get_translated_category(),
+ 'view': self.get_title()}
+ try:
+ ViewConfigureDialog(self.uistate, self.dbstate,
+ self.__get_configure_funcs(),
+ self, self._config, dialogtitle=title,
+ ident=_("%(cat)s - %(view)s") %
+ {'cat': self.get_translated_category(),
+ 'view': self.get_title()})
+ except Errors.WindowActiveError:
+ return
+
+class ViewConfigureDialog(ConfigureDialog):
+ """
+ All workspaces can have their own configuration dialog
+ """
+ def __init__(self, uistate, dbstate, configure_page_funcs, configobj,
+ configmanager,
+ dialogtitle=_("Preferences"), on_close=None, ident=''):
+ self.ident = ident
+ ConfigureDialog.__init__(self, uistate, dbstate, configure_page_funcs,
+ configobj, configmanager,
+ dialogtitle=dialogtitle, on_close=on_close)
+
+ def build_menu_names(self, obj):
+ return (_('Configure %s View') % self.ident, None)
diff --git a/src/gui/widgets/grampletpane.py b/src/gui/widgets/grampletpane.py
index c8b806d1b..3362c73cd 100644
--- a/src/gui/widgets/grampletpane.py
+++ b/src/gui/widgets/grampletpane.py
@@ -227,8 +227,9 @@ class GrampletWindow(ManagedWindow.ManagedWindow):
self.gramplet.gvproperties.hide()
if self.gramplet.titlelabel_entry:
self.gramplet.titlelabel_entry.hide()
- for widget in self.gramplet.pui.hidden_widgets():
- widget.hide()
+ if self.gramplet.pui:
+ for widget in self.gramplet.pui.hidden_widgets():
+ widget.hide()
def handle_response(self, object, response):
"""
@@ -1288,8 +1289,8 @@ class GrampletPane(gtk.ScrolledWindow):
def _button_press(self, obj, event):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self._popup_xy = (event.x, event.y)
- menu = self.uistate.uimanager.get_widget('/Popup')
- ag_menu = self.uistate.uimanager.get_widget('/Popup/AddGramplet')
+ uiman = self.uistate.uimanager
+ ag_menu = uiman.get_widget('/GrampletPopup/AddGramplet')
if ag_menu:
qr_menu = ag_menu.get_submenu()
qr_menu = gtk.Menu()
@@ -1297,10 +1298,9 @@ class GrampletPane(gtk.ScrolledWindow):
in AVAILABLE_GRAMPLETS()]
names.sort()
for name in names:
- add_menuitem(qr_menu, name,
- None, self.add_gramplet)
- self.uistate.uimanager.get_widget('/Popup/AddGramplet').set_submenu(qr_menu)
- rg_menu = self.uistate.uimanager.get_widget('/Popup/RestoreGramplet')
+ add_menuitem(qr_menu, name, None, self.add_gramplet)
+ ag_menu.set_submenu(qr_menu)
+ rg_menu = uiman.get_widget('/GrampletPopup/RestoreGramplet')
if rg_menu:
qr_menu = rg_menu.get_submenu()
if qr_menu is not None:
@@ -1311,9 +1311,9 @@ class GrampletPane(gtk.ScrolledWindow):
if len(names) > 0:
qr_menu = gtk.Menu()
for name in names:
- add_menuitem(qr_menu, name,
- None, self.restore_gramplet)
- self.uistate.uimanager.get_widget('/Popup/RestoreGramplet').set_submenu(qr_menu)
+ add_menuitem(qr_menu, name, None, self.restore_gramplet)
+ rg_menu.set_submenu(qr_menu)
+ menu = uiman.get_widget('/GrampletPopup')
if menu:
menu.popup(None, None, None, 1, event.time)
return True
diff --git a/src/gui/workspace.py b/src/gui/workspace.py
deleted file mode 100644
index 5fa01b3c5..000000000
--- a/src/gui/workspace.py
+++ /dev/null
@@ -1,340 +0,0 @@
-#
-# Gramps - a GTK+/GNOME based genealogy program
-#
-# Copyright (C) 2010 Nick Hall
-# Copyright (C) 2010 Douglas S. Blank
-#
-# 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$
-
-"""
-Workspace
-"""
-#-------------------------------------------------------------------------
-#
-# Python modules
-#
-#-------------------------------------------------------------------------
-from gen.ggettext import gettext as _
-
-#-------------------------------------------------------------------------
-#
-# GNOME modules
-#
-#-------------------------------------------------------------------------
-import gtk
-
-#-------------------------------------------------------------------------
-#
-# Gramps modules
-#
-#-------------------------------------------------------------------------
-import Errors
-from gui.sidebar import Sidebar
-from gui.widgets.grampletpane import GrampletPane
-from gui.views.listview import ListView
-from gui.configure import ConfigureDialog
-import config
-
-#-------------------------------------------------------------------------
-#
-# Constants
-#
-#-------------------------------------------------------------------------
-GRAMPLET_PAGE = 0
-FILTER_PAGE = 1
-
-#-------------------------------------------------------------------------
-#
-# Workspace class
-#
-#-------------------------------------------------------------------------
-class Workspace(object):
- """
- A Workspace contains panes to contain a view and associated objects such as
- a filter and gramplet pane.
- """
- def __init__(self, uistate, dbstate):
- self.uistate = uistate
- self.dbstate = dbstate
- self.active = False
- self.view = None
- self._config = None
- self.sidebar = Sidebar(self.sidebar_changed, self.sidebar_closed)
- self.hpane = gtk.HPaned()
- self.vpane = gtk.VPaned()
- self.hpane.pack1(self.vpane, resize=True, shrink=True)
- self.hpane.pack2(self.sidebar.get_display(), resize=False, shrink=False)
- self.hpane.show()
- self.vpane.show()
-
- def get_display(self):
- """
- Return the top container widget for the GUI.
- """
- return self.hpane
-
- def add_view(self, view):
- """
- Add a view to the workspace.
- """
- self.view = view
- self.vpane.add1(view.get_display())
- initial_page = self.view._config.get('sidebar.page')
-
- self.gramplet_pane = self.__create_gramplet_pane()
-
- if isinstance(view, ListView):
- self.add_filter(view.filter_class)
-
- if self.view._config.get('sidebar.visible'):
- self.sidebar.show()
- else:
- self.sidebar.hide()
-
- self.sidebar.set_current_page(initial_page)
-
- def add_aux(self, aux):
- """
- Add an auxilliary object to the workspace.
- """
- self.aux = aux
- self.vpane.add2(aux.get_display())
-
- def add_filter(self, filter_class):
- """
- Add a filter to the workspace sidebar.
- """
- self.filter_sidebar = filter_class(self.dbstate, self.uistate,
- self.__filter_clicked)
- top = self.filter_sidebar.get_widget()
- top.show_all()
- self.sidebar.add(_('Filter'), top, FILTER_PAGE)
-
- def remove_filter(self,):
- """
- Remove the filter from the workspace sidebar.
- """
- self.filter_sidebar = None
- self.sidebar.remove(FILTER_PAGE)
-
- def __create_gramplet_pane(self):
- """
- Create a gramplet pane.
- """
- self.uidef = '''
-
-
-
-
-
-
-
- '''
-
- eb = gtk.EventBox()
- eb.connect('button-press-event', self._gramplet_button_press)
-
- gramplet_pane = GrampletPane(self.view.ident + "_sidebar",
- self, self.dbstate, self.uistate,
- column_count=1)
- gramplet_pane.show_all()
- eb.add(gramplet_pane)
- eb.show()
- self.sidebar.add(_('Gramplets'), eb, GRAMPLET_PAGE)
- return gramplet_pane
-
- def _gramplet_button_press(self, obj, event):
- """
- Called to display the context menu in the gramplet pane.
- """
- if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
- menu = self.uistate.uimanager.get_widget('/Popup')
- if menu:
- menu.popup(None, None, None, event.button, event.time)
- return True
-
- def __filter_clicked(self):
- """
- Called when the filter 'Find' button is clicked.
- """
- self.view.generic_filter = self.filter_sidebar.get_filter()
- self.view.build_tree()
-
- def __sidebar_toggled(self, action):
- """
- Called when the sidebar is toggled.
- """
- active = action.get_active()
- if active:
- self.sidebar.show()
- self.sidebar_changed(self.sidebar.get_page_type(), True, None)
- else:
- self.sidebar.hide()
- self.sidebar_changed(None, False, None)
- self.view._config.set('sidebar.visible', active)
-
- def sidebar_changed(self, page_type, active, index):
- """
- Called when the sidebar page is changed.
- """
- if index is not None:
- self.view._config.set('sidebar.page', index)
- if isinstance(self.view, ListView):
- if active and page_type == FILTER_PAGE:
- self.view.search_bar.hide()
- else:
- self.view.search_bar.show()
-
- def sidebar_closed(self):
- """
- Called when the sidebar close button is clicked.
- """
- uimanager = self.uistate.uimanager
- uimanager.get_action('/MenuBar/ViewMenu/Bars/Sidebar').activate()
-
- def get_title(self):
- """
- Return the title of the view.
- """
- if self.view:
- return self.view.title
- return ''
-
- def define_actions(self):
- """
- Defines the UIManager actions.
- """
- self.action_group = gtk.ActionGroup('Workspace')
- self.action_group.add_toggle_actions([
- ('Sidebar', None, _('_Sidebar'),
- None, None, self.__sidebar_toggled,
- self.view._config.get('sidebar.visible'))
- ])
- self.action_group.add_actions([
- ("AddGramplet", None, _("Add a gramplet")),
- ("RestoreGramplet", None, _("Restore a gramplet")
- )])
-
- def set_active(self):
- """
- Called when the view is set as active.
- """
- self.active = True
- self.gramplet_pane.set_active()
- self.view.set_active()
-
- def set_inactive(self):
- """
- Called when the view is set as inactive.
- """
- self.active = False
- self.gramplet_pane.set_inactive()
- self.view.set_inactive()
-
- def get_actions(self):
- """
- Return the actions that should be used for the view.
- """
- action_list = self.view.get_actions()
- action_list.append(self.action_group)
- return action_list
-
- def ui_definition(self):
- """
- Returns the XML UI definition for the UIManager.
- """
- return self.view.ui_definition()
-
- def additional_ui_definitions(self):
- """
- Return any additional interfaces for the UIManager that the view
- needs to define.
- """
- defs = self.view.additional_ui_definitions()
- defs.append(self.uidef)
- return defs
-
- def change_page(self):
- """
- Called when the view changes.
- """
- self.view.change_page()
-
- def on_delete(self):
- """
- Method called on shutdown.
- """
- self.view.on_delete()
- self.gramplet_pane.on_delete()
-
- def can_configure(self):
- """
- Returns True if the workspace has a configure window.
- """
- return self.view.can_configure() or self.gramplet_pane.can_configure()
-
- def _get_configure_page_funcs(self):
- """
- Return a list of functions that create gtk elements to use in the
- notebook pages of the Configuration dialog.
- """
- retval = []
- if self.view.can_configure():
- other = self.view._get_configure_page_funcs()
- if callable(other):
- retval += other()
- else:
- retval += other
- func = self.gramplet_pane._get_configure_page_funcs()
- return retval + func()
-
- def configure(self):
- """
- Open the configure dialog for the workspace.
- """
- __configure_content = self._get_configure_page_funcs()
- title = _("Configure %(cat)s - %(view)s") % \
- {'cat': self.view.get_translated_category(),
- 'view': self.view.get_title()}
- try:
- ViewConfigureDialog(self.uistate, self.dbstate,
- __configure_content,
- self, self.view._config, dialogtitle=title,
- ident=_("%(cat)s - %(view)s") %
- {'cat': self.view.get_translated_category(),
- 'view': self.view.get_title()})
- except Errors.WindowActiveError:
- return
-
-class ViewConfigureDialog(ConfigureDialog):
- """
- All workspaces can have their own configuration dialog
- """
- def __init__(self, uistate, dbstate, configure_page_funcs, configobj,
- configmanager,
- dialogtitle=_("Preferences"), on_close=None, ident=''):
- self.ident = ident
- ConfigureDialog.__init__(self, uistate, dbstate, configure_page_funcs,
- configobj, configmanager,
- dialogtitle=dialogtitle, on_close=on_close)
-
- def build_menu_names(self, obj):
- return (_('Configure %s View') % self.ident, None)
diff --git a/src/plugins/lib/libpersonview.py b/src/plugins/lib/libpersonview.py
index c045cd4d1..cbfde2d3c 100644
--- a/src/plugins/lib/libpersonview.py
+++ b/src/plugins/lib/libpersonview.py
@@ -114,7 +114,7 @@ class BasePersonView(ListView):
FILTER_TYPE = "Person"
QR_CATEGORY = CATEGORY_QR_PERSON
- def __init__(self, dbstate, uistate, title, model, nav_group=0):
+ def __init__(self, pdata, dbstate, uistate, title, model, nav_group=0):
"""
Create the Person View
"""
@@ -128,7 +128,7 @@ class BasePersonView(ListView):
}
ListView.__init__(
- self, title, dbstate, uistate,
+ self, title, pdata, dbstate, uistate,
BasePersonView.COLUMN_NAMES, len(BasePersonView.COLUMN_NAMES),
model, signal_map, dbstate.db.get_bookmarks(),
Bookmarks.PersonBookmarks, nav_group,
@@ -143,6 +143,8 @@ class BasePersonView(ListView):
uistate.connect('nameformat-changed', self.build_tree)
+ self.additional_uis.append(self.additional_ui())
+
def navigation_type(self):
"""
Return the navigation type of the view.
@@ -174,7 +176,7 @@ class BasePersonView(ListView):
"""
return 'gramps-person'
- def ui_definition(self):
+ def additional_ui(self):
"""
Defines the UI string for UIManager
"""
diff --git a/src/plugins/lib/libplaceview.py b/src/plugins/lib/libplaceview.py
index 5b2743fd7..ab924e950 100644
--- a/src/plugins/lib/libplaceview.py
+++ b/src/plugins/lib/libplaceview.py
@@ -120,7 +120,7 @@ class PlaceBaseView(ListView):
FILTER_TYPE = "Place"
QR_CATEGORY = CATEGORY_QR_PLACE
- def __init__(self, dbstate, uistate, title, model, nav_group,
+ def __init__(self, pdata, dbstate, uistate, title, model, nav_group,
markup=None):
signal_map = {
@@ -134,7 +134,7 @@ class PlaceBaseView(ListView):
self.mapservicedata = {}
ListView.__init__(
- self, title, dbstate, uistate,
+ self, title, pdata, dbstate, uistate,
self.COLUMN_NAMES, 14,
model, signal_map,
dbstate.db.get_place_bookmarks(),
@@ -147,6 +147,8 @@ class PlaceBaseView(ListView):
'BackSpace' : self.key_delete,
})
+ self.additional_uis.append(self.additional_ui())
+
def navigation_type(self):
return 'Place'
@@ -289,7 +291,7 @@ class PlaceBaseView(ListView):
def get_stock(self):
return 'gramps-place'
- def ui_definition(self):
+ def additional_ui(self):
return '''