Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source icon to edit dialogs #919

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions gramps/gen/lib/citationbase.py
Expand Up @@ -135,6 +135,12 @@ def get_citation_list(self):
"""
return self.citation_list

def has_citations(self):
"""
Return bool that indicates if citations/sources do exist for this object. True: Do exist, False: Do not exist.
"""
return bool(self.get_citation_list())

def get_all_citation_lists(self):
"""
Return the list of :class:`~.citation.Citation` handles associated with
Expand Down
7 changes: 4 additions & 3 deletions gramps/gui/editors/displaytabs/addrembedlist.py
Expand Up @@ -54,7 +54,7 @@ class AddrEmbedList(EmbeddedList):
Derives from the EmbeddedList class.
"""

_HANDLE_COL = 7
_HANDLE_COL = 8
_DND_TYPE = DdTargets.ADDRESS

_MSG = {
Expand All @@ -74,7 +74,8 @@ class AddrEmbedList(EmbeddedList):
(_('City'), 3, 100, TEXT_COL, -1, None),
(_('State/County'), 4, 100, TEXT_COL, -1, None),
(_('Country'), 5, 75, TEXT_COL, -1, None),
(_('Private'), 6, 30, ICON_COL, -1, 'gramps-lock')
(_('Source'), 6, 30, ICON_COL, -1, 'gramps-source'),
(_('Private'), 7, 30, ICON_COL, -1, 'gramps-lock'),
]

def __init__(self, dbstate, uistate, track, data):
Expand All @@ -98,7 +99,7 @@ def column_order(self):
"""
Return the column order of the columns in the display tab.
"""
return ((1,6), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5))
return ((1,6), (1, 7), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5))

def add_button_clicked(self, obj):
"""
Expand Down
3 changes: 2 additions & 1 deletion gramps/gui/editors/displaytabs/addressmodel.py
Expand Up @@ -50,7 +50,7 @@ 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, bool, object)
Gtk.ListStore.__init__(self, str, str, str, str, str, str, bool, bool, object)
self.db = dbase
for obj in obj_list:
self.append(row=[
Expand All @@ -60,6 +60,7 @@ def __init__(self, obj_list, dbase):
obj.city,
obj.state,
obj.country,
obj.has_citations(),
obj.get_privacy(),
obj,
])
7 changes: 4 additions & 3 deletions gramps/gui/editors/displaytabs/attrembedlist.py
Expand Up @@ -45,7 +45,7 @@
#-------------------------------------------------------------------------
class AttrEmbedList(EmbeddedList):

_HANDLE_COL = 3
_HANDLE_COL = 4
_DND_TYPE = DdTargets.ATTRIBUTE

_MSG = {
Expand All @@ -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):
Expand Down Expand Up @@ -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 = ''
Expand Down
4 changes: 2 additions & 2 deletions gramps/gui/editors/displaytabs/attrmodel.py
Expand Up @@ -24,7 +24,6 @@
#
#-------------------------------------------------------------------------
from gi.repository import Gtk

#-------------------------------------------------------------------------
#
# Gramps classes
Expand All @@ -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,
])
3 changes: 2 additions & 1 deletion gramps/gui/editors/displaytabs/childmodel.py
Expand Up @@ -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)
Expand All @@ -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
])
Expand Down
4 changes: 3 additions & 1 deletion gramps/gui/editors/displaytabs/eventembedlist.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions gramps/gui/editors/displaytabs/eventrefmodel.py
Expand Up @@ -83,10 +83,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):
"""
Expand All @@ -113,7 +114,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],
Expand All @@ -133,6 +134,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):
Expand Down
7 changes: 4 additions & 3 deletions gramps/gui/editors/displaytabs/familyldsembedlist.py
Expand Up @@ -42,7 +42,7 @@
#-------------------------------------------------------------------------
class FamilyLdsEmbedList(LdsEmbedList):

_HANDLE_COL = 6
_HANDLE_COL = 7
# _DND_TYPE = DdTargets.ADDRESS

#index = column in model. Value =
Expand All @@ -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):
Expand Down
9 changes: 5 additions & 4 deletions gramps/gui/editors/displaytabs/ldsembedlist.py
Expand Up @@ -44,7 +44,7 @@
#-------------------------------------------------------------------------
class LdsEmbedList(EmbeddedList):

_HANDLE_COL = 6
_HANDLE_COL = 7
# _DND_TYPE = DdTargets.ADDRESS

_MSG = {
Expand All @@ -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):
Expand All @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions gramps/gui/editors/displaytabs/ldsmodel.py
Expand Up @@ -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=[
Expand All @@ -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,
])
4 changes: 2 additions & 2 deletions gramps/gui/editors/displaytabs/nameembedlist.py
Expand Up @@ -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')
]
Expand Down Expand Up @@ -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:
Expand Down
9 changes: 2 additions & 7 deletions gramps/gui/editors/displaytabs/namemodel.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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(),
]
Expand All @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions gramps/gui/editors/editfamily.py
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down