0006352: Bookmarking a source in the citation tree creates a blank bookmark. Disallow bookmarking a source in the Citation Tree View, and do not add sources to the history in the Citation Tree View.

svn: r22543
This commit is contained in:
Tim G L Lyons 2013-06-20 16:42:58 +00:00
parent 0be260b01d
commit eef147273c
2 changed files with 34 additions and 0 deletions

View File

@ -374,6 +374,29 @@ class CitationBookmarks(ListBookmarks) :
def make_label(self, handle):
return Utils.navigation_label(self.dbstate.db, 'Citation', handle)
# Override add from ListBookmarks, so that when self.bookmarks.add is called
# from ListView.add_bookmark, it will not add a Source bookmark to a
# Citation view.
def add(self, handle):
"""Append the citation to the bottom of the bookmarks."""
if self.dbstate.db.get_citation_from_handle(handle):
ListBookmarks.add(self, handle)
else:
# Probably trying to bookmark a source when the navigation type is
# citation. This can occur when in the Citation Tree View and we
# bookmark a source.
# FIXME: See http://www.gramps-project.org/bugs/view.php?id=6352 a
# more comprehensive solution is needed in the long term. See also
# change_active in CitatinTreeView
from QuestionDialog import WarningDialog
WarningDialog(_("Cannot bookmark this reference"),
"Only Citations can be bookmarked in this view. "
"You are probably trying to bookmark a Source in the "
"Citation Tree View. In this view, only Citations "
"can be bookmarked. To bookmark a Source, switch to "
"the Source View")
def connect_signals(self):
self.dbstate.db.connect('citation-delete', self.remove_handles)

View File

@ -154,6 +154,17 @@ class CitationTreeView(ListView):
self.additional_uis.append(self.additional_ui())
# Override change_active from NavigationView, so that only Citations can be
# put in the history list for the CitationTreeView
def change_active(self, handle):
if self.dbstate.db.get_citation_from_handle(handle):
super(CitationTreeView, self).change_active(handle)
else:
# FIXME: See http://www.gramps-project.org/bugs/view.php?id=6352 a
# more comprehensive solution is needed in the long term. See also
# add in Bookmarks.CitationBookmarks
pass
def setup_filter(self):
"""
Override the setup of the default Search Bar in listview, so that only