Sidebar tidy-up and bug fixes
svn: r16319
This commit is contained in:
@@ -89,7 +89,6 @@ src/gui/grampsgui.py
|
|||||||
src/gui/makefilter.py
|
src/gui/makefilter.py
|
||||||
src/gui/utils.py
|
src/gui/utils.py
|
||||||
src/gui/viewmanager.py
|
src/gui/viewmanager.py
|
||||||
src/gui/workspace.py
|
|
||||||
|
|
||||||
# gui/editors - the GUI editors package
|
# gui/editors - the GUI editors package
|
||||||
src/gui/editors/addmedia.py
|
src/gui/editors/addmedia.py
|
||||||
|
@@ -27,8 +27,7 @@ pkgdata_PYTHON = \
|
|||||||
pluginmanager.py \
|
pluginmanager.py \
|
||||||
sidebar.py \
|
sidebar.py \
|
||||||
utils.py \
|
utils.py \
|
||||||
viewmanager.py \
|
viewmanager.py
|
||||||
workspace.py
|
|
||||||
|
|
||||||
pkgpyexecdir = @pkgpyexecdir@/gui
|
pkgpyexecdir = @pkgpyexecdir@/gui
|
||||||
pkgpythondir = @pkgpythondir@/gui
|
pkgpythondir = @pkgpythondir@/gui
|
||||||
|
@@ -92,7 +92,6 @@ from gui.configure import GrampsPreferences
|
|||||||
from gen.db.backup import backup
|
from gen.db.backup import backup
|
||||||
from gen.db.exceptions import DbException
|
from gen.db.exceptions import DbException
|
||||||
from GrampsAboutDialog import GrampsAboutDialog
|
from GrampsAboutDialog import GrampsAboutDialog
|
||||||
from workspace import Workspace
|
|
||||||
from gui.navigator import Navigator
|
from gui.navigator import Navigator
|
||||||
from gui.views.tags import Tags
|
from gui.views.tags import Tags
|
||||||
from gen.utils.configmanager import safe_eval
|
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.
|
Create a new page and set it as the current page.
|
||||||
"""
|
"""
|
||||||
wspace = Workspace(self.uistate, self.dbstate)
|
|
||||||
try:
|
try:
|
||||||
page = page_def(self.dbstate, self.uistate, wspace)
|
page = page_def(pdata, self.dbstate, self.uistate)
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
LOG.warn("View '%s' failed to load." % pdata.id)
|
LOG.warn("View '%s' failed to load." % pdata.id)
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return
|
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()
|
page.define_actions()
|
||||||
try:
|
try:
|
||||||
@@ -1173,22 +1164,18 @@ class ViewManager(CLIManager):
|
|||||||
print("ERROR: '%s' failed to create view" % pdata.name)
|
print("ERROR: '%s' failed to create view" % pdata.name)
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return
|
return
|
||||||
page_display.show_all()
|
|
||||||
page.post()
|
page.post()
|
||||||
|
|
||||||
wspace.add_view(page)
|
|
||||||
self.pages.append(page)
|
self.pages.append(page)
|
||||||
|
|
||||||
wspace.define_actions()
|
|
||||||
|
|
||||||
# create icon/label for workspace notebook
|
# create icon/label for workspace notebook
|
||||||
hbox = gtk.HBox()
|
hbox = gtk.HBox()
|
||||||
image = gtk.Image()
|
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.pack_start(image, False)
|
||||||
hbox.add(gtk.Label(pdata.name))
|
hbox.add(gtk.Label(pdata.name))
|
||||||
hbox.show_all()
|
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):
|
def view_changed(self, notebook, page, page_num):
|
||||||
"""
|
"""
|
||||||
|
@@ -50,6 +50,7 @@ import pango
|
|||||||
# GRAMPS
|
# GRAMPS
|
||||||
#
|
#
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
|
from gui.views.pageview import PageView, FILTER_PAGE
|
||||||
from gui.views.navigationview import NavigationView
|
from gui.views.navigationview import NavigationView
|
||||||
from gui.columnorder import ColumnOrder
|
from gui.columnorder import ColumnOrder
|
||||||
import config
|
import config
|
||||||
@@ -91,10 +92,10 @@ class ListView(NavigationView):
|
|||||||
FILTER_TYPE = None # Set in inheriting class
|
FILTER_TYPE = None # Set in inheriting class
|
||||||
QR_CATEGORY = -1
|
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,
|
make_model, signal_map, get_bookmarks, bm_type, nav_group,
|
||||||
multiple=False, filter_class=None, markup=None):
|
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)
|
get_bookmarks, bm_type, nav_group)
|
||||||
#default is listviews keep themself in sync with database
|
#default is listviews keep themself in sync with database
|
||||||
self._dirty_on_change_inactive = False
|
self._dirty_on_change_inactive = False
|
||||||
@@ -861,6 +862,16 @@ class ListView(NavigationView):
|
|||||||
self.edit_action.set_visible(True)
|
self.edit_action.set_visible(True)
|
||||||
self.edit_action.set_sensitive(not self.dbstate.db.readonly)
|
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):
|
def on_delete(self):
|
||||||
"""
|
"""
|
||||||
Save the column widths when the view is shutdown.
|
Save the column widths when the view is shutdown.
|
||||||
@@ -877,7 +888,7 @@ class ListView(NavigationView):
|
|||||||
index += 1
|
index += 1
|
||||||
newsize.append(size)
|
newsize.append(size)
|
||||||
self._config.set('columns.size', newsize)
|
self._config.set('columns.size', newsize)
|
||||||
self._config.save()
|
PageView.on_delete(self)
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
# Export data
|
# Export data
|
||||||
|
@@ -78,8 +78,8 @@ class NavigationView(PageView):
|
|||||||
should derive from this class.
|
should derive from this class.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, title, state, uistate, bookmarks, bm_type, nav_group):
|
def __init__(self, title, pdata, state, uistate, bookmarks, bm_type, nav_group):
|
||||||
PageView.__init__(self, title, state, uistate)
|
PageView.__init__(self, title, pdata, state, uistate)
|
||||||
self.bookmarks = bm_type(self.dbstate, self.uistate, bookmarks,
|
self.bookmarks = bm_type(self.dbstate, self.uistate, bookmarks,
|
||||||
self.goto_handle)
|
self.goto_handle)
|
||||||
|
|
||||||
@@ -107,6 +107,7 @@ class NavigationView(PageView):
|
|||||||
"""
|
"""
|
||||||
Define menu actions.
|
Define menu actions.
|
||||||
"""
|
"""
|
||||||
|
PageView.define_actions(self)
|
||||||
self.bookmark_actions()
|
self.bookmark_actions()
|
||||||
self.navigation_actions()
|
self.navigation_actions()
|
||||||
|
|
||||||
|
@@ -49,8 +49,19 @@ from gen.ggettext import gettext as _
|
|||||||
import Errors
|
import Errors
|
||||||
from gui.dbguielement import DbGUIElement
|
from gui.dbguielement import DbGUIElement
|
||||||
from gui.widgets.menutoolbuttonaction import MenuToolButtonAction
|
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
|
from config import config
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Constants
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
GRAMPLET_PAGE = 0
|
||||||
|
FILTER_PAGE = 1
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# PageView
|
# PageView
|
||||||
@@ -88,8 +99,9 @@ class PageView(DbGUIElement):
|
|||||||
|
|
||||||
CONFIGSETTINGS = []
|
CONFIGSETTINGS = []
|
||||||
|
|
||||||
def __init__(self, title, dbstate, uistate):
|
def __init__(self, title, pdata, dbstate, uistate):
|
||||||
self.title = title
|
self.title = title
|
||||||
|
self.pdata = pdata
|
||||||
self.dbstate = dbstate
|
self.dbstate = dbstate
|
||||||
self.uistate = uistate
|
self.uistate = uistate
|
||||||
self.action_list = []
|
self.action_list = []
|
||||||
@@ -99,15 +111,29 @@ class PageView(DbGUIElement):
|
|||||||
self.action_group = None
|
self.action_group = None
|
||||||
self.additional_action_groups = []
|
self.additional_action_groups = []
|
||||||
self.additional_uis = []
|
self.additional_uis = []
|
||||||
self.widget = None
|
self.ui_def = '''<ui>
|
||||||
self.ui_def = '<ui></ui>'
|
<menubar name="MenuBar">
|
||||||
|
<menu action="ViewMenu">
|
||||||
|
<placeholder name="Bars">
|
||||||
|
<menuitem action="Sidebar"/>
|
||||||
|
</placeholder>
|
||||||
|
</menu>
|
||||||
|
</menubar>
|
||||||
|
<popup name="GrampletPopup">
|
||||||
|
<menuitem action="AddGramplet"/>
|
||||||
|
<menuitem action="RestoreGramplet"/>
|
||||||
|
</popup>
|
||||||
|
</ui>'''
|
||||||
self.dirty = True
|
self.dirty = True
|
||||||
self.active = False
|
self.active = False
|
||||||
self._dirty_on_change_inactive = True
|
self._dirty_on_change_inactive = True
|
||||||
self.func_list = {}
|
self.func_list = {}
|
||||||
self.category = "Miscellaneous"
|
|
||||||
self.ident = None
|
if isinstance(self.pdata.category, tuple):
|
||||||
self.translated_category = _("Miscellaneous")
|
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('no-database', self.disable_action_group)
|
||||||
self.dbstate.connect('database-changed', self.enable_action_group)
|
self.dbstate.connect('database-changed', self.enable_action_group)
|
||||||
@@ -118,10 +144,108 @@ class PageView(DbGUIElement):
|
|||||||
self.handle_col = 0
|
self.handle_col = 0
|
||||||
|
|
||||||
self._config = None
|
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)
|
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):
|
def key_press_handler(self, widget, event):
|
||||||
"""
|
"""
|
||||||
A general keypress handler. Override if you want to handle
|
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",
|
Called with the PageView is set as active. If the page is "dirty",
|
||||||
then we rebuild the data.
|
then we rebuild the data.
|
||||||
"""
|
"""
|
||||||
|
self.gramplet_pane.set_active()
|
||||||
self.active = True
|
self.active = True
|
||||||
if self.dirty:
|
if self.dirty:
|
||||||
self.uistate.set_busy_cursor(True)
|
self.uistate.set_busy_cursor(True)
|
||||||
@@ -222,6 +347,7 @@ class PageView(DbGUIElement):
|
|||||||
"""
|
"""
|
||||||
Marks page as being inactive (not currently displayed)
|
Marks page as being inactive (not currently displayed)
|
||||||
"""
|
"""
|
||||||
|
self.gramplet_pane.set_inactive()
|
||||||
self.active = False
|
self.active = False
|
||||||
|
|
||||||
def build_tree(self):
|
def build_tree(self):
|
||||||
@@ -279,20 +405,6 @@ class PageView(DbGUIElement):
|
|||||||
"""
|
"""
|
||||||
return self.title
|
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):
|
def get_category(self):
|
||||||
"""
|
"""
|
||||||
Return the category name of the view. This is used to define
|
Return the category name of the view. This is used to define
|
||||||
@@ -307,25 +419,18 @@ class PageView(DbGUIElement):
|
|||||||
"""
|
"""
|
||||||
return self.translated_category
|
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):
|
def get_display(self):
|
||||||
"""
|
"""
|
||||||
Builds the graphical display, returning the top level widget.
|
Builds the graphical display, returning the top level widget.
|
||||||
"""
|
"""
|
||||||
if not self.widget:
|
if not self.top:
|
||||||
self.widget = self.build_widget()
|
self.top = self.build_interface()
|
||||||
return self.widget
|
return self.top
|
||||||
|
|
||||||
def build_widget(self):
|
def build_widget(self):
|
||||||
"""
|
"""
|
||||||
Builds the container widget for the interface. Must be overridden by the
|
Builds the container widget for the main view pane. Must be overridden
|
||||||
the base class. Returns a gtk container widget.
|
by the the base class. Returns a gtk container widget.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@@ -334,10 +439,12 @@ class PageView(DbGUIElement):
|
|||||||
Defines the UIManager actions. Called by the ViewManager to set up the
|
Defines the UIManager actions. Called by the ViewManager to set up the
|
||||||
View. The user typically defines self.action_list and
|
View. The user typically defines self.action_list and
|
||||||
self.action_toggle_list in this function.
|
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):
|
def __build_action_group(self):
|
||||||
"""
|
"""
|
||||||
@@ -454,7 +561,8 @@ class PageView(DbGUIElement):
|
|||||||
Method called on shutdown. Data views should put code here
|
Method called on shutdown. Data views should put code here
|
||||||
that should be called when quiting the main application.
|
that should be called when quiting the main application.
|
||||||
"""
|
"""
|
||||||
pass
|
self.gramplet_pane.on_delete()
|
||||||
|
self._config.save()
|
||||||
|
|
||||||
def init_config(self):
|
def init_config(self):
|
||||||
"""
|
"""
|
||||||
@@ -512,3 +620,56 @@ class PageView(DbGUIElement):
|
|||||||
:return: list of functions
|
:return: list of functions
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
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)
|
||||||
|
@@ -227,8 +227,9 @@ class GrampletWindow(ManagedWindow.ManagedWindow):
|
|||||||
self.gramplet.gvproperties.hide()
|
self.gramplet.gvproperties.hide()
|
||||||
if self.gramplet.titlelabel_entry:
|
if self.gramplet.titlelabel_entry:
|
||||||
self.gramplet.titlelabel_entry.hide()
|
self.gramplet.titlelabel_entry.hide()
|
||||||
for widget in self.gramplet.pui.hidden_widgets():
|
if self.gramplet.pui:
|
||||||
widget.hide()
|
for widget in self.gramplet.pui.hidden_widgets():
|
||||||
|
widget.hide()
|
||||||
|
|
||||||
def handle_response(self, object, response):
|
def handle_response(self, object, response):
|
||||||
"""
|
"""
|
||||||
@@ -1288,8 +1289,8 @@ class GrampletPane(gtk.ScrolledWindow):
|
|||||||
def _button_press(self, obj, event):
|
def _button_press(self, obj, event):
|
||||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||||
self._popup_xy = (event.x, event.y)
|
self._popup_xy = (event.x, event.y)
|
||||||
menu = self.uistate.uimanager.get_widget('/Popup')
|
uiman = self.uistate.uimanager
|
||||||
ag_menu = self.uistate.uimanager.get_widget('/Popup/AddGramplet')
|
ag_menu = uiman.get_widget('/GrampletPopup/AddGramplet')
|
||||||
if ag_menu:
|
if ag_menu:
|
||||||
qr_menu = ag_menu.get_submenu()
|
qr_menu = ag_menu.get_submenu()
|
||||||
qr_menu = gtk.Menu()
|
qr_menu = gtk.Menu()
|
||||||
@@ -1297,10 +1298,9 @@ class GrampletPane(gtk.ScrolledWindow):
|
|||||||
in AVAILABLE_GRAMPLETS()]
|
in AVAILABLE_GRAMPLETS()]
|
||||||
names.sort()
|
names.sort()
|
||||||
for name in names:
|
for name in names:
|
||||||
add_menuitem(qr_menu, name,
|
add_menuitem(qr_menu, name, None, self.add_gramplet)
|
||||||
None, self.add_gramplet)
|
ag_menu.set_submenu(qr_menu)
|
||||||
self.uistate.uimanager.get_widget('/Popup/AddGramplet').set_submenu(qr_menu)
|
rg_menu = uiman.get_widget('/GrampletPopup/RestoreGramplet')
|
||||||
rg_menu = self.uistate.uimanager.get_widget('/Popup/RestoreGramplet')
|
|
||||||
if rg_menu:
|
if rg_menu:
|
||||||
qr_menu = rg_menu.get_submenu()
|
qr_menu = rg_menu.get_submenu()
|
||||||
if qr_menu is not None:
|
if qr_menu is not None:
|
||||||
@@ -1311,9 +1311,9 @@ class GrampletPane(gtk.ScrolledWindow):
|
|||||||
if len(names) > 0:
|
if len(names) > 0:
|
||||||
qr_menu = gtk.Menu()
|
qr_menu = gtk.Menu()
|
||||||
for name in names:
|
for name in names:
|
||||||
add_menuitem(qr_menu, name,
|
add_menuitem(qr_menu, name, None, self.restore_gramplet)
|
||||||
None, self.restore_gramplet)
|
rg_menu.set_submenu(qr_menu)
|
||||||
self.uistate.uimanager.get_widget('/Popup/RestoreGramplet').set_submenu(qr_menu)
|
menu = uiman.get_widget('/GrampletPopup')
|
||||||
if menu:
|
if menu:
|
||||||
menu.popup(None, None, None, 1, event.time)
|
menu.popup(None, None, None, 1, event.time)
|
||||||
return True
|
return True
|
||||||
|
@@ -1,340 +0,0 @@
|
|||||||
#
|
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
|
||||||
#
|
|
||||||
# Copyright (C) 2010 Nick Hall
|
|
||||||
# Copyright (C) 2010 Douglas S. Blank <doug.blank@gmail.com>
|
|
||||||
#
|
|
||||||
# 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 = '''<ui>
|
|
||||||
<menubar name="MenuBar">
|
|
||||||
<menu action="ViewMenu">
|
|
||||||
<placeholder name="Bars">
|
|
||||||
<menuitem action="Sidebar"/>
|
|
||||||
</placeholder>
|
|
||||||
</menu>
|
|
||||||
</menubar>
|
|
||||||
<popup name="Popup">
|
|
||||||
<menuitem action="AddGramplet"/>
|
|
||||||
<menuitem action="RestoreGramplet"/>
|
|
||||||
</popup>
|
|
||||||
</ui>'''
|
|
||||||
|
|
||||||
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)
|
|
@@ -114,7 +114,7 @@ class BasePersonView(ListView):
|
|||||||
FILTER_TYPE = "Person"
|
FILTER_TYPE = "Person"
|
||||||
QR_CATEGORY = CATEGORY_QR_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
|
Create the Person View
|
||||||
"""
|
"""
|
||||||
@@ -128,7 +128,7 @@ class BasePersonView(ListView):
|
|||||||
}
|
}
|
||||||
|
|
||||||
ListView.__init__(
|
ListView.__init__(
|
||||||
self, title, dbstate, uistate,
|
self, title, pdata, dbstate, uistate,
|
||||||
BasePersonView.COLUMN_NAMES, len(BasePersonView.COLUMN_NAMES),
|
BasePersonView.COLUMN_NAMES, len(BasePersonView.COLUMN_NAMES),
|
||||||
model, signal_map, dbstate.db.get_bookmarks(),
|
model, signal_map, dbstate.db.get_bookmarks(),
|
||||||
Bookmarks.PersonBookmarks, nav_group,
|
Bookmarks.PersonBookmarks, nav_group,
|
||||||
@@ -143,6 +143,8 @@ class BasePersonView(ListView):
|
|||||||
|
|
||||||
uistate.connect('nameformat-changed', self.build_tree)
|
uistate.connect('nameformat-changed', self.build_tree)
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def navigation_type(self):
|
def navigation_type(self):
|
||||||
"""
|
"""
|
||||||
Return the navigation type of the view.
|
Return the navigation type of the view.
|
||||||
@@ -174,7 +176,7 @@ class BasePersonView(ListView):
|
|||||||
"""
|
"""
|
||||||
return 'gramps-person'
|
return 'gramps-person'
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
"""
|
"""
|
||||||
Defines the UI string for UIManager
|
Defines the UI string for UIManager
|
||||||
"""
|
"""
|
||||||
|
@@ -120,7 +120,7 @@ class PlaceBaseView(ListView):
|
|||||||
FILTER_TYPE = "Place"
|
FILTER_TYPE = "Place"
|
||||||
QR_CATEGORY = CATEGORY_QR_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):
|
markup=None):
|
||||||
|
|
||||||
signal_map = {
|
signal_map = {
|
||||||
@@ -134,7 +134,7 @@ class PlaceBaseView(ListView):
|
|||||||
self.mapservicedata = {}
|
self.mapservicedata = {}
|
||||||
|
|
||||||
ListView.__init__(
|
ListView.__init__(
|
||||||
self, title, dbstate, uistate,
|
self, title, pdata, dbstate, uistate,
|
||||||
self.COLUMN_NAMES, 14,
|
self.COLUMN_NAMES, 14,
|
||||||
model, signal_map,
|
model, signal_map,
|
||||||
dbstate.db.get_place_bookmarks(),
|
dbstate.db.get_place_bookmarks(),
|
||||||
@@ -147,6 +147,8 @@ class PlaceBaseView(ListView):
|
|||||||
'<CONTROL>BackSpace' : self.key_delete,
|
'<CONTROL>BackSpace' : self.key_delete,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def navigation_type(self):
|
def navigation_type(self):
|
||||||
return 'Place'
|
return 'Place'
|
||||||
|
|
||||||
@@ -289,7 +291,7 @@ class PlaceBaseView(ListView):
|
|||||||
def get_stock(self):
|
def get_stock(self):
|
||||||
return 'gramps-place'
|
return 'gramps-place'
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
return '''<ui>
|
return '''<ui>
|
||||||
<menubar name="MenuBar">
|
<menubar name="MenuBar">
|
||||||
<menu action="FileMenu">
|
<menu action="FileMenu">
|
||||||
|
@@ -100,7 +100,7 @@ class EventView(ListView):
|
|||||||
FILTER_TYPE = "Event"
|
FILTER_TYPE = "Event"
|
||||||
QR_CATEGORY = CATEGORY_QR_EVENT
|
QR_CATEGORY = CATEGORY_QR_EVENT
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
"""
|
"""
|
||||||
Create the Event View
|
Create the Event View
|
||||||
"""
|
"""
|
||||||
@@ -112,7 +112,7 @@ class EventView(ListView):
|
|||||||
}
|
}
|
||||||
|
|
||||||
ListView.__init__(
|
ListView.__init__(
|
||||||
self, _('Events'), dbstate, uistate,
|
self, _('Events'), pdata, dbstate, uistate,
|
||||||
EventView.COLUMN_NAMES, len(EventView.COLUMN_NAMES),
|
EventView.COLUMN_NAMES, len(EventView.COLUMN_NAMES),
|
||||||
EventModel,
|
EventModel,
|
||||||
signal_map, dbstate.db.get_event_bookmarks(),
|
signal_map, dbstate.db.get_event_bookmarks(),
|
||||||
@@ -128,6 +128,8 @@ class EventView(ListView):
|
|||||||
|
|
||||||
uistate.connect('nameformat-changed', self.build_tree)
|
uistate.connect('nameformat-changed', self.build_tree)
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def navigation_type(self):
|
def navigation_type(self):
|
||||||
return 'Event'
|
return 'Event'
|
||||||
|
|
||||||
@@ -149,7 +151,7 @@ class EventView(ListView):
|
|||||||
"""
|
"""
|
||||||
return 'gramps-event'
|
return 'gramps-event'
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
"""
|
"""
|
||||||
Defines the UI string for UIManager
|
Defines the UI string for UIManager
|
||||||
"""
|
"""
|
||||||
|
@@ -98,7 +98,7 @@ class FamilyView(ListView):
|
|||||||
FILTER_TYPE = "Family"
|
FILTER_TYPE = "Family"
|
||||||
QR_CATEGORY = CATEGORY_QR_FAMILY
|
QR_CATEGORY = CATEGORY_QR_FAMILY
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
|
|
||||||
signal_map = {
|
signal_map = {
|
||||||
'family-add' : self.row_add,
|
'family-add' : self.row_add,
|
||||||
@@ -109,7 +109,7 @@ class FamilyView(ListView):
|
|||||||
}
|
}
|
||||||
|
|
||||||
ListView.__init__(
|
ListView.__init__(
|
||||||
self, _('Families'), dbstate, uistate,
|
self, _('Families'), pdata, dbstate, uistate,
|
||||||
FamilyView.COLUMN_NAMES, len(FamilyView.COLUMN_NAMES),
|
FamilyView.COLUMN_NAMES, len(FamilyView.COLUMN_NAMES),
|
||||||
FamilyModel,
|
FamilyModel,
|
||||||
signal_map, dbstate.db.get_family_bookmarks(),
|
signal_map, dbstate.db.get_family_bookmarks(),
|
||||||
@@ -125,13 +125,15 @@ class FamilyView(ListView):
|
|||||||
|
|
||||||
uistate.connect('nameformat-changed', self.build_tree)
|
uistate.connect('nameformat-changed', self.build_tree)
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def navigation_type(self):
|
def navigation_type(self):
|
||||||
return 'Family'
|
return 'Family'
|
||||||
|
|
||||||
def get_stock(self):
|
def get_stock(self):
|
||||||
return 'gramps-family'
|
return 'gramps-family'
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
return '''<ui>
|
return '''<ui>
|
||||||
<menubar name="MenuBar">
|
<menubar name="MenuBar">
|
||||||
<menu action="FileMenu">
|
<menu action="FileMenu">
|
||||||
|
@@ -566,9 +566,9 @@ class FanChartView(NavigationView):
|
|||||||
"""
|
"""
|
||||||
The Gramplet code that realizes the FanChartWidget.
|
The Gramplet code that realizes the FanChartWidget.
|
||||||
"""
|
"""
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
NavigationView.__init__(self, _('Fan Chart'),
|
NavigationView.__init__(self, _('Fan Chart'),
|
||||||
dbstate, uistate,
|
pdata, dbstate, uistate,
|
||||||
dbstate.db.get_bookmarks(),
|
dbstate.db.get_bookmarks(),
|
||||||
Bookmarks.PersonBookmarks,
|
Bookmarks.PersonBookmarks,
|
||||||
nav_group)
|
nav_group)
|
||||||
@@ -579,6 +579,8 @@ class FanChartView(NavigationView):
|
|||||||
self.generations = 9
|
self.generations = 9
|
||||||
self.format_helper = FormattingHelper(self.dbstate)
|
self.format_helper = FormattingHelper(self.dbstate)
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def navigation_type(self):
|
def navigation_type(self):
|
||||||
return 'Person'
|
return 'Person'
|
||||||
|
|
||||||
@@ -598,7 +600,7 @@ class FanChartView(NavigationView):
|
|||||||
"""
|
"""
|
||||||
return 'gramps-fanchart'
|
return 'gramps-fanchart'
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
return '''<ui>
|
return '''<ui>
|
||||||
<menubar name="MenuBar">
|
<menubar name="MenuBar">
|
||||||
<menu action="GoMenu">
|
<menu action="GoMenu">
|
||||||
|
@@ -78,7 +78,6 @@ from gui.views.pageview import PageView
|
|||||||
from gui.editors import EditPlace
|
from gui.editors import EditPlace
|
||||||
from gui.selectors.selectplace import SelectPlace
|
from gui.selectors.selectplace import SelectPlace
|
||||||
from Filters.SideBar import PlaceSidebarFilter, EventSidebarFilter
|
from Filters.SideBar import PlaceSidebarFilter, EventSidebarFilter
|
||||||
from gui.views.navigationview import NavigationView
|
|
||||||
import Bookmarks
|
import Bookmarks
|
||||||
from Utils import navigation_label
|
from Utils import navigation_label
|
||||||
|
|
||||||
@@ -143,42 +142,6 @@ MRU_BTM = [
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
_UI_DEF = '''\
|
|
||||||
<ui>
|
|
||||||
<menubar name="MenuBar">
|
|
||||||
<menu action="GoMenu">
|
|
||||||
<placeholder name="CommonGo">
|
|
||||||
<menuitem action="PersonMapsMenu"/>
|
|
||||||
<menuitem action="FamilyMapsMenu"/>
|
|
||||||
<menuitem action="EventMapsMenu"/>
|
|
||||||
<menuitem action="AllPlacesMapsMenu"/>
|
|
||||||
</placeholder>
|
|
||||||
</menu>
|
|
||||||
<menu action="EditMenu">
|
|
||||||
<separator/>
|
|
||||||
<menuitem action="AddPlaceMenu"/>
|
|
||||||
<menuitem action="LinkPlaceMenu"/>
|
|
||||||
</menu>
|
|
||||||
</menubar>
|
|
||||||
<toolbar name="ToolBar">
|
|
||||||
<placeholder name="CommonEdit">
|
|
||||||
<toolitem action="AddPlace"/>
|
|
||||||
<toolitem action="LinkPlace"/>
|
|
||||||
<separator/>
|
|
||||||
<toolitem action="PersonMaps"/>
|
|
||||||
<toolitem action="FamilyMaps"/>
|
|
||||||
<toolitem action="EventMaps"/>
|
|
||||||
<toolitem action="AllPlacesMaps"/>
|
|
||||||
</placeholder>
|
|
||||||
<placeholder name="CommonNavigation">
|
|
||||||
<toolitem action="Back"/>
|
|
||||||
<toolitem action="Forward"/>
|
|
||||||
<toolitem action="HomePerson"/>
|
|
||||||
</placeholder>
|
|
||||||
</toolbar>
|
|
||||||
</ui>
|
|
||||||
'''
|
|
||||||
|
|
||||||
_HTMLHEADER = '''\
|
_HTMLHEADER = '''\
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
@@ -343,9 +306,8 @@ class GeoView(HtmlView):
|
|||||||
('preferences.webkit', True),
|
('preferences.webkit', True),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace):
|
def __init__(self, pdata, dbstate, uistate):
|
||||||
HtmlView.__init__(self, dbstate, uistate, wspace, title=_("GeoView"))
|
HtmlView.__init__(self, pdata, dbstate, uistate, title=_("GeoView"))
|
||||||
self.wspace = wspace
|
|
||||||
self.dbstate = dbstate
|
self.dbstate = dbstate
|
||||||
self.uistate = uistate
|
self.uistate = uistate
|
||||||
self.dbstate.connect('database-changed', self._new_database)
|
self.dbstate.connect('database-changed', self._new_database)
|
||||||
@@ -366,6 +328,8 @@ class GeoView(HtmlView):
|
|||||||
self.bookmarks = Bookmarks.PersonBookmarks(self.dbstate, self.uistate,
|
self.bookmarks = Bookmarks.PersonBookmarks(self.dbstate, self.uistate,
|
||||||
dbstate.db.get_bookmarks(), self.goto_handle)
|
dbstate.db.get_bookmarks(), self.goto_handle)
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def build_widget(self):
|
def build_widget(self):
|
||||||
self.no_network = False
|
self.no_network = False
|
||||||
self.placeslist = []
|
self.placeslist = []
|
||||||
@@ -909,7 +873,7 @@ class GeoView(HtmlView):
|
|||||||
config.set('geoview.latitude', "0.0")
|
config.set('geoview.latitude', "0.0")
|
||||||
config.set('geoview.longitude', "0.0")
|
config.set('geoview.longitude', "0.0")
|
||||||
config.set('geoview.map', "person")
|
config.set('geoview.map', "person")
|
||||||
self._config.save()
|
PageView.on_delete(self)
|
||||||
|
|
||||||
def init_parent_signals_for_map(self, widget, event):
|
def init_parent_signals_for_map(self, widget, event):
|
||||||
"""
|
"""
|
||||||
@@ -1124,19 +1088,51 @@ class GeoView(HtmlView):
|
|||||||
self.renderer.execute_script(
|
self.renderer.execute_script(
|
||||||
"javascript:selectmarkers('%s')" % year )
|
"javascript:selectmarkers('%s')" % year )
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
"""
|
"""
|
||||||
Specifies the UIManager XML code that defines the menus and buttons
|
Specifies the UIManager XML code that defines the menus and buttons
|
||||||
associated with the interface.
|
associated with the interface.
|
||||||
"""
|
"""
|
||||||
return _UI_DEF
|
return '''<ui>
|
||||||
|
<menubar name="MenuBar">
|
||||||
|
<menu action="GoMenu">
|
||||||
|
<placeholder name="CommonGo">
|
||||||
|
<menuitem action="PersonMapsMenu"/>
|
||||||
|
<menuitem action="FamilyMapsMenu"/>
|
||||||
|
<menuitem action="EventMapsMenu"/>
|
||||||
|
<menuitem action="AllPlacesMapsMenu"/>
|
||||||
|
</placeholder>
|
||||||
|
</menu>
|
||||||
|
<menu action="EditMenu">
|
||||||
|
<separator/>
|
||||||
|
<menuitem action="AddPlaceMenu"/>
|
||||||
|
<menuitem action="LinkPlaceMenu"/>
|
||||||
|
</menu>
|
||||||
|
</menubar>
|
||||||
|
<toolbar name="ToolBar">
|
||||||
|
<placeholder name="CommonEdit">
|
||||||
|
<toolitem action="AddPlace"/>
|
||||||
|
<toolitem action="LinkPlace"/>
|
||||||
|
<separator/>
|
||||||
|
<toolitem action="PersonMaps"/>
|
||||||
|
<toolitem action="FamilyMaps"/>
|
||||||
|
<toolitem action="EventMaps"/>
|
||||||
|
<toolitem action="AllPlacesMaps"/>
|
||||||
|
</placeholder>
|
||||||
|
<placeholder name="CommonNavigation">
|
||||||
|
<toolitem action="Back"/>
|
||||||
|
<toolitem action="Forward"/>
|
||||||
|
<toolitem action="HomePerson"/>
|
||||||
|
</placeholder>
|
||||||
|
</toolbar>
|
||||||
|
</ui>'''
|
||||||
|
|
||||||
def define_actions(self):
|
def define_actions(self):
|
||||||
"""
|
"""
|
||||||
Required define_actions function for PageView. Builds the action
|
Required define_actions function for PageView. Builds the action
|
||||||
group information required.
|
group information required.
|
||||||
"""
|
"""
|
||||||
#NavigationView.define_actions(self)
|
PageView.define_actions(self)
|
||||||
#self.bookmark_actions()
|
#self.bookmark_actions()
|
||||||
self.book_action = gtk.ActionGroup(self.title + '/Bookmark')
|
self.book_action = gtk.ActionGroup(self.title + '/Bookmark')
|
||||||
self.book_action.add_actions([
|
self.book_action.add_actions([
|
||||||
@@ -1488,8 +1484,8 @@ class GeoView(HtmlView):
|
|||||||
Specifies the place for the home person to display with mapstraction.
|
Specifies the place for the home person to display with mapstraction.
|
||||||
"""
|
"""
|
||||||
self.displaytype = "places"
|
self.displaytype = "places"
|
||||||
self.wspace.remove_filter()
|
self.remove_filter()
|
||||||
self.wspace.add_filter(PlaceSidebarFilter)
|
self.add_filter(PlaceSidebarFilter)
|
||||||
self._geo_places()
|
self._geo_places()
|
||||||
|
|
||||||
def _person_places(self, handle=None): # pylint: disable-msg=W0613
|
def _person_places(self, handle=None): # pylint: disable-msg=W0613
|
||||||
@@ -1497,7 +1493,7 @@ class GeoView(HtmlView):
|
|||||||
Specifies the person places.
|
Specifies the person places.
|
||||||
"""
|
"""
|
||||||
self.displaytype = "person"
|
self.displaytype = "person"
|
||||||
self.wspace.remove_filter()
|
self.remove_filter()
|
||||||
if not self.uistate.get_active('Person'):
|
if not self.uistate.get_active('Person'):
|
||||||
return
|
return
|
||||||
self._geo_places()
|
self._geo_places()
|
||||||
@@ -1507,7 +1503,7 @@ class GeoView(HtmlView):
|
|||||||
Specifies the family places to display with mapstraction.
|
Specifies the family places to display with mapstraction.
|
||||||
"""
|
"""
|
||||||
self.displaytype = "family"
|
self.displaytype = "family"
|
||||||
self.wspace.remove_filter()
|
self.remove_filter()
|
||||||
if not self.uistate.get_active('Person'):
|
if not self.uistate.get_active('Person'):
|
||||||
return
|
return
|
||||||
self._geo_places()
|
self._geo_places()
|
||||||
@@ -1517,8 +1513,8 @@ class GeoView(HtmlView):
|
|||||||
Specifies all event places to display with mapstraction.
|
Specifies all event places to display with mapstraction.
|
||||||
"""
|
"""
|
||||||
self.displaytype = "event"
|
self.displaytype = "event"
|
||||||
self.wspace.remove_filter()
|
self.remove_filter()
|
||||||
self.wspace.add_filter(EventSidebarFilter)
|
self.add_filter(EventSidebarFilter)
|
||||||
self._geo_places()
|
self._geo_places()
|
||||||
|
|
||||||
def _new_database(self, database):
|
def _new_database(self, database):
|
||||||
|
@@ -45,11 +45,26 @@ class GrampletView(PageView):
|
|||||||
GrampletView interface
|
GrampletView interface
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace):
|
def __init__(self, pdata, dbstate, uistate):
|
||||||
"""
|
"""
|
||||||
Create a GrampletView, with the current dbstate and uistate
|
Create a GrampletView, with the current dbstate and uistate
|
||||||
"""
|
"""
|
||||||
PageView.__init__(self, _('Gramplets'), dbstate, uistate)
|
PageView.__init__(self, _('Gramplets'), pdata, dbstate, uistate)
|
||||||
|
self.ui_def = '''<ui>
|
||||||
|
<popup name="GrampletPopup">
|
||||||
|
<menuitem action="AddGramplet"/>
|
||||||
|
<menuitem action="RestoreGramplet"/>
|
||||||
|
</popup>
|
||||||
|
</ui>'''
|
||||||
|
|
||||||
|
def build_interface(self):
|
||||||
|
"""
|
||||||
|
Builds the container widget for the interface.
|
||||||
|
Returns a gtk container widget.
|
||||||
|
"""
|
||||||
|
top = self.build_widget()
|
||||||
|
top.show_all()
|
||||||
|
return top
|
||||||
|
|
||||||
def build_widget(self):
|
def build_widget(self):
|
||||||
"""
|
"""
|
||||||
@@ -57,20 +72,9 @@ class GrampletView(PageView):
|
|||||||
the base class. Returns a gtk container widget.
|
the base class. Returns a gtk container widget.
|
||||||
"""
|
"""
|
||||||
# load the user's gramplets and set columns, etc
|
# load the user's gramplets and set columns, etc
|
||||||
return GrampletPane("Gramplets_grampletview_gramplets", self,
|
self.widget = GrampletPane("Gramplets_grampletview_gramplets", self,
|
||||||
self.dbstate, self.uistate)
|
self.dbstate, self.uistate)
|
||||||
|
return self.widget
|
||||||
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")),
|
|
||||||
])
|
|
||||||
self._add_action_group(self.action)
|
|
||||||
|
|
||||||
def get_stock(self):
|
def get_stock(self):
|
||||||
"""
|
"""
|
||||||
@@ -92,16 +96,6 @@ class GrampletView(PageView):
|
|||||||
self.active = True
|
self.active = True
|
||||||
self.widget.set_active()
|
self.widget.set_active()
|
||||||
|
|
||||||
def ui_definition(self):
|
|
||||||
return """
|
|
||||||
<ui>
|
|
||||||
<popup name="Popup">
|
|
||||||
<menuitem action="AddGramplet"/>
|
|
||||||
<menuitem action="RestoreGramplet"/>
|
|
||||||
</popup>
|
|
||||||
</ui>
|
|
||||||
"""
|
|
||||||
|
|
||||||
def on_delete(self):
|
def on_delete(self):
|
||||||
self.widget.on_delete()
|
self.widget.on_delete()
|
||||||
self._config.save()
|
self._config.save()
|
||||||
|
@@ -441,8 +441,8 @@ class HtmlView(PageView):
|
|||||||
with an embedded webbrowser showing a given URL
|
with an embedded webbrowser showing a given URL
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace, title=_('HtmlView')):
|
def __init__(self, pdata, dbstate, uistate, title=_('HtmlView')):
|
||||||
PageView.__init__(self, title, dbstate, uistate)
|
PageView.__init__(self, title, pdata, dbstate, uistate)
|
||||||
self.dbstate = dbstate
|
self.dbstate = dbstate
|
||||||
self.back_action = None
|
self.back_action = None
|
||||||
self.forward_action = None
|
self.forward_action = None
|
||||||
@@ -456,6 +456,8 @@ class HtmlView(PageView):
|
|||||||
self.box = None
|
self.box = None
|
||||||
self.toolkit = None
|
self.toolkit = None
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def build_widget(self):
|
def build_widget(self):
|
||||||
"""
|
"""
|
||||||
Builds the interface and returns a gtk.Container type that
|
Builds the interface and returns a gtk.Container type that
|
||||||
@@ -602,7 +604,7 @@ class HtmlView(PageView):
|
|||||||
"""
|
"""
|
||||||
return 'gramps-view'
|
return 'gramps-view'
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
"""
|
"""
|
||||||
Specifies the UIManager XML code that defines the menus and buttons
|
Specifies the UIManager XML code that defines the menus and buttons
|
||||||
associated with the interface.
|
associated with the interface.
|
||||||
@@ -622,6 +624,7 @@ class HtmlView(PageView):
|
|||||||
Required define_actions function for PageView. Builds the action
|
Required define_actions function for PageView. Builds the action
|
||||||
group information required.
|
group information required.
|
||||||
"""
|
"""
|
||||||
|
PageView.define_actions(self)
|
||||||
HtmlView._define_actions_fw_bw(self)
|
HtmlView._define_actions_fw_bw(self)
|
||||||
|
|
||||||
def _define_actions_fw_bw(self):
|
def _define_actions_fw_bw(self):
|
||||||
|
@@ -113,7 +113,7 @@ class MediaView(ListView):
|
|||||||
|
|
||||||
_DND_TYPE = DdTargets.URI_LIST
|
_DND_TYPE = DdTargets.URI_LIST
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
|
|
||||||
signal_map = {
|
signal_map = {
|
||||||
'media-add' : self.row_add,
|
'media-add' : self.row_add,
|
||||||
@@ -124,7 +124,7 @@ class MediaView(ListView):
|
|||||||
}
|
}
|
||||||
|
|
||||||
ListView.__init__(
|
ListView.__init__(
|
||||||
self, _('Media'), dbstate, uistate,
|
self, _('Media'), pdata, dbstate, uistate,
|
||||||
MediaView.COLUMN_NAMES, len(MediaView.COLUMN_NAMES),
|
MediaView.COLUMN_NAMES, len(MediaView.COLUMN_NAMES),
|
||||||
MediaModel,
|
MediaModel,
|
||||||
signal_map, dbstate.db.get_media_bookmarks(),
|
signal_map, dbstate.db.get_media_bookmarks(),
|
||||||
@@ -137,6 +137,8 @@ class MediaView(ListView):
|
|||||||
'<CONTROL>BackSpace' : self.key_delete,
|
'<CONTROL>BackSpace' : self.key_delete,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def navigation_type(self):
|
def navigation_type(self):
|
||||||
return 'Media'
|
return 'Media'
|
||||||
|
|
||||||
@@ -335,7 +337,7 @@ class MediaView(ListView):
|
|||||||
Utils.media_path_full(self.dbstate.db, obj.get_path()))
|
Utils.media_path_full(self.dbstate.db, obj.get_path()))
|
||||||
self.image.set_from_pixbuf(pix)
|
self.image.set_from_pixbuf(pix)
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
"""
|
"""
|
||||||
Return the UIManager XML description of the menus
|
Return the UIManager XML description of the menus
|
||||||
"""
|
"""
|
||||||
|
@@ -92,7 +92,7 @@ class NoteView(ListView):
|
|||||||
FILTER_TYPE = "Note"
|
FILTER_TYPE = "Note"
|
||||||
QR_CATEGORY = CATEGORY_QR_NOTE
|
QR_CATEGORY = CATEGORY_QR_NOTE
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
|
|
||||||
signal_map = {
|
signal_map = {
|
||||||
'note-add' : self.row_add,
|
'note-add' : self.row_add,
|
||||||
@@ -103,7 +103,7 @@ class NoteView(ListView):
|
|||||||
}
|
}
|
||||||
|
|
||||||
ListView.__init__(
|
ListView.__init__(
|
||||||
self, _('Notes'), dbstate, uistate, NoteView.COLUMN_NAMES,
|
self, _('Notes'), pdata, dbstate, uistate, NoteView.COLUMN_NAMES,
|
||||||
len(NoteView.COLUMN_NAMES), NoteModel, signal_map,
|
len(NoteView.COLUMN_NAMES), NoteModel, signal_map,
|
||||||
dbstate.db.get_note_bookmarks(),
|
dbstate.db.get_note_bookmarks(),
|
||||||
Bookmarks.NoteBookmarks, nav_group,
|
Bookmarks.NoteBookmarks, nav_group,
|
||||||
@@ -115,6 +115,8 @@ class NoteView(ListView):
|
|||||||
'<CONTROL>BackSpace' : self.key_delete,
|
'<CONTROL>BackSpace' : self.key_delete,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def navigation_type(self):
|
def navigation_type(self):
|
||||||
return 'Note'
|
return 'Note'
|
||||||
|
|
||||||
@@ -136,7 +138,7 @@ class NoteView(ListView):
|
|||||||
"""
|
"""
|
||||||
return 'gramps-notes'
|
return 'gramps-notes'
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
"""
|
"""
|
||||||
Defines the UI string for UIManager
|
Defines the UI string for UIManager
|
||||||
"""
|
"""
|
||||||
|
@@ -671,8 +671,8 @@ class PedigreeView(NavigationView):
|
|||||||
('interface.pedview-show-unknown-people', True),
|
('interface.pedview-show-unknown-people', True),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
NavigationView.__init__(self, _('Pedigree'), dbstate, uistate,
|
NavigationView.__init__(self, _('Pedigree'), pdata, dbstate, uistate,
|
||||||
dbstate.db.get_bookmarks(),
|
dbstate.db.get_bookmarks(),
|
||||||
Bookmarks.PersonBookmarks,
|
Bookmarks.PersonBookmarks,
|
||||||
nav_group)
|
nav_group)
|
||||||
@@ -699,6 +699,24 @@ class PedigreeView(NavigationView):
|
|||||||
self.scrolledwindow = None
|
self.scrolledwindow = None
|
||||||
self.table = None
|
self.table = None
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
|
# Automatic resize
|
||||||
|
self.force_size = self._config.get('interface.pedview-tree-size')
|
||||||
|
# Nice tree
|
||||||
|
self.tree_style = self._config.get('interface.pedview-layout')
|
||||||
|
# Show photos of persons
|
||||||
|
self.show_images = self._config.get('interface.pedview-show-images')
|
||||||
|
# Hide marriage data by default
|
||||||
|
self.show_marriage_data = self._config.get(
|
||||||
|
'interface.pedview-show-marriage')
|
||||||
|
# Tree draw direction
|
||||||
|
self.tree_direction = self._config.get('interface.pedview-tree-direction')
|
||||||
|
# Show on not unknown people.
|
||||||
|
# Default - not show, for mo fast display hight tree
|
||||||
|
self.show_unknown_people = self._config.get(
|
||||||
|
'interface.pedview-show-unknown-people')
|
||||||
|
|
||||||
def change_page(self):
|
def change_page(self):
|
||||||
"""Called when the page changes."""
|
"""Called when the page changes."""
|
||||||
NavigationView.change_page(self)
|
NavigationView.change_page(self)
|
||||||
@@ -749,7 +767,7 @@ class PedigreeView(NavigationView):
|
|||||||
|
|
||||||
return self.scrolledwindow
|
return self.scrolledwindow
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
"""
|
"""
|
||||||
Specifies the UIManager XML code that defines the menus and buttons
|
Specifies the UIManager XML code that defines the menus and buttons
|
||||||
associated with the interface.
|
associated with the interface.
|
||||||
@@ -866,29 +884,6 @@ class PedigreeView(NavigationView):
|
|||||||
self._config.save()
|
self._config.save()
|
||||||
NavigationView.on_delete(self)
|
NavigationView.on_delete(self)
|
||||||
|
|
||||||
def set_ident(self, ident):
|
|
||||||
"""
|
|
||||||
Set the id of the view. This is an unique ident
|
|
||||||
We use this to create immediately the config file with this ident.
|
|
||||||
"""
|
|
||||||
NavigationView.set_ident(self, ident)
|
|
||||||
|
|
||||||
# Automatic resize
|
|
||||||
self.force_size = self._config.get('interface.pedview-tree-size')
|
|
||||||
# Nice tree
|
|
||||||
self.tree_style = self._config.get('interface.pedview-layout')
|
|
||||||
# Show photos of persons
|
|
||||||
self.show_images = self._config.get('interface.pedview-show-images')
|
|
||||||
# Hide marriage data by default
|
|
||||||
self.show_marriage_data = self._config.get(
|
|
||||||
'interface.pedview-show-marriage')
|
|
||||||
# Tree draw direction
|
|
||||||
self.tree_direction = self._config.get('interface.pedview-tree-direction')
|
|
||||||
# Show on not unknown people.
|
|
||||||
# Default - not show, for mo fast display hight tree
|
|
||||||
self.show_unknown_people = self._config.get(
|
|
||||||
'interface.pedview-show-unknown-people')
|
|
||||||
|
|
||||||
def goto_handle(self, handle=None):
|
def goto_handle(self, handle=None):
|
||||||
"""
|
"""
|
||||||
Rebuild the tree with the given person handle as the root.
|
Rebuild the tree with the given person handle as the root.
|
||||||
|
@@ -53,7 +53,7 @@ class PersonListView(BasePersonView):
|
|||||||
"""
|
"""
|
||||||
A hierarchical view of the top three levels of places.
|
A hierarchical view of the top three levels of places.
|
||||||
"""
|
"""
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
BasePersonView.__init__(self, dbstate, uistate,
|
BasePersonView.__init__(self, pdata, dbstate, uistate,
|
||||||
_('Person View'), PersonListModel,
|
_('Person View'), PersonListModel,
|
||||||
nav_group=nav_group)
|
nav_group=nav_group)
|
||||||
|
@@ -55,8 +55,8 @@ class PersonTreeView(BasePersonView):
|
|||||||
"""
|
"""
|
||||||
A hierarchical view of the top three levels of places.
|
A hierarchical view of the top three levels of places.
|
||||||
"""
|
"""
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
BasePersonView.__init__(self, dbstate, uistate,
|
BasePersonView.__init__(self, pdata, dbstate, uistate,
|
||||||
_('People Tree View'), PersonTreeModel,
|
_('People Tree View'), PersonTreeModel,
|
||||||
nav_group=nav_group)
|
nav_group=nav_group)
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ class PersonTreeView(BasePersonView):
|
|||||||
self.close_all_nodes),
|
self.close_all_nodes),
|
||||||
])
|
])
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
"""
|
"""
|
||||||
Defines the UI string for UIManager
|
Defines the UI string for UIManager
|
||||||
"""
|
"""
|
||||||
|
@@ -47,7 +47,7 @@ class PlaceListView(PlaceBaseView):
|
|||||||
"""
|
"""
|
||||||
Flat place view. (Original code in PlaceBaseView).
|
Flat place view. (Original code in PlaceBaseView).
|
||||||
"""
|
"""
|
||||||
def __init__(self, dbstate, uistate, wspace):
|
def __init__(self, pdata, dbstate, uistate):
|
||||||
PlaceBaseView.__init__(self, dbstate, uistate,
|
PlaceBaseView.__init__(self, pdata, dbstate, uistate,
|
||||||
_('Place View'), PlaceListModel,
|
_('Place View'), PlaceListModel,
|
||||||
nav_group=0)
|
nav_group=0)
|
||||||
|
@@ -93,8 +93,8 @@ class PlaceTreeView(PlaceBaseView):
|
|||||||
100, 150, 150, 100, 150])
|
100, 150, 150, 100, 150])
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace):
|
def __init__(self, pdata, dbstate, uistate):
|
||||||
PlaceBaseView.__init__(self, dbstate, uistate,
|
PlaceBaseView.__init__(self, pdata, dbstate, uistate,
|
||||||
_('Place Tree View'), PlaceTreeModel,
|
_('Place Tree View'), PlaceTreeModel,
|
||||||
nav_group=0, markup=PlaceBaseView.MARKUP_COLS)
|
nav_group=0, markup=PlaceBaseView.MARKUP_COLS)
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ class PlaceTreeView(PlaceBaseView):
|
|||||||
self._add_action('CloseAllNodes', None, _("Collapse all Nodes"),
|
self._add_action('CloseAllNodes', None, _("Collapse all Nodes"),
|
||||||
callback=self.close_all_nodes)
|
callback=self.close_all_nodes)
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
"""
|
"""
|
||||||
A user interface definition including tree specific actions.
|
A user interface definition including tree specific actions.
|
||||||
"""
|
"""
|
||||||
|
@@ -130,9 +130,9 @@ class RelationshipView(NavigationView):
|
|||||||
('preferences.releditbtn', True),
|
('preferences.releditbtn', True),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
NavigationView.__init__(self, _('Relationships'),
|
NavigationView.__init__(self, _('Relationships'),
|
||||||
dbstate, uistate,
|
pdata, dbstate, uistate,
|
||||||
dbstate.db.get_bookmarks(),
|
dbstate.db.get_bookmarks(),
|
||||||
Bookmarks.PersonBookmarks,
|
Bookmarks.PersonBookmarks,
|
||||||
nav_group)
|
nav_group)
|
||||||
@@ -152,6 +152,14 @@ class RelationshipView(NavigationView):
|
|||||||
self.reorder_sensitive = False
|
self.reorder_sensitive = False
|
||||||
self.collapsed_items = {}
|
self.collapsed_items = {}
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
|
self.show_siblings = self._config.get('preferences.family-siblings')
|
||||||
|
self.show_details = self._config.get('preferences.family-details')
|
||||||
|
self.use_shade = self._config.get('preferences.relation-shade')
|
||||||
|
self.theme = self._config.get('preferences.relation-display-theme')
|
||||||
|
self.toolbar_visible = config.get('interface.toolbar-on')
|
||||||
|
|
||||||
def _connect_db_signals(self):
|
def _connect_db_signals(self):
|
||||||
"""
|
"""
|
||||||
implement from base class DbGUIElement
|
implement from base class DbGUIElement
|
||||||
@@ -179,22 +187,6 @@ class RelationshipView(NavigationView):
|
|||||||
"""
|
"""
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_delete(self):
|
|
||||||
self._config.save()
|
|
||||||
NavigationView.on_delete(self)
|
|
||||||
|
|
||||||
def set_ident(self, ident):
|
|
||||||
"""
|
|
||||||
Set the id of the view. This is an unique ident
|
|
||||||
We use this to create immediately the config file with this ident.
|
|
||||||
"""
|
|
||||||
NavigationView.set_ident(self, ident)
|
|
||||||
self.show_siblings = self._config.get('preferences.family-siblings')
|
|
||||||
self.show_details = self._config.get('preferences.family-details')
|
|
||||||
self.use_shade = self._config.get('preferences.relation-shade')
|
|
||||||
self.theme = self._config.get('preferences.relation-display-theme')
|
|
||||||
self.toolbar_visible = config.get('interface.toolbar-on')
|
|
||||||
|
|
||||||
def goto_handle(self, handle):
|
def goto_handle(self, handle):
|
||||||
self.change_person(handle)
|
self.change_person(handle)
|
||||||
|
|
||||||
@@ -331,7 +323,7 @@ class RelationshipView(NavigationView):
|
|||||||
container.show_all()
|
container.show_all()
|
||||||
return container
|
return container
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
"""
|
"""
|
||||||
Specifies the UIManager XML code that defines the menus and buttons
|
Specifies the UIManager XML code that defines the menus and buttons
|
||||||
associated with the interface.
|
associated with the interface.
|
||||||
|
@@ -109,7 +109,7 @@ class RepositoryView(ListView):
|
|||||||
FILTER_TYPE = "Repository"
|
FILTER_TYPE = "Repository"
|
||||||
QR_CATEGORY = CATEGORY_QR_REPOSITORY
|
QR_CATEGORY = CATEGORY_QR_REPOSITORY
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
|
|
||||||
signal_map = {
|
signal_map = {
|
||||||
'repository-add' : self.row_add,
|
'repository-add' : self.row_add,
|
||||||
@@ -119,7 +119,7 @@ class RepositoryView(ListView):
|
|||||||
}
|
}
|
||||||
|
|
||||||
ListView.__init__(
|
ListView.__init__(
|
||||||
self, _('Repositories'), dbstate, uistate,
|
self, _('Repositories'), pdata, dbstate, uistate,
|
||||||
RepositoryView.COLUMN_NAMES, len(RepositoryView.COLUMN_NAMES),
|
RepositoryView.COLUMN_NAMES, len(RepositoryView.COLUMN_NAMES),
|
||||||
RepositoryModel, signal_map,
|
RepositoryModel, signal_map,
|
||||||
dbstate.db.get_repo_bookmarks(),
|
dbstate.db.get_repo_bookmarks(),
|
||||||
@@ -132,6 +132,8 @@ class RepositoryView(ListView):
|
|||||||
'<CONTROL>BackSpace' : self.key_delete,
|
'<CONTROL>BackSpace' : self.key_delete,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def navigation_type(self):
|
def navigation_type(self):
|
||||||
return 'Repository'
|
return 'Repository'
|
||||||
|
|
||||||
@@ -153,7 +155,7 @@ class RepositoryView(ListView):
|
|||||||
def get_stock(self):
|
def get_stock(self):
|
||||||
return 'gramps-repository'
|
return 'gramps-repository'
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
return '''<ui>
|
return '''<ui>
|
||||||
<menubar name="MenuBar">
|
<menubar name="MenuBar">
|
||||||
<menu action="FileMenu">
|
<menu action="FileMenu">
|
||||||
|
@@ -93,7 +93,7 @@ class SourceView(ListView):
|
|||||||
FILTER_TYPE = "Source"
|
FILTER_TYPE = "Source"
|
||||||
QR_CATEGORY = CATEGORY_QR_SOURCE
|
QR_CATEGORY = CATEGORY_QR_SOURCE
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, wspace, nav_group=0):
|
def __init__(self, pdata, dbstate, uistate, nav_group=0):
|
||||||
|
|
||||||
signal_map = {
|
signal_map = {
|
||||||
'source-add' : self.row_add,
|
'source-add' : self.row_add,
|
||||||
@@ -103,7 +103,7 @@ class SourceView(ListView):
|
|||||||
}
|
}
|
||||||
|
|
||||||
ListView.__init__(
|
ListView.__init__(
|
||||||
self, _('Sources'), dbstate, uistate,
|
self, _('Sources'), pdata, dbstate, uistate,
|
||||||
SourceView.COLUMN_NAMES, len(SourceView.COLUMN_NAMES),
|
SourceView.COLUMN_NAMES, len(SourceView.COLUMN_NAMES),
|
||||||
SourceModel, signal_map,
|
SourceModel, signal_map,
|
||||||
dbstate.db.get_source_bookmarks(),
|
dbstate.db.get_source_bookmarks(),
|
||||||
@@ -116,6 +116,8 @@ class SourceView(ListView):
|
|||||||
'<CONTROL>BackSpace' : self.key_delete,
|
'<CONTROL>BackSpace' : self.key_delete,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.additional_uis.append(self.additional_ui())
|
||||||
|
|
||||||
def navigation_type(self):
|
def navigation_type(self):
|
||||||
return 'Source'
|
return 'Source'
|
||||||
|
|
||||||
@@ -135,7 +137,7 @@ class SourceView(ListView):
|
|||||||
def get_stock(self):
|
def get_stock(self):
|
||||||
return 'gramps-source'
|
return 'gramps-source'
|
||||||
|
|
||||||
def ui_definition(self):
|
def additional_ui(self):
|
||||||
return '''<ui>
|
return '''<ui>
|
||||||
<menubar name="MenuBar">
|
<menubar name="MenuBar">
|
||||||
<menu action="FileMenu">
|
<menu action="FileMenu">
|
||||||
|
Reference in New Issue
Block a user