|
|
@ -20,7 +20,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
|
|
|
|
"Handle bookmarks for the gramps interface"
|
|
|
|
"Handle bookmarks for the gramps interface."
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
@ -67,11 +67,11 @@ BTM = '''</menu></menubar></ui>'''
|
|
|
|
DISABLED = -1
|
|
|
|
DISABLED = -1
|
|
|
|
|
|
|
|
|
|
|
|
class Bookmarks :
|
|
|
|
class Bookmarks :
|
|
|
|
"Handle the bookmarks interface for Gramps"
|
|
|
|
"Handle the bookmarks interface for Gramps."
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, callback=None):
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, callback=None):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Create a the bookmark editor.
|
|
|
|
Create the bookmark editor.
|
|
|
|
|
|
|
|
|
|
|
|
bookmarks - list of People
|
|
|
|
bookmarks - list of People
|
|
|
|
menu - parent menu to attach users
|
|
|
|
menu - parent menu to attach users
|
|
|
@ -105,14 +105,13 @@ class Bookmarks :
|
|
|
|
|
|
|
|
|
|
|
|
def display(self):
|
|
|
|
def display(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
Redraw the display.
|
|
|
|
Redraw the display
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
self.redraw()
|
|
|
|
self.redraw()
|
|
|
|
|
|
|
|
|
|
|
|
def undisplay(self):
|
|
|
|
def undisplay(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Update the uimanager
|
|
|
|
Update the uimanager.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
if self.active != DISABLED:
|
|
|
|
if self.active != DISABLED:
|
|
|
|
self.uistate.uimanager.remove_ui(self.active)
|
|
|
|
self.uistate.uimanager.remove_ui(self.active)
|
|
|
@ -121,12 +120,12 @@ class Bookmarks :
|
|
|
|
self.active = DISABLED
|
|
|
|
self.active = DISABLED
|
|
|
|
|
|
|
|
|
|
|
|
def redraw_and_report_change(self):
|
|
|
|
def redraw_and_report_change(self):
|
|
|
|
"""Create the pulldown menu and set bookmarks to changed"""
|
|
|
|
"""Create the pulldown menu and set bookmarks to changed."""
|
|
|
|
self.dbstate.db.report_bm_change()
|
|
|
|
self.dbstate.db.report_bm_change()
|
|
|
|
self.redraw()
|
|
|
|
self.redraw()
|
|
|
|
|
|
|
|
|
|
|
|
def redraw(self):
|
|
|
|
def redraw(self):
|
|
|
|
"""Create the pulldown menu"""
|
|
|
|
"""Create the pulldown menu."""
|
|
|
|
text = StringIO()
|
|
|
|
text = StringIO()
|
|
|
|
text.write(TOP)
|
|
|
|
text.write(TOP)
|
|
|
|
|
|
|
|
|
|
|
@ -166,7 +165,7 @@ class Bookmarks :
|
|
|
|
return make_callback(handle, self.dbstate.change_active_handle)
|
|
|
|
return make_callback(handle, self.dbstate.change_active_handle)
|
|
|
|
|
|
|
|
|
|
|
|
def add(self, person_handle):
|
|
|
|
def add(self, person_handle):
|
|
|
|
"""appends the person to the bottom of the bookmarks"""
|
|
|
|
"""Append the person to the bottom of the bookmarks."""
|
|
|
|
if person_handle not in self.bookmarks.get():
|
|
|
|
if person_handle not in self.bookmarks.get():
|
|
|
|
self.bookmarks.append(person_handle)
|
|
|
|
self.bookmarks.append(person_handle)
|
|
|
|
self.redraw_and_report_change()
|
|
|
|
self.redraw_and_report_change()
|
|
|
@ -188,7 +187,7 @@ class Bookmarks :
|
|
|
|
self.redraw_and_report_change()
|
|
|
|
self.redraw_and_report_change()
|
|
|
|
|
|
|
|
|
|
|
|
def draw_window(self):
|
|
|
|
def draw_window(self):
|
|
|
|
"""Draws the bookmark dialog box"""
|
|
|
|
"""Draw the bookmark dialog box."""
|
|
|
|
title = _("%(title)s - GRAMPS") % {'title': _("Organize Bookmarks")}
|
|
|
|
title = _("%(title)s - GRAMPS") % {'title': _("Organize Bookmarks")}
|
|
|
|
self.top = gtk.Dialog(title)
|
|
|
|
self.top = gtk.Dialog(title)
|
|
|
|
self.top.set_default_size(400, 350)
|
|
|
|
self.top.set_default_size(400, 350)
|
|
|
@ -230,7 +229,7 @@ class Bookmarks :
|
|
|
|
|
|
|
|
|
|
|
|
def edit(self):
|
|
|
|
def edit(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
display the bookmark editor.
|
|
|
|
Display the bookmark editor.
|
|
|
|
|
|
|
|
|
|
|
|
The current bookmarked people are inserted into the namelist,
|
|
|
|
The current bookmarked people are inserted into the namelist,
|
|
|
|
attaching the person object to the corresponding row. The currently
|
|
|
|
attaching the person object to the corresponding row. The currently
|
|
|
@ -254,7 +253,7 @@ class Bookmarks :
|
|
|
|
self.top.destroy()
|
|
|
|
self.top.destroy()
|
|
|
|
|
|
|
|
|
|
|
|
def delete_clicked(self, obj):
|
|
|
|
def delete_clicked(self, obj):
|
|
|
|
"""Remove the current selection from the list"""
|
|
|
|
"""Remove the current selection from the list."""
|
|
|
|
store, the_iter = self.namemodel.get_selected()
|
|
|
|
store, the_iter = self.namemodel.get_selected()
|
|
|
|
if not the_iter:
|
|
|
|
if not the_iter:
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -262,9 +261,12 @@ class Bookmarks :
|
|
|
|
self.bookmarks.pop(row)
|
|
|
|
self.bookmarks.pop(row)
|
|
|
|
self.namemodel.remove(the_iter)
|
|
|
|
self.namemodel.remove(the_iter)
|
|
|
|
self.modified = True
|
|
|
|
self.modified = True
|
|
|
|
|
|
|
|
if row > 0:
|
|
|
|
|
|
|
|
row = row - 1
|
|
|
|
|
|
|
|
self.namemodel.select_row(row)
|
|
|
|
|
|
|
|
|
|
|
|
def up_clicked(self, obj):
|
|
|
|
def up_clicked(self, obj):
|
|
|
|
"""Moves the current selection up one row"""
|
|
|
|
"""Move the current selection up one row."""
|
|
|
|
row = self.namemodel.get_selected_row()
|
|
|
|
row = self.namemodel.get_selected_row()
|
|
|
|
if not row or row == -1:
|
|
|
|
if not row or row == -1:
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -277,7 +279,7 @@ class Bookmarks :
|
|
|
|
self.modified = True
|
|
|
|
self.modified = True
|
|
|
|
|
|
|
|
|
|
|
|
def down_clicked(self, obj):
|
|
|
|
def down_clicked(self, obj):
|
|
|
|
"""Moves the current selection down one row"""
|
|
|
|
"""Move the current selection down one row."""
|
|
|
|
row = self.namemodel.get_selected_row()
|
|
|
|
row = self.namemodel.get_selected_row()
|
|
|
|
if row + 1 >= self.namemodel.count or row == -1:
|
|
|
|
if row + 1 >= self.namemodel.count or row == -1:
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -290,7 +292,7 @@ class Bookmarks :
|
|
|
|
self.modified = True
|
|
|
|
self.modified = True
|
|
|
|
|
|
|
|
|
|
|
|
def help_clicked(self):
|
|
|
|
def help_clicked(self):
|
|
|
|
"""Display the relevant portion of GRAMPS manual"""
|
|
|
|
"""Display the relevant portion of GRAMPS manual."""
|
|
|
|
GrampsDisplay.help('gramps-nav')
|
|
|
|
GrampsDisplay.help('gramps-nav')
|
|
|
|
self.response = self.top.run()
|
|
|
|
self.response = self.top.run()
|
|
|
|
|
|
|
|
|
|
|
@ -307,7 +309,7 @@ class ListBookmarks(Bookmarks):
|
|
|
|
self.goto_handle(handle)
|
|
|
|
self.goto_handle(handle)
|
|
|
|
|
|
|
|
|
|
|
|
class FamilyBookmarks(ListBookmarks) :
|
|
|
|
class FamilyBookmarks(ListBookmarks) :
|
|
|
|
"Handle the bookmarks interface for Gramps"
|
|
|
|
"Handle the bookmarks interface for Gramps."
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
@ -322,7 +324,7 @@ class FamilyBookmarks(ListBookmarks) :
|
|
|
|
self.dbstate.db.connect('family-delete', self.remove_handles)
|
|
|
|
self.dbstate.db.connect('family-delete', self.remove_handles)
|
|
|
|
|
|
|
|
|
|
|
|
class EventBookmarks(ListBookmarks) :
|
|
|
|
class EventBookmarks(ListBookmarks) :
|
|
|
|
"Handle the bookmarks interface for Gramps"
|
|
|
|
"Handle the bookmarks interface for Gramps."
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
@ -340,7 +342,7 @@ class EventBookmarks(ListBookmarks) :
|
|
|
|
self.dbstate.db.connect('event-delete', self.remove_handles)
|
|
|
|
self.dbstate.db.connect('event-delete', self.remove_handles)
|
|
|
|
|
|
|
|
|
|
|
|
class SourceBookmarks(ListBookmarks) :
|
|
|
|
class SourceBookmarks(ListBookmarks) :
|
|
|
|
"Handle the bookmarks interface for Gramps"
|
|
|
|
"Handle the bookmarks interface for Gramps."
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
goto_handle)
|
|
|
|
goto_handle)
|
|
|
@ -354,7 +356,7 @@ class SourceBookmarks(ListBookmarks) :
|
|
|
|
self.dbstate.db.connect('source-delete', self.remove_handles)
|
|
|
|
self.dbstate.db.connect('source-delete', self.remove_handles)
|
|
|
|
|
|
|
|
|
|
|
|
class MediaBookmarks(ListBookmarks) :
|
|
|
|
class MediaBookmarks(ListBookmarks) :
|
|
|
|
"Handle the bookmarks interface for Gramps"
|
|
|
|
"Handle the bookmarks interface for Gramps."
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
@ -369,7 +371,7 @@ class MediaBookmarks(ListBookmarks) :
|
|
|
|
self.dbstate.db.connect('media-delete', self.remove_handles)
|
|
|
|
self.dbstate.db.connect('media-delete', self.remove_handles)
|
|
|
|
|
|
|
|
|
|
|
|
class RepoBookmarks(ListBookmarks) :
|
|
|
|
class RepoBookmarks(ListBookmarks) :
|
|
|
|
"Handle the bookmarks interface for Gramps"
|
|
|
|
"Handle the bookmarks interface for Gramps."
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
@ -384,7 +386,7 @@ class RepoBookmarks(ListBookmarks) :
|
|
|
|
self.dbstate.db.connect('repository-delete', self.remove_handles)
|
|
|
|
self.dbstate.db.connect('repository-delete', self.remove_handles)
|
|
|
|
|
|
|
|
|
|
|
|
class PlaceBookmarks(ListBookmarks) :
|
|
|
|
class PlaceBookmarks(ListBookmarks) :
|
|
|
|
"Handle the bookmarks interface for Gramps"
|
|
|
|
"Handle the bookmarks interface for Gramps."
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
@ -399,7 +401,7 @@ class PlaceBookmarks(ListBookmarks) :
|
|
|
|
self.dbstate.db.connect('place-delete', self.remove_handles)
|
|
|
|
self.dbstate.db.connect('place-delete', self.remove_handles)
|
|
|
|
|
|
|
|
|
|
|
|
class NoteBookmarks(ListBookmarks) :
|
|
|
|
class NoteBookmarks(ListBookmarks) :
|
|
|
|
"Handle the bookmarks interface for Gramps"
|
|
|
|
"Handle the bookmarks interface for Gramps."
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
|
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
|
|
@ -417,6 +419,6 @@ class NoteBookmarks(ListBookmarks) :
|
|
|
|
|
|
|
|
|
|
|
|
def make_callback(handle, function):
|
|
|
|
def make_callback(handle, function):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Builds a unique call to the function with the associated handle
|
|
|
|
Build a unique call to the function with the associated handle.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
return lambda x: function(handle)
|
|
|
|
return lambda x: function(handle)
|
|
|
|