2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2007-06-28 11:11:40 +05:30
|
|
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
2003-12-02 08:05:49 +05:30
|
|
|
# $Id$
|
|
|
|
|
2008-03-05 03:58:59 +05:30
|
|
|
"Handle bookmarks for the gramps interface."
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Standard python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2008-03-20 00:47:20 +05:30
|
|
|
|
2005-12-25 09:31:47 +05:30
|
|
|
from cStringIO import StringIO
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2006-03-05 10:15:44 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# set up logging
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import logging
|
|
|
|
log = logging.getLogger(".Bookmarks")
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2003-12-02 08:05:49 +05:30
|
|
|
import gtk
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-12-06 12:08:09 +05:30
|
|
|
import GrampsDisplay
|
2005-08-18 11:28:28 +05:30
|
|
|
import ListModel
|
2006-04-27 03:18:13 +05:30
|
|
|
import Utils
|
2009-02-26 15:27:08 +05:30
|
|
|
import const
|
2010-01-18 10:12:17 +05:30
|
|
|
from gen.ggettext import sgettext as _
|
2008-03-20 00:47:20 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Constants
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2009-02-26 15:27:08 +05:30
|
|
|
WIKI_HELP_PAGE = '%s_-_Navigation' % const.URL_MANUAL_PAGE
|
2008-03-20 00:47:20 +05:30
|
|
|
WIKI_HELP_SEC = _('manual|Bookmarks')
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Bookmarks
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-12-25 09:31:47 +05:30
|
|
|
|
2007-06-27 10:20:33 +05:30
|
|
|
TOP = '''<ui><menubar name="MenuBar"><menu action="BookMenu">'''
|
|
|
|
BTM = '''</menu></menubar></ui>'''
|
2005-12-25 09:31:47 +05:30
|
|
|
|
|
|
|
DISABLED = -1
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
class Bookmarks :
|
2008-03-05 03:58:59 +05:30
|
|
|
"Handle the bookmarks interface for Gramps."
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-04-27 04:13:59 +05:30
|
|
|
def __init__(self, dbstate, uistate, bookmarks, callback=None):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
2008-03-05 03:58:59 +05:30
|
|
|
Create the bookmark editor.
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
bookmarks - list of People
|
|
|
|
menu - parent menu to attach users
|
|
|
|
callback - task to connect to the menu item as a callback
|
|
|
|
"""
|
2005-12-25 09:31:47 +05:30
|
|
|
self.dbstate = dbstate
|
2006-04-26 00:54:40 +05:30
|
|
|
self.uistate = uistate
|
2002-10-20 19:55:16 +05:30
|
|
|
self.bookmarks = bookmarks
|
2005-12-25 09:31:47 +05:30
|
|
|
self.active = DISABLED
|
|
|
|
self.action_group = gtk.ActionGroup('Bookmarks')
|
2006-10-09 09:27:41 +05:30
|
|
|
self.connect_signals()
|
|
|
|
self.dbstate.connect('database-changed', self.db_changed)
|
|
|
|
|
|
|
|
def db_changed(self, data):
|
2007-05-20 10:05:46 +05:30
|
|
|
"""
|
|
|
|
Reconnect the signals on a database changed.
|
|
|
|
"""
|
2006-10-09 09:27:41 +05:30
|
|
|
self.connect_signals()
|
|
|
|
|
|
|
|
def connect_signals(self):
|
2007-05-20 10:05:46 +05:30
|
|
|
"""
|
|
|
|
Connect the person-delete signal
|
|
|
|
"""
|
2010-01-11 00:49:33 +05:30
|
|
|
raise NotImplementedError
|
2006-04-27 03:18:13 +05:30
|
|
|
|
|
|
|
def update_bookmarks(self, bookmarks):
|
2007-05-20 10:05:46 +05:30
|
|
|
"""
|
|
|
|
Assign bookmarks
|
|
|
|
"""
|
2006-04-27 03:18:13 +05:30
|
|
|
self.bookmarks = bookmarks
|
|
|
|
|
|
|
|
def display(self):
|
2007-05-20 10:05:46 +05:30
|
|
|
"""
|
2008-03-05 03:58:59 +05:30
|
|
|
Redraw the display.
|
2007-05-20 10:05:46 +05:30
|
|
|
"""
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw()
|
|
|
|
|
2006-04-27 03:18:13 +05:30
|
|
|
def undisplay(self):
|
2007-05-20 10:05:46 +05:30
|
|
|
"""
|
2008-03-05 03:58:59 +05:30
|
|
|
Update the uimanager.
|
2007-05-20 10:05:46 +05:30
|
|
|
"""
|
2006-04-27 03:18:13 +05:30
|
|
|
if self.active != DISABLED:
|
|
|
|
self.uistate.uimanager.remove_ui(self.active)
|
|
|
|
self.uistate.uimanager.remove_action_group(self.action_group)
|
2008-01-08 03:57:05 +05:30
|
|
|
self.action_group = gtk.ActionGroup('Bookmarks')
|
2010-09-21 05:19:00 +05:30
|
|
|
self.uistate.uimanager.ensure_update()
|
2006-04-27 03:18:13 +05:30
|
|
|
self.active = DISABLED
|
|
|
|
|
2007-10-05 14:55:31 +05:30
|
|
|
def redraw_and_report_change(self):
|
2008-03-05 03:58:59 +05:30
|
|
|
"""Create the pulldown menu and set bookmarks to changed."""
|
2007-10-05 14:55:31 +05:30
|
|
|
self.dbstate.db.report_bm_change()
|
|
|
|
self.redraw()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def redraw(self):
|
2008-03-05 03:58:59 +05:30
|
|
|
"""Create the pulldown menu."""
|
2007-05-20 10:05:46 +05:30
|
|
|
text = StringIO()
|
2007-06-27 10:20:33 +05:30
|
|
|
text.write(TOP)
|
2005-12-25 09:31:47 +05:30
|
|
|
|
2006-04-27 03:18:13 +05:30
|
|
|
self.undisplay()
|
2010-01-11 00:49:33 +05:30
|
|
|
|
2005-12-25 09:31:47 +05:30
|
|
|
actions = []
|
2006-04-27 03:18:13 +05:30
|
|
|
count = 0
|
2006-04-26 09:54:54 +05:30
|
|
|
|
2006-12-21 08:58:44 +05:30
|
|
|
if len(self.bookmarks.get()) > 0:
|
2007-05-20 10:05:46 +05:30
|
|
|
text.write('<placeholder name="GoToBook">')
|
2006-12-21 08:58:44 +05:30
|
|
|
for item in self.bookmarks.get():
|
2006-10-09 09:27:41 +05:30
|
|
|
try:
|
2010-01-12 06:00:23 +05:30
|
|
|
label, obj = self.make_label(item)
|
2006-10-09 09:27:41 +05:30
|
|
|
func = self.callback(item)
|
|
|
|
action_id = "BM:%s" % item
|
2007-05-20 10:05:46 +05:30
|
|
|
actions.append((action_id, None, label, None, None, func))
|
|
|
|
text.write('<menuitem action="%s"/>' % action_id)
|
|
|
|
count += 1
|
2006-10-09 09:27:41 +05:30
|
|
|
except AttributeError:
|
|
|
|
pass
|
2007-05-20 10:05:46 +05:30
|
|
|
text.write('</placeholder>')
|
2006-10-09 09:27:41 +05:30
|
|
|
|
2007-06-27 10:20:33 +05:30
|
|
|
text.write(BTM)
|
2005-12-25 09:31:47 +05:30
|
|
|
self.action_group.add_actions(actions)
|
2007-05-20 10:05:46 +05:30
|
|
|
self.uistate.uimanager.insert_action_group(self.action_group, 1)
|
|
|
|
self.active = self.uistate.uimanager.add_ui_from_string(text.getvalue())
|
2006-04-27 03:45:22 +05:30
|
|
|
self.uistate.uimanager.ensure_update()
|
2007-05-20 10:05:46 +05:30
|
|
|
text.close()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def make_label(self, handle):
|
2010-01-11 00:49:33 +05:30
|
|
|
raise NotImplementedError
|
2006-04-27 03:18:13 +05:30
|
|
|
|
|
|
|
def callback(self, handle):
|
2010-01-11 00:49:33 +05:30
|
|
|
raise NotImplementedError
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2006-10-09 09:27:41 +05:30
|
|
|
def add(self, person_handle):
|
2008-03-05 03:58:59 +05:30
|
|
|
"""Append the person to the bottom of the bookmarks."""
|
2006-12-21 08:58:44 +05:30
|
|
|
if person_handle not in self.bookmarks.get():
|
2004-07-28 07:59:07 +05:30
|
|
|
self.bookmarks.append(person_handle)
|
2007-10-05 14:55:31 +05:30
|
|
|
self.redraw_and_report_change()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-10-09 09:27:41 +05:30
|
|
|
def remove_handles(self, handle_list):
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2008-02-24 19:25:55 +05:30
|
|
|
Remove people from the list of bookmarked people.
|
2005-08-18 11:28:28 +05:30
|
|
|
|
|
|
|
This function is for use *outside* the bookmark editor
|
|
|
|
(removal when person is deleted or merged away).
|
|
|
|
"""
|
2006-10-09 09:27:41 +05:30
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
modified = False
|
2006-10-09 09:27:41 +05:30
|
|
|
for handle in handle_list:
|
2006-12-21 08:58:44 +05:30
|
|
|
if handle in self.bookmarks.get():
|
2006-10-09 09:27:41 +05:30
|
|
|
self.bookmarks.remove(handle)
|
2005-08-18 11:28:28 +05:30
|
|
|
modified = True
|
|
|
|
if modified:
|
2007-10-05 14:55:31 +05:30
|
|
|
self.redraw_and_report_change()
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def draw_window(self):
|
2008-03-05 03:58:59 +05:30
|
|
|
"""Draw the bookmark dialog box."""
|
2009-11-18 01:44:53 +05:30
|
|
|
title = _("%(title)s - Gramps") % {'title': _("Organize Bookmarks")}
|
2002-10-20 19:55:16 +05:30
|
|
|
self.top = gtk.Dialog(title)
|
2007-05-20 10:05:46 +05:30
|
|
|
self.top.set_default_size(400, 350)
|
2007-12-31 11:19:03 +05:30
|
|
|
self.top.set_modal(True)
|
2008-03-22 04:13:11 +05:30
|
|
|
self.top.set_transient_for(self.uistate.window)
|
2005-02-24 05:55:34 +05:30
|
|
|
self.top.set_has_separator(False)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.top.vbox.set_spacing(5)
|
2005-08-18 11:28:28 +05:30
|
|
|
label = gtk.Label('<span size="larger" weight="bold">%s</span>'
|
2008-02-19 14:48:47 +05:30
|
|
|
% _("Organize Bookmarks"))
|
2005-02-24 05:55:34 +05:30
|
|
|
label.set_use_markup(True)
|
2007-05-20 10:05:46 +05:30
|
|
|
self.top.vbox.pack_start(label, 0, 0, 5)
|
2002-10-20 19:55:16 +05:30
|
|
|
box = gtk.HBox()
|
2007-05-20 10:05:46 +05:30
|
|
|
self.top.vbox.pack_start(box, 1, 1, 5)
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
name_titles = [(_('Name'), -1, 200), (_('ID'), -1, 50), ('', -1, 0)]
|
2005-08-18 11:28:28 +05:30
|
|
|
self.namelist = gtk.TreeView()
|
2007-05-20 10:05:46 +05:30
|
|
|
self.namemodel = ListModel.ListModel(self.namelist, name_titles)
|
2005-08-18 11:28:28 +05:30
|
|
|
self.namemodel_cols = len(name_titles)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
slist = gtk.ScrolledWindow()
|
|
|
|
slist.add_with_viewport(self.namelist)
|
|
|
|
slist.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
2007-05-20 10:05:46 +05:30
|
|
|
box.pack_start(slist, 1, 1, 5)
|
2002-10-20 19:55:16 +05:30
|
|
|
bbox = gtk.VButtonBox()
|
|
|
|
bbox.set_layout(gtk.BUTTONBOX_START)
|
2003-03-23 01:56:44 +05:30
|
|
|
bbox.set_spacing(6)
|
2005-08-18 11:28:28 +05:30
|
|
|
up = gtk.Button(stock=gtk.STOCK_GO_UP)
|
|
|
|
down = gtk.Button(stock=gtk.STOCK_GO_DOWN)
|
|
|
|
delete = gtk.Button(stock=gtk.STOCK_REMOVE)
|
2002-10-20 19:55:16 +05:30
|
|
|
up.connect('clicked', self.up_clicked)
|
2007-05-20 10:05:46 +05:30
|
|
|
down.connect('clicked', self.down_clicked)
|
|
|
|
delete.connect('clicked', self.delete_clicked)
|
|
|
|
self.top.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
|
|
|
|
self.top.add_button(gtk.STOCK_HELP, gtk.RESPONSE_HELP)
|
2009-02-05 18:30:12 +05:30
|
|
|
self.top.connect('delete-event', self.close)
|
2002-10-20 19:55:16 +05:30
|
|
|
bbox.add(up)
|
|
|
|
bbox.add(down)
|
|
|
|
bbox.add(delete)
|
2007-05-20 10:05:46 +05:30
|
|
|
box.pack_start(bbox, 0, 0, 5)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.top.show_all()
|
2009-02-05 18:30:12 +05:30
|
|
|
|
|
|
|
def close(self, widget, event):
|
|
|
|
"""Stop the bookmark organizer"""
|
|
|
|
self.top.response(gtk.RESPONSE_CLOSE)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def edit(self):
|
|
|
|
"""
|
2008-03-05 03:58:59 +05:30
|
|
|
Display the bookmark editor.
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
The current bookmarked people are inserted into the namelist,
|
|
|
|
attaching the person object to the corresponding row. The currently
|
|
|
|
selected row is attached to the name list. This is either 0 if the
|
|
|
|
list is not empty, or -1 if it is.
|
|
|
|
"""
|
|
|
|
self.draw_window()
|
2006-12-21 08:58:44 +05:30
|
|
|
for handle in self.bookmarks.get():
|
2006-04-27 03:18:13 +05:30
|
|
|
name, obj = self.make_label(handle)
|
|
|
|
if obj:
|
|
|
|
gramps_id = obj.get_gramps_id()
|
2007-05-20 10:05:46 +05:30
|
|
|
self.namemodel.add([name, gramps_id, handle])
|
2005-08-18 11:28:28 +05:30
|
|
|
self.namemodel.connect_model()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-04-26 00:54:40 +05:30
|
|
|
self.modified = False
|
2008-03-22 03:28:41 +05:30
|
|
|
while True:
|
|
|
|
self.response = self.top.run()
|
|
|
|
if self.response == gtk.RESPONSE_HELP:
|
|
|
|
self.help_clicked()
|
|
|
|
elif self.response == gtk.RESPONSE_CLOSE:
|
|
|
|
if self.modified:
|
|
|
|
self.redraw_and_report_change()
|
|
|
|
self.top.destroy()
|
|
|
|
break
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def delete_clicked(self, obj):
|
2008-03-05 03:58:59 +05:30
|
|
|
"""Remove the current selection from the list."""
|
2007-05-20 10:05:46 +05:30
|
|
|
store, the_iter = self.namemodel.get_selected()
|
2005-08-18 11:28:28 +05:30
|
|
|
if not the_iter:
|
|
|
|
return
|
|
|
|
row = self.namemodel.get_selected_row()
|
|
|
|
self.bookmarks.pop(row)
|
|
|
|
self.namemodel.remove(the_iter)
|
2006-04-26 00:54:40 +05:30
|
|
|
self.modified = True
|
2008-03-05 03:58:59 +05:30
|
|
|
if row > 0:
|
2009-09-11 00:19:48 +05:30
|
|
|
row -= 1
|
2008-03-05 03:58:59 +05:30
|
|
|
self.namemodel.select_row(row)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def up_clicked(self, obj):
|
2008-03-05 03:58:59 +05:30
|
|
|
"""Move the current selection up one row."""
|
2005-08-18 11:28:28 +05:30
|
|
|
row = self.namemodel.get_selected_row()
|
2010-09-21 05:28:16 +05:30
|
|
|
if self.namemodel.move_up(row):
|
|
|
|
handle = self.bookmarks.pop(row)
|
|
|
|
self.bookmarks.insert(row-1, handle)
|
|
|
|
self.modified = True
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def down_clicked(self, obj):
|
2008-03-05 03:58:59 +05:30
|
|
|
"""Move the current selection down one row."""
|
2005-08-18 11:28:28 +05:30
|
|
|
row = self.namemodel.get_selected_row()
|
2010-09-21 05:28:16 +05:30
|
|
|
if self.namemodel.move_down(row):
|
|
|
|
handle = self.bookmarks.pop(row)
|
|
|
|
self.bookmarks.insert(row+1, handle)
|
|
|
|
self.modified = True
|
2003-12-02 08:05:49 +05:30
|
|
|
|
|
|
|
def help_clicked(self):
|
2008-03-05 03:58:59 +05:30
|
|
|
"""Display the relevant portion of GRAMPS manual."""
|
2008-04-05 19:47:15 +05:30
|
|
|
GrampsDisplay.help(webpage=WIKI_HELP_PAGE, section=WIKI_HELP_SEC)
|
2005-12-25 09:31:47 +05:30
|
|
|
|
2006-04-27 04:13:59 +05:30
|
|
|
class ListBookmarks(Bookmarks):
|
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
2006-04-27 04:13:59 +05:30
|
|
|
self.goto_handle = goto_handle
|
|
|
|
Bookmarks.__init__(self, dbstate, uistate, bookmarks)
|
|
|
|
|
|
|
|
def callback(self, handle):
|
|
|
|
return make_callback(handle, self.do_callback)
|
|
|
|
|
|
|
|
def do_callback(self, handle):
|
|
|
|
self.goto_handle(handle)
|
|
|
|
|
2010-01-11 00:49:33 +05:30
|
|
|
class PersonBookmarks(ListBookmarks) :
|
|
|
|
"Handle the bookmarks interface for Gramps."
|
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
goto_handle)
|
|
|
|
|
|
|
|
def make_label(self, handle):
|
|
|
|
return Utils.navigation_label(self.dbstate.db, 'Person', handle)
|
|
|
|
|
|
|
|
def connect_signals(self):
|
|
|
|
self.dbstate.db.connect('person-delete', self.remove_handles)
|
|
|
|
|
2006-04-27 04:13:59 +05:30
|
|
|
class FamilyBookmarks(ListBookmarks) :
|
2008-03-05 03:58:59 +05:30
|
|
|
"Handle the bookmarks interface for Gramps."
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
2006-04-27 04:13:59 +05:30
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
goto_handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def make_label(self, handle):
|
2010-01-11 00:49:33 +05:30
|
|
|
return Utils.navigation_label(self.dbstate.db, 'Family', handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2006-10-09 09:27:41 +05:30
|
|
|
def connect_signals(self):
|
|
|
|
self.dbstate.db.connect('family-delete', self.remove_handles)
|
|
|
|
|
2006-04-27 04:13:59 +05:30
|
|
|
class EventBookmarks(ListBookmarks) :
|
2008-03-05 03:58:59 +05:30
|
|
|
"Handle the bookmarks interface for Gramps."
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
2006-04-27 04:13:59 +05:30
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
goto_handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def make_label(self, handle):
|
2010-01-11 00:49:33 +05:30
|
|
|
return Utils.navigation_label(self.dbstate.db, 'Event', handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2006-10-09 09:27:41 +05:30
|
|
|
def connect_signals(self):
|
|
|
|
self.dbstate.db.connect('event-delete', self.remove_handles)
|
|
|
|
|
2006-04-27 04:13:59 +05:30
|
|
|
class SourceBookmarks(ListBookmarks) :
|
2008-03-05 03:58:59 +05:30
|
|
|
"Handle the bookmarks interface for Gramps."
|
2007-05-20 10:05:46 +05:30
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
2006-04-27 04:13:59 +05:30
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
goto_handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def make_label(self, handle):
|
2010-01-11 00:49:33 +05:30
|
|
|
return Utils.navigation_label(self.dbstate.db, 'Source', handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2006-10-09 09:27:41 +05:30
|
|
|
def connect_signals(self):
|
|
|
|
self.dbstate.db.connect('source-delete', self.remove_handles)
|
|
|
|
|
2006-04-27 04:13:59 +05:30
|
|
|
class MediaBookmarks(ListBookmarks) :
|
2008-03-05 03:58:59 +05:30
|
|
|
"Handle the bookmarks interface for Gramps."
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
2006-04-27 04:13:59 +05:30
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
goto_handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def make_label(self, handle):
|
2010-01-11 00:49:33 +05:30
|
|
|
return Utils.navigation_label(self.dbstate.db, 'Media', handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2006-10-09 09:27:41 +05:30
|
|
|
def connect_signals(self):
|
|
|
|
self.dbstate.db.connect('media-delete', self.remove_handles)
|
|
|
|
|
2006-04-27 04:13:59 +05:30
|
|
|
class RepoBookmarks(ListBookmarks) :
|
2008-03-05 03:58:59 +05:30
|
|
|
"Handle the bookmarks interface for Gramps."
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
2006-04-27 04:13:59 +05:30
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
goto_handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def make_label(self, handle):
|
2010-01-11 00:49:33 +05:30
|
|
|
return Utils.navigation_label(self.dbstate.db, 'Repository', handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2006-10-09 09:27:41 +05:30
|
|
|
def connect_signals(self):
|
|
|
|
self.dbstate.db.connect('repository-delete', self.remove_handles)
|
|
|
|
|
2006-04-27 04:13:59 +05:30
|
|
|
class PlaceBookmarks(ListBookmarks) :
|
2008-03-05 03:58:59 +05:30
|
|
|
"Handle the bookmarks interface for Gramps."
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
2006-04-27 04:13:59 +05:30
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
goto_handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def make_label(self, handle):
|
2010-01-11 00:49:33 +05:30
|
|
|
return Utils.navigation_label(self.dbstate.db, 'Place', handle)
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2006-10-09 09:27:41 +05:30
|
|
|
def connect_signals(self):
|
|
|
|
self.dbstate.db.connect('place-delete', self.remove_handles)
|
|
|
|
|
2007-02-13 11:31:16 +05:30
|
|
|
class NoteBookmarks(ListBookmarks) :
|
2008-03-05 03:58:59 +05:30
|
|
|
"Handle the bookmarks interface for Gramps."
|
2007-02-13 11:31:16 +05:30
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
2007-02-13 11:31:16 +05:30
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
goto_handle)
|
|
|
|
|
2007-05-20 10:05:46 +05:30
|
|
|
def make_label(self, handle):
|
2010-01-11 00:49:33 +05:30
|
|
|
return Utils.navigation_label(self.dbstate.db, 'Note', handle)
|
2007-02-13 11:31:16 +05:30
|
|
|
|
|
|
|
def connect_signals(self):
|
2007-03-28 03:17:18 +05:30
|
|
|
self.dbstate.db.connect('note-delete', self.remove_handles)
|
2007-02-13 11:31:16 +05:30
|
|
|
|
2007-06-27 10:20:33 +05:30
|
|
|
def make_callback(handle, function):
|
|
|
|
"""
|
2008-03-05 03:58:59 +05:30
|
|
|
Build a unique call to the function with the associated handle.
|
2007-06-27 10:20:33 +05:30
|
|
|
"""
|
|
|
|
return lambda x: function(handle)
|