diff --git a/gramps/gen/lib/citationbase.py b/gramps/gen/lib/citationbase.py index 1d0767ae7c7..f69d5111e19 100644 --- a/gramps/gen/lib/citationbase.py +++ b/gramps/gen/lib/citationbase.py @@ -135,6 +135,15 @@ def get_citation_list(self): """ return self.citation_list + def has_citations(self): + """ + Return True if citations exist for this object. + + :returns: Returns whether citations exist for this object. + :rtype: bool + """ + return bool(self.get_citation_list()) + def get_all_citation_lists(self): """ Return the list of :class:`~.citation.Citation` handles associated with diff --git a/gramps/gui/editors/displaytabs/addrembedlist.py b/gramps/gui/editors/displaytabs/addrembedlist.py index 53bd97c9eb9..571c1962969 100644 --- a/gramps/gui/editors/displaytabs/addrembedlist.py +++ b/gramps/gui/editors/displaytabs/addrembedlist.py @@ -54,7 +54,7 @@ class AddrEmbedList(EmbeddedList): Derives from the EmbeddedList class. """ - _HANDLE_COL = 9 + _HANDLE_COL = 10 _DND_TYPE = DdTargets.ADDRESS _MSG = { @@ -76,7 +76,8 @@ class AddrEmbedList(EmbeddedList): (_('Country'), 5, 75, TEXT_COL, -1, None), (_("Postal"), 6, 75, TEXT_COL, -1, None), (_("Phone"), 7, 150, TEXT_COL, -1, None), - (_('Private'), 8, 30, ICON_COL, -1, 'gramps-lock') + (_('Source'), 8, 30, ICON_COL, -1, 'gramps-source'), + (_('Private'), 9, 30, ICON_COL, -1, 'gramps-lock'), ] def __init__(self, dbstate, uistate, track, data): @@ -100,7 +101,7 @@ def column_order(self): """ Return the column order of the columns in the display tab. """ - return ((1,8), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7)) + return ((1, 8), (1, 9), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7)) def add_button_clicked(self, obj): """ diff --git a/gramps/gui/editors/displaytabs/addressmodel.py b/gramps/gui/editors/displaytabs/addressmodel.py index 2c1a810638b..5507c825c22 100644 --- a/gramps/gui/editors/displaytabs/addressmodel.py +++ b/gramps/gui/editors/displaytabs/addressmodel.py @@ -50,7 +50,8 @@ def __init__(self, obj_list, dbase): """ AddressModel derives from the ListStore, defining te items in the list """ - Gtk.ListStore.__init__(self, str, str, str, str, str, str, str, str, bool, object) + Gtk.ListStore.__init__(self, str, str, str, str, str, str, str, str, + bool, bool, object) self.db = dbase for obj in obj_list: self.append(row=[ @@ -62,6 +63,7 @@ def __init__(self, obj_list, dbase): obj.country, obj.postal, obj.phone, + obj.has_citations(), obj.get_privacy(), obj, ]) diff --git a/gramps/gui/editors/displaytabs/attrembedlist.py b/gramps/gui/editors/displaytabs/attrembedlist.py index c73deeb83ef..f8aa47c0055 100644 --- a/gramps/gui/editors/displaytabs/attrembedlist.py +++ b/gramps/gui/editors/displaytabs/attrembedlist.py @@ -45,7 +45,7 @@ #------------------------------------------------------------------------- class AttrEmbedList(EmbeddedList): - _HANDLE_COL = 3 + _HANDLE_COL = 4 _DND_TYPE = DdTargets.ATTRIBUTE _MSG = { @@ -61,7 +61,8 @@ class AttrEmbedList(EmbeddedList): _column_names = [ (_('Type'), 0, 250, TEXT_COL, -1, None), (_('Value'), 1, 200, TEXT_COL, -1, None), - (_('Private'), 2, 30, ICON_COL, -1, 'gramps-lock') + (_('Source'), 2, 30, ICON_COL, -1, 'gramps-source'), + (_('Private'), 3, 30, ICON_COL, -1, 'gramps-lock'), ] def __init__(self, dbstate, uistate, track, data): @@ -89,7 +90,7 @@ def get_data(self): return self.data def column_order(self): - return ((1, 2), (1, 0), (1, 1)) + return ((1, 2), (1, 3), (1, 0), (1, 1)) def add_button_clicked(self, obj): pname = '' diff --git a/gramps/gui/editors/displaytabs/attrmodel.py b/gramps/gui/editors/displaytabs/attrmodel.py index d44980e888b..5fe6a57b3e4 100644 --- a/gramps/gui/editors/displaytabs/attrmodel.py +++ b/gramps/gui/editors/displaytabs/attrmodel.py @@ -24,7 +24,6 @@ # #------------------------------------------------------------------------- from gi.repository import Gtk - #------------------------------------------------------------------------- # # Gramps classes @@ -40,12 +39,13 @@ class AttrModel(Gtk.ListStore): def __init__(self, attr_list, db): - Gtk.ListStore.__init__(self, str, str, bool, object) + Gtk.ListStore.__init__(self, str, str, bool, bool, object) self.db = db for attr in attr_list: self.append(row=[ str(attr.get_type()), attr.get_value(), + attr.has_citations(), attr.get_privacy(), attr, ]) diff --git a/gramps/gui/editors/displaytabs/childmodel.py b/gramps/gui/editors/displaytabs/childmodel.py index 0c204021871..ca289e9d339 100644 --- a/gramps/gui/editors/displaytabs/childmodel.py +++ b/gramps/gui/editors/displaytabs/childmodel.py @@ -47,7 +47,7 @@ class ChildModel(Gtk.ListStore): def __init__(self, child_ref_list, db): Gtk.ListStore.__init__(self, int, str, str, str, str, str, - str, str, str, str, str, str, str, bool, object) + str, str, str, str, str, str, str, bool, bool, object) self.db = db for index, child_ref in enumerate(child_ref_list): child = db.get_person_from_handle(child_ref.ref) @@ -66,6 +66,7 @@ def __init__(self, child_ref_list, db): name_displayer.sort_string(child.primary_name), self.column_birth_sort(child), self.column_death_sort(child), + child_ref.has_citations(), child_ref.get_privacy(), child_ref ]) diff --git a/gramps/gui/editors/displaytabs/eventembedlist.py b/gramps/gui/editors/displaytabs/eventembedlist.py index 6255238ebc0..87373a798bf 100644 --- a/gramps/gui/editors/displaytabs/eventembedlist.py +++ b/gramps/gui/editors/displaytabs/eventembedlist.py @@ -87,7 +87,8 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList): None, (_('Age'), EventRefModel.COL_SORTAGE[0], 60, TEXT_COL, -1, None), None, - (_('Private'), EventRefModel.COL_PRIVATE[0], 30, ICON_COL, -1, 'gramps-lock') + (_('Private'), EventRefModel.COL_PRIVATE[0], 30, ICON_COL, -1, 'gramps-lock'), + (_('Source'), EventRefModel.COL_HAS_SOURCE[0], 30, ICON_COL, -1, 'gramps-source'), ] def __init__(self, dbstate, uistate, track, obj, build_model=EventRefModel, **kwargs): @@ -196,6 +197,7 @@ def column_order(self): (1, 3), # date (1, 4), # place (1, 6), # main participants + (1, 13), # has source (1, 12), # private (1, 5), # role (1, 2), # gramps id diff --git a/gramps/gui/editors/displaytabs/eventrefmodel.py b/gramps/gui/editors/displaytabs/eventrefmodel.py index 92886a3b931..b6dc1b21e55 100644 --- a/gramps/gui/editors/displaytabs/eventrefmodel.py +++ b/gramps/gui/editors/displaytabs/eventrefmodel.py @@ -84,10 +84,11 @@ class EventRefModel(Gtk.TreeStore): COL_AGE = (10, str) COL_SORTAGE = (11, str) COL_PRIVATE = (12, bool) + COL_HAS_SOURCE = (13, bool) COLS = (COL_DESCR, COL_TYPE, COL_GID, COL_DATE, COL_PLACE, COL_ROLE, COL_PARTIC, COL_SORTDATE, COL_EVENTREF, COL_FONTWEIGHT, COL_AGE, - COL_SORTAGE, COL_PRIVATE) + COL_SORTAGE, COL_PRIVATE, COL_HAS_SOURCE) def __init__(self, event_list, db, groups, **kwargs): """ @@ -114,7 +115,7 @@ def row_group(self, index, group): name = self.namegroup(index, len(group)) spouse = self.groups[index][2] return [spouse, name, '', '', '', '', '', '', (index, None), - WEIGHT_BOLD, '', '', None] + WEIGHT_BOLD, '', '', None, None] def namegroup(self, groupindex, length): return self._GROUPSTRING % {'groupname': self.groups[groupindex][1], @@ -134,6 +135,7 @@ def row(self, index, eventref, event): self.column_age(event), self.column_sort_age(event), eventref.get_privacy(), + event.has_citations(), ] def colweight(self, index): diff --git a/gramps/gui/editors/displaytabs/familyldsembedlist.py b/gramps/gui/editors/displaytabs/familyldsembedlist.py index 940a30429ef..05172691797 100644 --- a/gramps/gui/editors/displaytabs/familyldsembedlist.py +++ b/gramps/gui/editors/displaytabs/familyldsembedlist.py @@ -42,7 +42,7 @@ #------------------------------------------------------------------------- class FamilyLdsEmbedList(LdsEmbedList): - _HANDLE_COL = 6 + _HANDLE_COL = 7 # _DND_TYPE = DdTargets.ADDRESS #index = column in model. Value = @@ -52,8 +52,9 @@ class FamilyLdsEmbedList(LdsEmbedList): (_('Date'), 1, 150, MARKUP_COL, -1, None), (_('Status'), 3, 75, TEXT_COL, -1, None), (_('Temple'), 2, 200, TEXT_COL, -1, None), - (_('Place'), 3, 100, TEXT_COL, -1, None), - (_('Private'), 5, 30, ICON_COL, -1, 'gramps-lock') + (_('Place'), 4, 100, TEXT_COL, -1, None), + (_('Source'), 5, 30, ICON_COL, -1, 'gramps-source'), + (_('Private'), 6, 30, ICON_COL, -1, 'gramps-lock'), ] def __init__(self, dbstate, uistate, track, data): diff --git a/gramps/gui/editors/displaytabs/ldsembedlist.py b/gramps/gui/editors/displaytabs/ldsembedlist.py index 95c8c995741..8498ea2fda1 100644 --- a/gramps/gui/editors/displaytabs/ldsembedlist.py +++ b/gramps/gui/editors/displaytabs/ldsembedlist.py @@ -44,7 +44,7 @@ #------------------------------------------------------------------------- class LdsEmbedList(EmbeddedList): - _HANDLE_COL = 6 + _HANDLE_COL = 7 # _DND_TYPE = DdTargets.ADDRESS _MSG = { @@ -62,8 +62,9 @@ class LdsEmbedList(EmbeddedList): (_('Date'), 1, 150, MARKUP_COL, -1, None), (_('Status'), 3, 75, TEXT_COL, -1, None), (_('Temple'), 2, 200, TEXT_COL, -1, None), - (_('Place'), 3, 100, TEXT_COL, -1, None), - (_('Private'), 5, 30, ICON_COL, -1, 'gramps-lock') + (_('Place'), 4, 100, TEXT_COL, -1, None), + (_('Source'), 5, 30, ICON_COL, -1, 'gramps-source'), + (_('Private'), 6, 30, ICON_COL, -1, 'gramps-lock'), ] def __init__(self, dbstate, uistate, track, data): @@ -82,7 +83,7 @@ def get_data(self): return self.data def column_order(self): - return ((1, 5), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4)) + return ((1, 5), (1, 6), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4)) def add_button_clicked(self, obj): try: diff --git a/gramps/gui/editors/displaytabs/ldsmodel.py b/gramps/gui/editors/displaytabs/ldsmodel.py index e65b8bd967d..045bf5ffc66 100644 --- a/gramps/gui/editors/displaytabs/ldsmodel.py +++ b/gramps/gui/editors/displaytabs/ldsmodel.py @@ -47,10 +47,10 @@ #------------------------------------------------------------------------- class LdsModel(Gtk.ListStore): - _HANDLE_COL = 5 + _HANDLE_COL = 6 def __init__(self, lds_list, db): - Gtk.ListStore.__init__(self, str, str, str, str, str, bool, object) + Gtk.ListStore.__init__(self, str, str, str, str, str, bool, bool, object) for lds_ord in lds_list: self.append(row=[ @@ -59,6 +59,7 @@ def __init__(self, lds_list, db): lds_ord.status2str(), TEMPLES.name(lds_ord.get_temple()), place_displayer.display_event(db, lds_ord), + lds_ord.has_citations(), lds_ord.get_privacy(), lds_ord, ]) diff --git a/gramps/gui/editors/displaytabs/nameembedlist.py b/gramps/gui/editors/displaytabs/nameembedlist.py index a33efd452ec..e4d023e43e6 100644 --- a/gramps/gui/editors/displaytabs/nameembedlist.py +++ b/gramps/gui/editors/displaytabs/nameembedlist.py @@ -75,7 +75,7 @@ class NameEmbedList(GroupEmbeddedList): None, None, (_('Group As'), NameModel.COL_GROUPAS[0],100, TEXT_COL, -1, None), - (_('Source'), NameModel.COL_HASSOURCE[0],60, TEXT_COL, -1, None), + (_('Source'), NameModel.COL_HASSOURCE[0],30, ICON_COL, -1, "gramps-source"), (_('Notes Preview'), NameModel.COL_NOTEPREVIEW[0], 250, TEXT_COL, -1, None), (_('Private'), NameModel.COL_PRIVATE[0], 30, ICON_COL, -1, 'gramps-lock') ] @@ -114,7 +114,7 @@ def column_order(self): The columns to show as a tuple of tuples containing tuples (show/noshow, model column) """ - return ((1, 0), (1, 7), (1, 1), (1, 4), (1, 5), (1, 6)) + return ((1, 0), (1, 5), (1, 7), (1, 1), (1, 4), (1, 6)) def get_popup_menu_items(self): if self._tmpgroup == self._WORKGROUP: diff --git a/gramps/gui/editors/displaytabs/namemodel.py b/gramps/gui/editors/displaytabs/namemodel.py index c230157074b..64b67555630 100644 --- a/gramps/gui/editors/displaytabs/namemodel.py +++ b/gramps/gui/editors/displaytabs/namemodel.py @@ -70,7 +70,7 @@ class NameModel(Gtk.TreeStore): COL_DATA = (2, object) COL_FONTWEIGHT = (3, int) COL_GROUPAS = (4, str) - COL_HASSOURCE = (5, str) + COL_HASSOURCE = (5, bool) COL_NOTEPREVIEW = (6, str) COL_PRIVATE = (7, bool) @@ -109,7 +109,7 @@ def row(self, index, name): (index, name), self.colweight(index), name.get_group_as(), - self.hassource(name), + name.has_citations(), self.notepreview(name), name.get_privacy(), ] @@ -134,11 +134,6 @@ def update_defname(self, defname): self.insert(self.get_iter(self.DEFINDEX), 0, row=self.row(self.DEFINDEX, defname)) - def hassource(self, name): - if len(name.get_citation_list()): - return YES - return NO - def notepreview(self, name): nlist = name.get_note_list() if nlist: diff --git a/gramps/gui/editors/displaytabs/personrefembedlist.py b/gramps/gui/editors/displaytabs/personrefembedlist.py index 12486bac61f..5f8f73c8d85 100644 --- a/gramps/gui/editors/displaytabs/personrefembedlist.py +++ b/gramps/gui/editors/displaytabs/personrefembedlist.py @@ -48,7 +48,7 @@ #------------------------------------------------------------------------- class PersonRefEmbedList(DbGUIElement, EmbeddedList): - _HANDLE_COL = 4 + _HANDLE_COL = 5 _DND_TYPE = DdTargets.PERSONREF _DND_EXTRA = DdTargets.PERSON_LINK @@ -66,7 +66,8 @@ class PersonRefEmbedList(DbGUIElement, EmbeddedList): (_('Name'), 0, 250, TEXT_COL, -1, None), (_('ID'), 1, 100, TEXT_COL, -1, None), (_('Association'), 2, 100, TEXT_COL, -1, None), - (_('Private'), 3, 30, ICON_COL, -1, 'gramps-lock') + (_('Source'), 3, 30, ICON_COL, -1, 'gramps-source'), + (_('Private'), 4, 30, ICON_COL, -1, 'gramps-lock') ] def __init__(self, dbstate, uistate, track, data): @@ -129,7 +130,7 @@ def get_data(self): return self.data def column_order(self): - return ((1,3), (1, 0), (1, 1), (1, 2)) + return ((1, 3), (1, 4), (1, 0), (1, 1), (1, 2)) def add_button_clicked(self, obj): from .. import EditPersonRef diff --git a/gramps/gui/editors/displaytabs/personrefmodel.py b/gramps/gui/editors/displaytabs/personrefmodel.py index 2ce168890d1..a10b3ae40d9 100644 --- a/gramps/gui/editors/displaytabs/personrefmodel.py +++ b/gramps/gui/editors/displaytabs/personrefmodel.py @@ -40,13 +40,13 @@ class PersonRefModel(Gtk.ListStore): def __init__(self, obj_list, db): - Gtk.ListStore.__init__(self, str, str, str, bool, object) + Gtk.ListStore.__init__(self, str, str, str, bool, bool, object) self.db = db for obj in obj_list: p = self.db.get_person_from_handle(obj.ref) if p: data = [name_displayer.display(p), p.gramps_id, obj.rel, - obj.get_privacy(), obj] + obj.has_citations(), obj.get_privacy(), obj] else: data = ['unknown','unknown', obj.rel, obj.get_privacy(), obj] self.append(row=data) diff --git a/gramps/gui/editors/editfamily.py b/gramps/gui/editors/editfamily.py index dda6d3bc65d..f1a1dc85b84 100644 --- a/gramps/gui/editors/editfamily.py +++ b/gramps/gui/editors/editfamily.py @@ -105,7 +105,7 @@ class ChildEmbedList(DbGUIElement, EmbeddedList): is contained here instead of in displaytabs. """ - _HANDLE_COL = 14 + _HANDLE_COL = 15 _DND_TYPE = DdTargets.CHILDREF _DND_EXTRA = DdTargets.PERSON_LINK @@ -133,7 +133,8 @@ class ChildEmbedList(DbGUIElement, EmbeddedList): None, None, None, - (_('Private'), 13, 30, ICON_COL, -1, 'gramps-lock') + (_('Source'), 13, 30, ICON_COL, -1, 'gramps-source'), + (_('Private'), 14, 30, ICON_COL, -1, 'gramps-lock'), ] def __init__(self, dbstate, uistate, track, family): @@ -216,7 +217,7 @@ def get_data(self): return prefs def column_order(self): - return [(1, 13), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), + return [(1, 13), (1, 14), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (0, 8), (0, 9)] def add_button_clicked(self, obj=None):