6780: Add privacy column to displaytabs

Extend to grouped displaytabs, and to specific family versions of tabs


svn: r22430
This commit is contained in:
Benny Malengier 2013-05-27 14:03:37 +00:00
parent facfeada47
commit a5700a28df
7 changed files with 43 additions and 27 deletions

View File

@ -48,7 +48,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, object)
str, str, str, str, str, str, str, bool, object)
self.db = db
for index, child_ref in enumerate(child_ref_list):
child = db.get_person_from_handle(child_ref.ref)
@ -67,6 +67,7 @@ class ChildModel(Gtk.ListStore):
name_displayer.sort_string(child.primary_name),
self.column_birth_sort(child),
self.column_death_sort(child),
child_ref.get_privacy(),
child_ref
])

View File

@ -86,7 +86,8 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
None,
None,
(_('Age'), EventRefModel.COL_SORTAGE[0], 60, TEXT_COL, -1, None),
None
None,
(_('Private'), EventRefModel.COL_PRIVATE[0], 30, ICON_COL, -1, 'gramps-lock')
]
def __init__(self, dbstate, uistate, track, obj, build_model=EventRefModel, **kwargs):
@ -196,6 +197,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
(1, 3), # date
(1, 9), # age
(1, 4), # place
(1, 11), # private
(1, 5), # role
)

View File

@ -80,9 +80,11 @@ class EventRefModel(Gtk.TreeStore):
COL_FONTWEIGHT = (8, int)
COL_AGE = (9, str)
COL_SORTAGE = (10, str)
COL_PRIVATE = (11, bool)
COLS = (COL_DESCR, COL_TYPE, COL_GID, COL_DATE, COL_PLACE, COL_ROLE,
COL_SORTDATE, COL_EVENTREF, COL_FONTWEIGHT, COL_AGE, COL_SORTAGE)
COL_SORTDATE, COL_EVENTREF, COL_FONTWEIGHT, COL_AGE, COL_SORTAGE,
COL_PRIVATE)
def __init__(self, event_list, db, groups, **kwargs):
"""
@ -107,7 +109,7 @@ class EventRefModel(Gtk.TreeStore):
def row_group(self, index, group):
name = self.namegroup(index, len(group))
return [name, '', '', '', '', '', '', (index, None), WEIGHT_BOLD, '', '']
return [name, '', '', '', '', '', '', (index, None), WEIGHT_BOLD, '', '', None]
def namegroup(self, groupindex, length):
return self._GROUPSTRING % {'groupname': self.groups[groupindex][1],
@ -125,6 +127,7 @@ class EventRefModel(Gtk.TreeStore):
self.colweight(index),
self.column_age(event),
self.column_sort_age(event),
eventref.get_privacy(),
]
def colweight(self, index):

View File

@ -33,6 +33,7 @@ _ = glocale.translation.gettext
# GRAMPS classes
#
#-------------------------------------------------------------------------
from .embeddedlist import TEXT_COL, MARKUP_COL, ICON_COL
from .ldsembedlist import LdsEmbedList
from gramps.gen.lib import LdsOrd
@ -43,17 +44,18 @@ from gramps.gen.lib import LdsOrd
#-------------------------------------------------------------------------
class FamilyLdsEmbedList(LdsEmbedList):
_HANDLE_COL = 5
_HANDLE_COL = 6
# _DND_TYPE = DdTargets.ADDRESS
#index = column in model. Value =
# (name, sortcol in model, width, markup/text, weigth_col
_column_names = [
(_('Type'), 0, 150, 0, -1),
(_('Date'), 1, 150, 1, -1),
(_('Status'), 3, 75, 0, -1),
(_('Temple'), 2, 200, 0, -1),
(_('Place'), 3, 100, 0, -1),
(_('Type'), 0, 150, TEXT_COL, -1, None),
(_('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')
]
def __init__(self, dbstate, uistate, track, data):

View File

@ -78,6 +78,7 @@ class NameEmbedList(GroupEmbeddedList):
(_('Group As'), NameModel.COL_GROUPAS[0],100, TEXT_COL, -1, None),
(_('Source'), NameModel.COL_HASSOURCE[0],60, TEXT_COL, -1, None),
(_('Notes Preview'), NameModel.COL_NOTEPREVIEW[0], 250, TEXT_COL, -1, None),
(_('Private'), NameModel.COL_PRIVATE[0], 30, ICON_COL, -1, 'gramps-lock')
]
def __init__(self, dbstate, uistate, track, data, person, callback):
@ -114,7 +115,7 @@ class NameEmbedList(GroupEmbeddedList):
The columns to show as a tuple of tuples containing
tuples (show/noshow, model column)
"""
return ((1, 0), (1, 1), (1, 4), (1, 5), (1, 6))
return ((1, 0), (1, 7), (1, 1), (1, 4), (1, 5), (1, 6))
def get_popup_menu_items(self):
if self._tmpgroup == self._WORKGROUP:

View File

@ -74,9 +74,10 @@ class NameModel(Gtk.TreeStore):
COL_GROUPAS = (4, str)
COL_HASSOURCE = (5, str)
COL_NOTEPREVIEW = (6, str)
COL_PRIVATE = (7, bool)
COLS = (COL_NAME, COL_TYPE, COL_DATA, COL_FONTWEIGHT, COL_GROUPAS,
COL_HASSOURCE, COL_NOTEPREVIEW)
COL_HASSOURCE, COL_NOTEPREVIEW, COL_PRIVATE)
def __init__(self, obj_list, db, groups):
"""
@ -98,7 +99,7 @@ class NameModel(Gtk.TreeStore):
def row_group(self, index, group):
name = self.namegroup(index, len(group))
return [name, '', (index, None), WEIGHT_NORMAL, '', '', '']
return [name, '', (index, None), WEIGHT_NORMAL, '', '', '', None]
def row(self, index, name):
"""
@ -111,7 +112,8 @@ class NameModel(Gtk.TreeStore):
self.colweight(index),
name.get_group_as(),
self.hassource(name),
self.notepreview(name)
self.notepreview(name),
name.get_privacy(),
]
def colweight(self, index):
if index == self.DEFINDEX:

View File

@ -79,7 +79,8 @@ from .editchildref import EditChildRef
from .editperson import EditPerson
from .displaytabs import (EmbeddedList, EventEmbedList, CitationEmbedList,
FamilyAttrEmbedList, NoteTab, GalleryTab,
FamilyLdsEmbedList, ChildModel)
FamilyLdsEmbedList, ChildModel,
TEXT_COL, MARKUP_COL, ICON_COL)
from ..widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
MonitoredTagList)
from gramps.gen.plug import CATEGORY_QR_FAMILY
@ -103,7 +104,7 @@ class ChildEmbedList(EmbeddedList):
is contained here instead of in displaytabs.
"""
_HANDLE_COL = 13
_HANDLE_COL = 14
_DND_TYPE = DdTargets.CHILDREF
_DND_EXTRA = DdTargets.PERSON_LINK
@ -118,16 +119,20 @@ class ChildEmbedList(EmbeddedList):
# (name, column in model, width, markup/text, font weight)
_column_names = [
(_('#'), 0, 25, 0, -1),
(_('ID'), 1, 60, 0, -1),
(_('Name'), 10, 250, 0, -1),
(_('Gender'), 3, 75, 0, -1),
(_('Paternal'), 4, 100, 0, -1),
(_('Maternal'), 5, 100, 0, -1),
(_('Birth Date'), 11, 150, 1, -1),
(_('Death Date'), 12, 150, 1, -1),
(_('Birth Place'), 8, 150, 0, -1),
(_('Death Place'), 9, 150, 0, -1),
(_('#'), 0, 25, TEXT_COL, -1, None),
(_('ID'), 1, 60, TEXT_COL, -1, None),
(_('Name'), 10, 250, TEXT_COL, -1, None),
(_('Gender'), 3, 75, TEXT_COL, -1, None),
(_('Paternal'), 4, 100, TEXT_COL, -1, None),
(_('Maternal'), 5, 100, TEXT_COL, -1, None),
(_('Birth Date'), 11, 150, MARKUP_COL, -1, None),
(_('Death Date'), 12, 150, MARKUP_COL, -1, None),
(_('Birth Place'), 8, 150, TEXT_COL, -1, None),
(_('Death Place'), 9, 150, TEXT_COL, -1, None),
None,
None,
None,
(_('Private'), 13, 30, ICON_COL, -1, 'gramps-lock')
]
def __init__(self, dbstate, uistate, track, family):
@ -165,7 +170,7 @@ class ChildEmbedList(EmbeddedList):
return self.family.get_child_ref_list()
def column_order(self):
return [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6),
return [(1, 13), (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):