diff --git a/src/gui/selectors/selectcitation.py b/src/gui/selectors/selectcitation.py index 26ae86cfc..f7146806c 100644 --- a/src/gui/selectors/selectcitation.py +++ b/src/gui/selectors/selectcitation.py @@ -68,10 +68,10 @@ class SelectCitation(BaseSelector): ] def get_from_handle_func(self): - return self.db.get_citation_from_handle - - def get_from_handle_func2(self): return self.db.get_source_from_handle + def get_from_handle_func2(self): + return self.db.get_citation_from_handle + def get_handle_column(self): - return 11 + return 8 diff --git a/src/gui/views/treemodels/citationbasemodel.py b/src/gui/views/treemodels/citationbasemodel.py index 18071f3c6..70888c760 100644 --- a/src/gui/views/treemodels/citationbasemodel.py +++ b/src/gui/views/treemodels/citationbasemodel.py @@ -112,6 +112,9 @@ class CitationBaseModel(object): def citation_sort_change(self, data): return "%012x" % data[COLUMN_CHANGE] + def citation_source(self, data): + return data[COLUMN_SOURCE] + def citation_src_title(self, data): source_handle = data[COLUMN_SOURCE] try: diff --git a/src/gui/views/treemodels/citationlistmodel.py b/src/gui/views/treemodels/citationlistmodel.py index dc68403de..61538d493 100644 --- a/src/gui/views/treemodels/citationlistmodel.py +++ b/src/gui/views/treemodels/citationlistmodel.py @@ -21,7 +21,7 @@ # $Id$ """ -CitationBaseModel, CitationListModel and CitationTreeModel classes for GRAMPS. +CitationListModel class for GRAMPS. """ #------------------------------------------------------------------------- diff --git a/src/gui/views/treemodels/citationtreemodel.py b/src/gui/views/treemodels/citationtreemodel.py index 047f7cb4b..0f45fe9c6 100644 --- a/src/gui/views/treemodels/citationtreemodel.py +++ b/src/gui/views/treemodels/citationtreemodel.py @@ -168,9 +168,6 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel): citation_page = citation.get_page() self.add_node(handle, citation_handle, citation_page, citation_handle, secondary=True) - - - # try: # source_handle = data[COLUMN_SOURCE] # except: @@ -190,6 +187,14 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel): # unicode(data[COLUMN_PAGE]), # exc_info=True) + def add_secondary_row(self, handle, data): + """ + Add a secondary node to the node map for a citation. + """ + # parameters are parent, child, sortkey, handle + self.add_node(self.citation_source(data), handle, + self.citation_page(data), handle, secondary=True) + def on_get_n_columns(self): return len(self.fmap)+1 diff --git a/src/gui/views/treemodels/treebasemodel.py b/src/gui/views/treemodels/treebasemodel.py index c9c4df51d..376203fbe 100644 --- a/src/gui/views/treemodels/treebasemodel.py +++ b/src/gui/views/treemodels/treebasemodel.py @@ -680,7 +680,10 @@ class TreeBaseModel(gtk.GenericTreeModel): (self.search and self.search.match(handle, self.db)): #row needs to be added to the model data = self.map(handle) - self.add_row(handle, data) + if data: + self.add_row(handle, data) + else: + self.add_secondary_row(handle, self.map2(handle)) _LOG.debug(self.__class__.__name__ + ' add_row_by_handle ' + str(time.clock() - cput) + ' sec') diff --git a/src/plugins/lib/libcitationview.py b/src/plugins/lib/libcitationview.py index ca658aeb5..a5501f5ac 100644 --- a/src/plugins/lib/libcitationview.py +++ b/src/plugins/lib/libcitationview.py @@ -73,18 +73,8 @@ class BaseCitationView(ListView): # The configuration parameters have been moved to CitationTreeView and # CitationListView, because they differ for the two different views. - def __init__(self, pdata, dbstate, uistate, title, model, nav_group=0): - - signal_map = { - 'citation-add' : self.row_add, - 'citation-update' : self.row_update, - 'citation-delete' : self.row_delete, - 'citation-rebuild' : self.object_build, - 'source-add' : self.row_add, - 'source-update' : self.row_update, - 'source-delete' : self.row_delete, - 'source-rebuild' : self.object_build, - } + def __init__(self, pdata, dbstate, uistate, title, model, signal_map, + nav_group=0): ListView.__init__( self, title, pdata, dbstate, uistate, @@ -430,7 +420,7 @@ class BaseCitationView(ListView): """ Define the default gramplets for the sidebar and bottombar. """ - return (("Source Filter",), + return (("Citation Filter",), ("Citation Gallery", "Citation Notes", "Citation Backlinks")) diff --git a/src/plugins/view/citationlistview.py b/src/plugins/view/citationlistview.py index ff0ea4bc4..aac842892 100644 --- a/src/plugins/view/citationlistview.py +++ b/src/plugins/view/citationlistview.py @@ -50,9 +50,12 @@ from gen.ggettext import gettext as _ class CitationListView(BaseCitationView): """ A list view of citations. + + The citation list view only shows the citations (it does not show + sources as separate list entries). """ # The data items here have to correspond, in order, to the items in - # src/giu.views/treemodels/citationlistmodel.py + # src/giu.views/treemodels/citationlismodel.py COL_TITLE_PAGE = 0 COL_ID = 1 COL_DATE = 2 @@ -99,7 +102,16 @@ class CitationListView(BaseCitationView): QR_CATEGORY = CATEGORY_QR_SOURCE def __init__(self, pdata, dbstate, uistate, nav_group=0): + + signal_map = { + 'citation-add' : self.row_add, + 'citation-update' : self.row_update, + 'citation-delete' : self.row_delete, + 'citation-rebuild' : self.object_build, + } + BaseCitationView.__init__(self, pdata, dbstate, uistate, _('Citation View'), CitationListModel, + signal_map, nav_group=nav_group) diff --git a/src/plugins/view/citationtreeview.py b/src/plugins/view/citationtreeview.py index 1cf89ef94..75fff2772 100644 --- a/src/plugins/view/citationtreeview.py +++ b/src/plugins/view/citationtreeview.py @@ -98,8 +98,20 @@ class CitationTreeView(BaseCitationView): def __init__(self, pdata, dbstate, uistate, nav_group=0): + signal_map = { + 'citation-add' : self.row_add, + 'citation-update' : self.row_update, + 'citation-delete' : self.row_delete, + 'citation-rebuild' : self.object_build, + 'source-add' : self.row_add, + 'source-update' : self.row_update, + 'source-delete' : self.row_delete, + 'source-rebuild' : self.object_build, + } + BaseCitationView.__init__(self, pdata, dbstate, uistate, _('Citation Tree View'), CitationTreeModel, + signal_map, nav_group=nav_group) def type_list(self):