Tidy up bookmark code

svn: r21139
This commit is contained in:
Nick Hall 2013-01-15 22:30:18 +00:00
parent ae65778d27
commit a323f92482
25 changed files with 71 additions and 152 deletions

View File

@ -82,7 +82,7 @@ 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, callback=None):
""" """
Create the bookmark editor. Create the bookmark editor.
@ -92,7 +92,8 @@ class Bookmarks :
""" """
self.dbstate = dbstate self.dbstate = dbstate
self.uistate = uistate self.uistate = uistate
self.bookmarks = bookmarks self.bookmarks = None
self.update_bookmarks()
self.active = DISABLED self.active = DISABLED
self.action_group = Gtk.ActionGroup('Bookmarks') self.action_group = Gtk.ActionGroup('Bookmarks')
self.connect_signals() self.connect_signals()
@ -103,6 +104,7 @@ class Bookmarks :
Reconnect the signals on a database changed. Reconnect the signals on a database changed.
""" """
self.connect_signals() self.connect_signals()
self.update_bookmarks()
def connect_signals(self): def connect_signals(self):
""" """
@ -110,11 +112,17 @@ class Bookmarks :
""" """
raise NotImplementedError raise NotImplementedError
def update_bookmarks(self, bookmarks): def get_bookmarks(self):
"""
Retrieve bookmarks from the database.
"""
raise NotImplementedError
def update_bookmarks(self):
""" """
Assign bookmarks Assign bookmarks
""" """
self.bookmarks = bookmarks self.bookmarks = self.get_bookmarks()
def display(self): def display(self):
""" """
@ -306,9 +314,9 @@ class Bookmarks :
class ListBookmarks(Bookmarks): class ListBookmarks(Bookmarks):
def __init__(self, dbstate, uistate, bookmarks, goto_handle): def __init__(self, dbstate, uistate, goto_handle):
self.goto_handle = goto_handle self.goto_handle = goto_handle
Bookmarks.__init__(self, dbstate, uistate, bookmarks) Bookmarks.__init__(self, dbstate, uistate)
def callback(self, handle): def callback(self, handle):
return make_callback(handle, self.do_callback) return make_callback(handle, self.do_callback)
@ -319,9 +327,8 @@ class ListBookmarks(Bookmarks):
class PersonBookmarks(ListBookmarks) : class PersonBookmarks(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, goto_handle):
ListBookmarks.__init__(self, dbstate, uistate, bookmarks, ListBookmarks.__init__(self, dbstate, uistate, goto_handle)
goto_handle)
def make_label(self, handle): def make_label(self, handle):
return navigation_label(self.dbstate.db, 'Person', handle) return navigation_label(self.dbstate.db, 'Person', handle)
@ -329,12 +336,14 @@ class PersonBookmarks(ListBookmarks) :
def connect_signals(self): def connect_signals(self):
self.dbstate.db.connect('person-delete', self.remove_handles) self.dbstate.db.connect('person-delete', self.remove_handles)
def get_bookmarks(self):
return self.dbstate.db.get_bookmarks()
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, goto_handle):
ListBookmarks.__init__(self, dbstate, uistate, bookmarks, ListBookmarks.__init__(self, dbstate, uistate, goto_handle)
goto_handle)
def make_label(self, handle): def make_label(self, handle):
return navigation_label(self.dbstate.db, 'Family', handle) return navigation_label(self.dbstate.db, 'Family', handle)
@ -342,12 +351,14 @@ class FamilyBookmarks(ListBookmarks) :
def connect_signals(self): def connect_signals(self):
self.dbstate.db.connect('family-delete', self.remove_handles) self.dbstate.db.connect('family-delete', self.remove_handles)
def get_bookmarks(self):
return self.dbstate.db.get_family_bookmarks()
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, goto_handle):
ListBookmarks.__init__(self, dbstate, uistate, bookmarks, ListBookmarks.__init__(self, dbstate, uistate, goto_handle)
goto_handle)
def make_label(self, handle): def make_label(self, handle):
return navigation_label(self.dbstate.db, 'Event', handle) return navigation_label(self.dbstate.db, 'Event', handle)
@ -355,11 +366,14 @@ class EventBookmarks(ListBookmarks) :
def connect_signals(self): def connect_signals(self):
self.dbstate.db.connect('event-delete', self.remove_handles) self.dbstate.db.connect('event-delete', self.remove_handles)
def get_bookmarks(self):
return self.dbstate.db.get_event_bookmarks()
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):
ListBookmarks.__init__(self, dbstate, uistate, bookmarks, def __init__(self, dbstate, uistate, goto_handle):
goto_handle) ListBookmarks.__init__(self, dbstate, uistate, goto_handle)
def make_label(self, handle): def make_label(self, handle):
return navigation_label(self.dbstate.db, 'Source', handle) return navigation_label(self.dbstate.db, 'Source', handle)
@ -367,11 +381,14 @@ class SourceBookmarks(ListBookmarks) :
def connect_signals(self): def connect_signals(self):
self.dbstate.db.connect('source-delete', self.remove_handles) self.dbstate.db.connect('source-delete', self.remove_handles)
def get_bookmarks(self):
return self.dbstate.db.get_source_bookmarks()
class CitationBookmarks(ListBookmarks) : class CitationBookmarks(ListBookmarks) :
"Handle the bookmarks interface for Gramps." "Handle the bookmarks interface for Gramps."
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
ListBookmarks.__init__(self, dbstate, uistate, bookmarks, def __init__(self, dbstate, uistate, goto_handle):
goto_handle) ListBookmarks.__init__(self, dbstate, uistate, goto_handle)
def make_label(self, handle): def make_label(self, handle):
return navigation_label(self.dbstate.db, 'Citation', handle) return navigation_label(self.dbstate.db, 'Citation', handle)
@ -379,12 +396,14 @@ class CitationBookmarks(ListBookmarks) :
def connect_signals(self): def connect_signals(self):
self.dbstate.db.connect('citation-delete', self.remove_handles) self.dbstate.db.connect('citation-delete', self.remove_handles)
def get_bookmarks(self):
return self.dbstate.db.get_citation_bookmarks()
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, goto_handle):
ListBookmarks.__init__(self, dbstate, uistate, bookmarks, ListBookmarks.__init__(self, dbstate, uistate, goto_handle)
goto_handle)
def make_label(self, handle): def make_label(self, handle):
return navigation_label(self.dbstate.db, 'Media', handle) return navigation_label(self.dbstate.db, 'Media', handle)
@ -392,12 +411,14 @@ class MediaBookmarks(ListBookmarks) :
def connect_signals(self): def connect_signals(self):
self.dbstate.db.connect('media-delete', self.remove_handles) self.dbstate.db.connect('media-delete', self.remove_handles)
def get_bookmarks(self):
return self.dbstate.db.get_media_bookmarks()
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, goto_handle):
ListBookmarks.__init__(self, dbstate, uistate, bookmarks, ListBookmarks.__init__(self, dbstate, uistate, goto_handle)
goto_handle)
def make_label(self, handle): def make_label(self, handle):
return navigation_label(self.dbstate.db, 'Repository', handle) return navigation_label(self.dbstate.db, 'Repository', handle)
@ -405,12 +426,14 @@ class RepoBookmarks(ListBookmarks) :
def connect_signals(self): def connect_signals(self):
self.dbstate.db.connect('repository-delete', self.remove_handles) self.dbstate.db.connect('repository-delete', self.remove_handles)
def get_bookmarks(self):
return self.dbstate.db.get_repo_bookmarks()
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, goto_handle):
ListBookmarks.__init__(self, dbstate, uistate, bookmarks, ListBookmarks.__init__(self, dbstate, uistate, goto_handle)
goto_handle)
def make_label(self, handle): def make_label(self, handle):
return navigation_label(self.dbstate.db, 'Place', handle) return navigation_label(self.dbstate.db, 'Place', handle)
@ -418,12 +441,14 @@ class PlaceBookmarks(ListBookmarks) :
def connect_signals(self): def connect_signals(self):
self.dbstate.db.connect('place-delete', self.remove_handles) self.dbstate.db.connect('place-delete', self.remove_handles)
def get_bookmarks(self):
return self.dbstate.db.get_place_bookmarks()
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, goto_handle):
ListBookmarks.__init__(self, dbstate, uistate, bookmarks, ListBookmarks.__init__(self, dbstate, uistate, goto_handle)
goto_handle)
def make_label(self, handle): def make_label(self, handle):
return navigation_label(self.dbstate.db, 'Note', handle) return navigation_label(self.dbstate.db, 'Note', handle)
@ -431,6 +456,9 @@ class NoteBookmarks(ListBookmarks) :
def connect_signals(self): def connect_signals(self):
self.dbstate.db.connect('note-delete', self.remove_handles) self.dbstate.db.connect('note-delete', self.remove_handles)
def get_bookmarks(self):
return self.dbstate.db.get_note_bookmarks()
def make_callback(handle, function): def make_callback(handle, function):
""" """
Build a unique call to the function with the associated handle. Build a unique call to the function with the associated handle.

View File

@ -104,10 +104,10 @@ class ListView(NavigationView):
QR_CATEGORY = -1 QR_CATEGORY = -1
def __init__(self, title, pdata, dbstate, uistate, handle_col, def __init__(self, title, pdata, dbstate, uistate, handle_col,
make_model, signal_map, get_bookmarks, bm_type, nav_group, make_model, signal_map, bm_type, nav_group,
multiple=False, filter_class=None): multiple=False, filter_class=None):
NavigationView.__init__(self, title, pdata, dbstate, uistate, NavigationView.__init__(self, title, pdata, dbstate, uistate,
get_bookmarks, bm_type, nav_group) 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
@ -681,7 +681,6 @@ class ListView(NavigationView):
self._change_db(db) self._change_db(db)
self.connect_signals() self.connect_signals()
self.bookmarks.update_bookmarks(self.get_bookmarks())
if self.active: if self.active:
#force rebuild of the model on build of tree #force rebuild of the model on build of tree
self.dirty = True self.dirty = True

View File

@ -80,10 +80,9 @@ class NavigationView(PageView):
should derive from this class. should derive from this class.
""" """
def __init__(self, title, pdata, state, uistate, bookmarks, bm_type, nav_group): def __init__(self, title, pdata, state, uistate, bm_type, nav_group):
PageView.__init__(self, title, pdata, 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, self.goto_handle)
self.goto_handle)
self.fwd_action = None self.fwd_action = None
self.back_action = None self.back_action = None

View File

@ -135,7 +135,7 @@ class BasePersonView(ListView):
ListView.__init__( ListView.__init__(
self, title, pdata, dbstate, uistate, self, title, pdata, dbstate, uistate,
len(BasePersonView.COLUMNS), len(BasePersonView.COLUMNS),
model, signal_map, dbstate.db.get_bookmarks(), model, signal_map,
PersonBookmarks, nav_group, PersonBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=PersonSidebarFilter) filter_class=PersonSidebarFilter)
@ -155,12 +155,6 @@ class BasePersonView(ListView):
""" """
return 'Person' return 'Person'
def get_bookmarks(self):
"""
Return the bookmark object
"""
return self.dbstate.db.get_bookmarks()
def drag_info(self): def drag_info(self):
""" """
Specify the drag type for a single selection Specify the drag type for a single selection

View File

@ -140,7 +140,6 @@ class PlaceBaseView(ListView):
self, title, pdata, dbstate, uistate, self, title, pdata, dbstate, uistate,
15, 15,
model, signal_map, model, signal_map,
dbstate.db.get_place_bookmarks(),
PlaceBookmarks, nav_group, PlaceBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=PlaceSidebarFilter) filter_class=PlaceSidebarFilter)
@ -155,9 +154,6 @@ class PlaceBaseView(ListView):
def navigation_type(self): def navigation_type(self):
return 'Place' return 'Place'
def get_bookmarks(self):
return self.dbstate.db.get_place_bookmarks()
def define_actions(self): def define_actions(self):
ListView.define_actions(self) ListView.define_actions(self)
self._add_toolmenu_action('MapsList', _('Loading...'), self._add_toolmenu_action('MapsList', _('Loading...'),

View File

@ -126,7 +126,7 @@ class GeoGraphyView(OsmGps, NavigationView):
def __init__(self, title, pdata, dbstate, uistate, def __init__(self, title, pdata, dbstate, uistate,
get_bookmarks, bm_type, nav_group): get_bookmarks, bm_type, nav_group):
NavigationView.__init__(self, title, pdata, dbstate, uistate, NavigationView.__init__(self, title, pdata, dbstate, uistate,
get_bookmarks, bm_type, nav_group) bm_type, nav_group)
self.dbstate = dbstate self.dbstate = dbstate
self.dbstate.connect('database-changed', self.change_db) self.dbstate.connect('database-changed', self.change_db)
@ -224,7 +224,6 @@ class GeoGraphyView(OsmGps, NavigationView):
is no need to store the database, since we will get the value is no need to store the database, since we will get the value
from self.state.db from self.state.db
""" """
self.bookmarks.update_bookmarks(self.dbstate.db.get_bookmarks())
if self.active: if self.active:
self.bookmarks.redraw() self.bookmarks.redraw()

View File

@ -142,7 +142,6 @@ class CitationListView(ListView):
self, _('Citation View'), pdata, dbstate, uistate, self, _('Citation View'), pdata, dbstate, uistate,
len(self.COLUMNS), len(self.COLUMNS),
CitationListModel, signal_map, CitationListModel, signal_map,
dbstate.db.get_citation_bookmarks(),
CitationBookmarks, nav_group, CitationBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=CitationSidebarFilter) filter_class=CitationSidebarFilter)
@ -157,9 +156,6 @@ class CitationListView(ListView):
def navigation_type(self): def navigation_type(self):
return 'Citation' return 'Citation'
def get_bookmarks(self):
return self.dbstate.db.get_citation_bookmarks()
def drag_info(self): def drag_info(self):
return DdTargets.CITATION_LINK return DdTargets.CITATION_LINK

View File

@ -143,7 +143,6 @@ class CitationTreeView(ListView):
self, _('Citation Tree View'), pdata, dbstate, uistate, self, _('Citation Tree View'), pdata, dbstate, uistate,
len(self.COLUMNS), len(self.COLUMNS),
CitationTreeModel, signal_map, CitationTreeModel, signal_map,
dbstate.db.get_citation_bookmarks(),
CitationBookmarks, nav_group, CitationBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=SourceSidebarFilter) filter_class=SourceSidebarFilter)
@ -221,9 +220,6 @@ class CitationTreeView(ListView):
def navigation_type(self): def navigation_type(self):
return 'Citation' return 'Citation'
def get_bookmarks(self):
return self.dbstate.db.get_citation_bookmarks()
def drag_info(self): def drag_info(self):
# Since drag only needs to work when just one row is selected, ideally, # Since drag only needs to work when just one row is selected, ideally,
# this should just return SOURCE_LINK if one source is selected and # this should just return SOURCE_LINK if one source is selected and

View File

@ -117,7 +117,7 @@ class EventView(ListView):
self, _('Events'), pdata, dbstate, uistate, self, _('Events'), pdata, dbstate, uistate,
len(EventView.COLUMNS), len(EventView.COLUMNS),
EventModel, EventModel,
signal_map, dbstate.db.get_event_bookmarks(), signal_map,
EventBookmarks, nav_group, EventBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=EventSidebarFilter) filter_class=EventSidebarFilter)
@ -134,12 +134,6 @@ class EventView(ListView):
def navigation_type(self): def navigation_type(self):
return 'Event' return 'Event'
def get_bookmarks(self):
"""
Return the bookmark object
"""
return self.dbstate.db.get_event_bookmarks()
def drag_info(self): def drag_info(self):
""" """
Indicate that the drag type is an EVENT Indicate that the drag type is an EVENT

View File

@ -116,7 +116,7 @@ class FamilyView(ListView):
self, _('Families'), pdata, dbstate, uistate, self, _('Families'), pdata, dbstate, uistate,
len(FamilyView.COLUMNS), len(FamilyView.COLUMNS),
FamilyModel, FamilyModel,
signal_map, dbstate.db.get_family_bookmarks(), signal_map,
FamilyBookmarks, nav_group, FamilyBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=FamilySidebarFilter) filter_class=FamilySidebarFilter)
@ -227,9 +227,6 @@ class FamilyView(ListView):
ListView.set_inactive(self) ListView.set_inactive(self)
self.uistate.viewmanager.tags.tag_disable() self.uistate.viewmanager.tags.tag_disable()
def get_bookmarks(self):
return self.dbstate.db.get_family_bookmarks()
def add_bookmark(self, obj): def add_bookmark(self, obj):
mlist = self.selected_handles() mlist = self.selected_handles()
if mlist: if mlist:

View File

@ -72,7 +72,6 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView):
NavigationView.__init__(self, _('Descendant Fan Chart'), NavigationView.__init__(self, _('Descendant Fan Chart'),
pdata, dbstate, uistate, pdata, dbstate, uistate,
dbstate.db.get_bookmarks(),
PersonBookmarks, PersonBookmarks,
nav_group) nav_group)
fanchartdesc.FanChartDescGrampsGUI.__init__(self, self.on_childmenu_changed) fanchartdesc.FanChartDescGrampsGUI.__init__(self, self.on_childmenu_changed)
@ -200,7 +199,6 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView):
def change_db(self, db): def change_db(self, db):
self._change_db(db) self._change_db(db)
self.bookmarks.update_bookmarks(self.dbstate.db.get_bookmarks())
if self.active: if self.active:
self.bookmarks.redraw() self.bookmarks.redraw()
self.update() self.update()

View File

@ -71,7 +71,6 @@ class FanChartView(fanchart.FanChartGrampsGUI, NavigationView):
NavigationView.__init__(self, _('Fan Chart'), NavigationView.__init__(self, _('Fan Chart'),
pdata, dbstate, uistate, pdata, dbstate, uistate,
dbstate.db.get_bookmarks(),
PersonBookmarks, PersonBookmarks,
nav_group) nav_group)
fanchart.FanChartGrampsGUI.__init__(self, self.on_childmenu_changed) fanchart.FanChartGrampsGUI.__init__(self, self.on_childmenu_changed)
@ -198,7 +197,6 @@ class FanChartView(fanchart.FanChartGrampsGUI, NavigationView):
def change_db(self, db): def change_db(self, db):
self._change_db(db) self._change_db(db)
self.bookmarks.update_bookmarks(self.dbstate.db.get_bookmarks())
if self.active: if self.active:
self.bookmarks.redraw() self.bookmarks.redraw()
self.update() self.update()

View File

@ -130,7 +130,6 @@ class GeoClose(GeoGraphyView):
def __init__(self, pdata, dbstate, uistate, nav_group=0): def __init__(self, pdata, dbstate, uistate, nav_group=0):
GeoGraphyView.__init__(self, _("Have they been able to meet?"), GeoGraphyView.__init__(self, _("Have they been able to meet?"),
pdata, dbstate, uistate, pdata, dbstate, uistate,
dbstate.db.get_bookmarks(),
PersonBookmarks, PersonBookmarks,
nav_group) nav_group)
self.dbstate = dbstate self.dbstate = dbstate
@ -188,12 +187,6 @@ class GeoClose(GeoGraphyView):
""" """
return 'Person' return 'Person'
def get_bookmarks(self):
"""
Return the bookmark object
"""
return self.dbstate.db.get_bookmarks()
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.

View File

@ -111,7 +111,6 @@ class GeoEvents(GeoGraphyView):
def __init__(self, pdata, dbstate, uistate, nav_group=0): def __init__(self, pdata, dbstate, uistate, nav_group=0):
GeoGraphyView.__init__(self, _('Events places map'), GeoGraphyView.__init__(self, _('Events places map'),
pdata, dbstate, uistate, pdata, dbstate, uistate,
dbstate.db.get_event_bookmarks(),
EventBookmarks, EventBookmarks,
nav_group) nav_group)
self.dbstate = dbstate self.dbstate = dbstate
@ -161,12 +160,6 @@ class GeoEvents(GeoGraphyView):
""" """
return 'Event' return 'Event'
def get_bookmarks(self):
"""
Return the bookmark object
"""
return self.dbstate.db.get_event_bookmarks()
def goto_handle(self, handle=None): def goto_handle(self, handle=None):
""" """
Rebuild the tree with the given events handle as the root. Rebuild the tree with the given events handle as the root.

View File

@ -128,7 +128,6 @@ class GeoFamClose(GeoGraphyView):
def __init__(self, pdata, dbstate, uistate, nav_group=0): def __init__(self, pdata, dbstate, uistate, nav_group=0):
GeoGraphyView.__init__(self, _("Have these two families been able to meet?"), GeoGraphyView.__init__(self, _("Have these two families been able to meet?"),
pdata, dbstate, uistate, pdata, dbstate, uistate,
dbstate.db.get_bookmarks(),
FamilyBookmarks, FamilyBookmarks,
nav_group) nav_group)
self.dbstate = dbstate self.dbstate = dbstate
@ -186,12 +185,6 @@ class GeoFamClose(GeoGraphyView):
""" """
return 'Family' return 'Family'
def get_bookmarks(self):
"""
Return the bookmark object
"""
return self.dbstate.db.get_bookmarks()
def family_label(self,family): def family_label(self,family):
if family is None: if family is None:
return "Unknown" return "Unknown"

View File

@ -111,7 +111,6 @@ class GeoFamily(GeoGraphyView):
def __init__(self, pdata, dbstate, uistate, nav_group=0): def __init__(self, pdata, dbstate, uistate, nav_group=0):
GeoGraphyView.__init__(self, _('Family places map'), GeoGraphyView.__init__(self, _('Family places map'),
pdata, dbstate, uistate, pdata, dbstate, uistate,
dbstate.db.get_family_bookmarks(),
FamilyBookmarks, FamilyBookmarks,
nav_group) nav_group)
self.dbstate = dbstate self.dbstate = dbstate
@ -160,12 +159,6 @@ class GeoFamily(GeoGraphyView):
""" """
return 'Family' return 'Family'
def get_bookmarks(self):
"""
Return the bookmark object
"""
return self.dbstate.db.get_family_bookmarks()
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.

View File

@ -131,7 +131,6 @@ class GeoMoves(GeoGraphyView):
def __init__(self, pdata, dbstate, uistate, nav_group=0): def __init__(self, pdata, dbstate, uistate, nav_group=0):
GeoGraphyView.__init__(self, _("Descendance of the active person."), GeoGraphyView.__init__(self, _("Descendance of the active person."),
pdata, dbstate, uistate, pdata, dbstate, uistate,
dbstate.db.get_bookmarks(),
PersonBookmarks, PersonBookmarks,
nav_group) nav_group)
self.dbstate = dbstate self.dbstate = dbstate
@ -189,12 +188,6 @@ class GeoMoves(GeoGraphyView):
""" """
return 'Person' return 'Person'
def get_bookmarks(self):
"""
Return the bookmark object
"""
return self.dbstate.db.get_bookmarks()
def goto_handle(self, handle=None): def goto_handle(self, handle=None):
""" """
Rebuild the tree with the given family handle as reference. Rebuild the tree with the given family handle as reference.

View File

@ -140,7 +140,6 @@ class GeoPerson(GeoGraphyView):
def __init__(self, pdata, dbstate, uistate, nav_group=0): def __init__(self, pdata, dbstate, uistate, nav_group=0):
GeoGraphyView.__init__(self, _("Person places map"), GeoGraphyView.__init__(self, _("Person places map"),
pdata, dbstate, uistate, pdata, dbstate, uistate,
dbstate.db.get_bookmarks(),
PersonBookmarks, PersonBookmarks,
nav_group) nav_group)
self.dbstate = dbstate self.dbstate = dbstate
@ -189,12 +188,6 @@ class GeoPerson(GeoGraphyView):
""" """
return 'Person' return 'Person'
def get_bookmarks(self):
"""
Return the bookmark object
"""
return self.dbstate.db.get_bookmarks()
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.

View File

@ -111,7 +111,6 @@ class GeoPlaces(GeoGraphyView):
def __init__(self, pdata, dbstate, uistate, nav_group=0): def __init__(self, pdata, dbstate, uistate, nav_group=0):
GeoGraphyView.__init__(self, _('Places places map'), GeoGraphyView.__init__(self, _('Places places map'),
pdata, dbstate, uistate, pdata, dbstate, uistate,
dbstate.db.get_place_bookmarks(),
PlaceBookmarks, PlaceBookmarks,
nav_group) nav_group)
self.dbstate = dbstate self.dbstate = dbstate
@ -161,12 +160,6 @@ class GeoPlaces(GeoGraphyView):
""" """
return 'Place' return 'Place'
def get_bookmarks(self):
"""
Return the bookmark object
"""
return self.dbstate.db.get_place_bookmarks()
def goto_handle(self, handle=None): def goto_handle(self, handle=None):
""" """
Rebuild the tree with the given places handle as the root. Rebuild the tree with the given places handle as the root.

View File

@ -139,7 +139,7 @@ class MediaView(ListView):
self, _('Media'), pdata, dbstate, uistate, self, _('Media'), pdata, dbstate, uistate,
len(MediaView.COLUMNS), len(MediaView.COLUMNS),
MediaModel, MediaModel,
signal_map, dbstate.db.get_media_bookmarks(), signal_map,
MediaBookmarks, nav_group, MediaBookmarks, nav_group,
filter_class=MediaSidebarFilter, filter_class=MediaSidebarFilter,
multiple=True) multiple=True)
@ -212,12 +212,6 @@ class MediaView(ListView):
self.dbstate.db.add_object(photo, trans) self.dbstate.db.add_object(photo, trans)
widget.emit_stop_by_name('drag_data_received') widget.emit_stop_by_name('drag_data_received')
def get_bookmarks(self):
"""
Return the bookmarks associated with this view
"""
return self.dbstate.db.get_media_bookmarks()
def define_actions(self): def define_actions(self):
""" """
Defines the UIManager actions specific to Media View. We need to make Defines the UIManager actions specific to Media View. We need to make

View File

@ -111,7 +111,6 @@ class NoteView(ListView):
ListView.__init__( ListView.__init__(
self, _('Notes'), pdata, dbstate, uistate, self, _('Notes'), pdata, dbstate, uistate,
len(NoteView.COLUMNS), NoteModel, signal_map, len(NoteView.COLUMNS), NoteModel, signal_map,
dbstate.db.get_note_bookmarks(),
NoteBookmarks, nav_group, NoteBookmarks, nav_group,
filter_class=NoteSidebarFilter, filter_class=NoteSidebarFilter,
multiple=True) multiple=True)
@ -126,12 +125,6 @@ class NoteView(ListView):
def navigation_type(self): def navigation_type(self):
return 'Note' return 'Note'
def get_bookmarks(self):
"""
Return the bookmark object
"""
return self.dbstate.db.get_note_bookmarks()
def drag_info(self): def drag_info(self):
""" """
Indicate that the drag type is an EVENT Indicate that the drag type is an EVENT

View File

@ -520,9 +520,7 @@ class PedigreeView(NavigationView):
def __init__(self, pdata, dbstate, uistate, nav_group=0): def __init__(self, pdata, dbstate, uistate, nav_group=0):
NavigationView.__init__(self, _('Pedigree'), pdata, dbstate, uistate, NavigationView.__init__(self, _('Pedigree'), pdata, dbstate, uistate,
dbstate.db.get_bookmarks(), PersonBookmarks, nav_group)
PersonBookmarks,
nav_group)
self.func_list.update({ self.func_list.update({
'F2' : self.kb_goto_home, 'F2' : self.kb_goto_home,
@ -715,7 +713,6 @@ class PedigreeView(NavigationView):
from self.state.db from self.state.db
""" """
self._change_db(db) self._change_db(db)
self.bookmarks.update_bookmarks(self.dbstate.db.get_bookmarks())
if self.active: if self.active:
self.bookmarks.redraw() self.bookmarks.redraw()
self.build_tree() self.build_tree()

View File

@ -148,7 +148,6 @@ class RelationshipView(NavigationView):
def __init__(self, pdata, dbstate, uistate, nav_group=0): def __init__(self, pdata, dbstate, uistate, nav_group=0):
NavigationView.__init__(self, _('Relationships'), NavigationView.__init__(self, _('Relationships'),
pdata, dbstate, uistate, pdata, dbstate, uistate,
dbstate.db.get_bookmarks(),
PersonBookmarks, PersonBookmarks,
nav_group) nav_group)
@ -454,7 +453,6 @@ class RelationshipView(NavigationView):
list(map(self.vbox.remove, self.vbox.get_children())) list(map(self.vbox.remove, self.vbox.get_children()))
list(map(self.header.remove, self.header.get_children())) list(map(self.header.remove, self.header.get_children()))
self.child = None self.child = None
self.bookmarks.update_bookmarks(db.get_bookmarks())
if self.active: if self.active:
self.bookmarks.redraw() self.bookmarks.redraw()
self.redraw() self.redraw()

View File

@ -127,7 +127,6 @@ class RepositoryView(ListView):
self, _('Repositories'), pdata, dbstate, uistate, self, _('Repositories'), pdata, dbstate, uistate,
len(RepositoryView.COLUMNS), len(RepositoryView.COLUMNS),
RepositoryModel, signal_map, RepositoryModel, signal_map,
dbstate.db.get_repo_bookmarks(),
RepoBookmarks, nav_group, RepoBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=RepoSidebarFilter) filter_class=RepoSidebarFilter)
@ -142,9 +141,6 @@ class RepositoryView(ListView):
def navigation_type(self): def navigation_type(self):
return 'Repository' return 'Repository'
def get_bookmarks(self):
return self.dbstate.db.get_repo_bookmarks()
def drag_info(self): def drag_info(self):
return DdTargets.REPO_LINK return DdTargets.REPO_LINK

View File

@ -114,7 +114,6 @@ class SourceView(ListView):
self, _('Sources'), pdata, dbstate, uistate, self, _('Sources'), pdata, dbstate, uistate,
len(SourceView.COLUMNS), len(SourceView.COLUMNS),
SourceModel, signal_map, SourceModel, signal_map,
dbstate.db.get_source_bookmarks(),
SourceBookmarks, nav_group, SourceBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=SourceSidebarFilter) filter_class=SourceSidebarFilter)
@ -129,9 +128,6 @@ class SourceView(ListView):
def navigation_type(self): def navigation_type(self):
return 'Source' return 'Source'
def get_bookmarks(self):
return self.dbstate.db.get_source_bookmarks()
def drag_info(self): def drag_info(self):
return DdTargets.SOURCE_LINK return DdTargets.SOURCE_LINK