7342: Update column order in editor event tabs
This commit is contained in:
parent
9645892b5e
commit
c0ffe802bd
@ -52,14 +52,14 @@ from ...selectors import SelectorFactory
|
||||
#-------------------------------------------------------------------------
|
||||
class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
|
||||
_HANDLE_COL = 7
|
||||
_HANDLE_COL = 8
|
||||
_DND_TYPE = DdTargets.EVENTREF
|
||||
_DND_EXTRA = DdTargets.EVENT
|
||||
_WORKGROUP = EventRefModel._ROOTINDEX
|
||||
|
||||
_WORKNAME = _("Family Events")
|
||||
_FATHNAME = _("Events father")
|
||||
_MOTHNAME = _("Events mother")
|
||||
_WORKNAME = _("Family")
|
||||
_FATHNAME = _("Father")
|
||||
_MOTHNAME = _("Mother")
|
||||
|
||||
_MSG = {
|
||||
'add' : _('Add a new family event'),
|
||||
@ -73,15 +73,15 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
#index = column in model. Value =
|
||||
# (name, sortcol in model, width, markup/text, weigth_col
|
||||
_column_names = [
|
||||
(_('Description'), -1, 240, TEXT_COL,
|
||||
EventRefModel.COL_FONTWEIGHT[0], None),
|
||||
(_('Type'), EventRefModel.COL_TYPE[0], 100, TEXT_COL,
|
||||
EventRefModel.COL_FONTWEIGHT[0], None),
|
||||
(_('ID'), EventRefModel.COL_GID[0], 60, TEXT_COL,
|
||||
EventRefModel.COL_FONTWEIGHT[0], None),
|
||||
(_('Description'), EventRefModel.COL_DESCR[0], 150, TEXT_COL, -1, None),
|
||||
(_('Type'), EventRefModel.COL_TYPE[0], 120, TEXT_COL,
|
||||
EventRefModel.COL_FONTWEIGHT[0], None),
|
||||
(_('ID'), EventRefModel.COL_GID[0], 60, TEXT_COL, -1, None),
|
||||
(_('Date'), EventRefModel.COL_SORTDATE[0], 150, MARKUP_COL, -1, None),
|
||||
(_('Place'), EventRefModel.COL_PLACE[0], 150, TEXT_COL, -1, None),
|
||||
(_('Place'), EventRefModel.COL_PLACE[0], 240, 0, -1, None),
|
||||
(_('Role'), EventRefModel.COL_ROLE[0], 80, TEXT_COL, -1, None),
|
||||
(_('Main Participants'), EventRefModel.COL_PARTIC[0], 240, TEXT_COL,
|
||||
EventRefModel.COL_FONTWEIGHT[0], None),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
@ -155,14 +155,14 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
#family events
|
||||
if not self._data or self.changed:
|
||||
self._data = [self.obj.get_event_ref_list()]
|
||||
self._groups = [(self.obj.get_handle(), self._WORKNAME)]
|
||||
self._groups = [(self.obj.get_handle(), self._WORKNAME, '')]
|
||||
#father events
|
||||
fhandle = self.obj.get_father_handle()
|
||||
if fhandle:
|
||||
fdata = self.dbstate.db.get_person_from_handle(fhandle).\
|
||||
get_event_ref_list()
|
||||
if fdata:
|
||||
self._groups.append((fhandle, self._FATHNAME))
|
||||
self._groups.append((fhandle, self._FATHNAME, ''))
|
||||
self._data.append(fdata)
|
||||
#mother events
|
||||
mhandle = self.obj.get_mother_handle()
|
||||
@ -170,7 +170,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
mdata = self.dbstate.db.get_person_from_handle(mhandle).\
|
||||
get_event_ref_list()
|
||||
if mdata:
|
||||
self._groups.append((mhandle, self._MOTHNAME))
|
||||
self._groups.append((mhandle, self._MOTHNAME, ''))
|
||||
self._data.append(mdata)
|
||||
#we register all events that need to be tracked
|
||||
for group in self._data:
|
||||
@ -191,14 +191,15 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
The columns to show as a tuple containing
|
||||
tuples (show/noshow, model column)
|
||||
"""
|
||||
return ((1, 0), # desc
|
||||
(1, 1), # type
|
||||
(1, 2), # gid
|
||||
return ((1, 1), # type
|
||||
(1, 6), # main participants
|
||||
(1, 3), # date
|
||||
(1, 9), # age
|
||||
(1, 4), # place
|
||||
(1, 11), # private
|
||||
(1, 0), # description
|
||||
(1, 12), # private
|
||||
(1, 5), # role
|
||||
(1, 2), # gramps id
|
||||
(1, 10), # age
|
||||
)
|
||||
|
||||
def default_types(self):
|
||||
|
@ -48,8 +48,10 @@ import cgi
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ...widgets.undoablebuffer import UndoableBuffer
|
||||
from gramps.gen.lib import EventRoleType
|
||||
from gramps.gen.datehandler import get_date, get_date_valid
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.utils.db import get_participant_from_event
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -75,16 +77,17 @@ class EventRefModel(Gtk.TreeStore):
|
||||
COL_DATE = (3, str)
|
||||
COL_PLACE = (4, str)
|
||||
COL_ROLE = (5, str)
|
||||
COL_SORTDATE = (6, str)
|
||||
COL_EVENTREF = (7, object)
|
||||
COL_FONTWEIGHT = (8, int)
|
||||
COL_AGE = (9, str)
|
||||
COL_SORTAGE = (10, str)
|
||||
COL_PRIVATE = (11, bool)
|
||||
COL_PARTIC = (6, str)
|
||||
COL_SORTDATE = (7, str)
|
||||
COL_EVENTREF = (8, object)
|
||||
COL_FONTWEIGHT = (9, int)
|
||||
COL_AGE = (10, str)
|
||||
COL_SORTAGE = (11, str)
|
||||
COL_PRIVATE = (12, 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_PRIVATE)
|
||||
COL_PARTIC, COL_SORTDATE, COL_EVENTREF, COL_FONTWEIGHT, COL_AGE,
|
||||
COL_SORTAGE, COL_PRIVATE)
|
||||
|
||||
def __init__(self, event_list, db, groups, **kwargs):
|
||||
"""
|
||||
@ -109,7 +112,9 @@ class EventRefModel(Gtk.TreeStore):
|
||||
|
||||
def row_group(self, index, group):
|
||||
name = self.namegroup(index, len(group))
|
||||
return [name, '', '', '', '', '', '', (index, None), WEIGHT_BOLD, '', '', None]
|
||||
spouse = self.groups[index][2]
|
||||
return ['', name, '', '', '', '', spouse, '', (index, None),
|
||||
WEIGHT_BOLD, '', '', None]
|
||||
|
||||
def namegroup(self, groupindex, length):
|
||||
return self._GROUPSTRING % {'groupname': self.groups[groupindex][1],
|
||||
@ -122,6 +127,7 @@ class EventRefModel(Gtk.TreeStore):
|
||||
self.column_date(eventref),
|
||||
self.column_place(eventref),
|
||||
self.column_role(eventref),
|
||||
self.column_participant(eventref),
|
||||
self.column_sort_date(eventref),
|
||||
(index, eventref),
|
||||
self.colweight(index),
|
||||
@ -161,6 +167,13 @@ class EventRefModel(Gtk.TreeStore):
|
||||
return self.db.get_place_from_handle(place_handle).get_title()
|
||||
return ""
|
||||
|
||||
def column_participant(self, event_ref):
|
||||
if int(event_ref.get_role()) not in (EventRoleType.PRIMARY,
|
||||
EventRoleType.FAMILY):
|
||||
return get_participant_from_event(self.db, event_ref.ref)
|
||||
else:
|
||||
return ""
|
||||
|
||||
def column_age(self, event):
|
||||
"""
|
||||
Returns a string representation of age in years. Change
|
||||
|
@ -48,8 +48,9 @@ from gramps.gen.errors import WindowActiveError
|
||||
#-------------------------------------------------------------------------
|
||||
class PersonEventEmbedList(EventEmbedList):
|
||||
|
||||
_WORKNAME = _("Personal Events")
|
||||
_FAMNAME = _("With %(namepartner)s (%(famid)s)")
|
||||
_WORKNAME = _("Personal")
|
||||
#_FAMNAME = _("With %(namepartner)s (%(famid)s)")
|
||||
_FAMNAME = _("Family")
|
||||
_UNKNOWNNAME = _("<Unknown>")
|
||||
|
||||
_MSG = {
|
||||
@ -69,7 +70,7 @@ class PersonEventEmbedList(EventEmbedList):
|
||||
def get_data(self):
|
||||
if not self._data or self.changed:
|
||||
self._data = [self.obj.get_event_ref_list()]
|
||||
self._groups = [(self.obj.get_handle(), self._WORKNAME)]
|
||||
self._groups = [(self.obj.get_handle(), self._WORKNAME, '')]
|
||||
# own family events
|
||||
family_handle_list = self.obj.get_family_handle_list()
|
||||
if family_handle_list:
|
||||
@ -88,10 +89,8 @@ class PersonEventEmbedList(EventEmbedList):
|
||||
else:
|
||||
groupname = self._UNKNOWNNAME
|
||||
self._data.append(family.get_event_ref_list())
|
||||
self._groups.append((family_handle, self._FAMNAME % {
|
||||
'namepartner': groupname,
|
||||
'famid': family.get_gramps_id()
|
||||
}))
|
||||
self._groups.append((family_handle, self._FAMNAME,
|
||||
groupname))
|
||||
self.changed = False
|
||||
|
||||
return self._data
|
||||
|
Loading…
Reference in New Issue
Block a user