7342: Update column order in editor event tabs
This commit is contained in:
parent
a0bb7ddfd1
commit
ed65d4e7df
@ -50,14 +50,14 @@ from gui.selectors import SelectorFactory
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||||
|
|
||||||
_HANDLE_COL = 7
|
_HANDLE_COL = 8
|
||||||
_DND_TYPE = DdTargets.EVENTREF
|
_DND_TYPE = DdTargets.EVENTREF
|
||||||
_DND_EXTRA = DdTargets.EVENT
|
_DND_EXTRA = DdTargets.EVENT
|
||||||
_WORKGROUP = EventRefModel._ROOTINDEX
|
_WORKGROUP = EventRefModel._ROOTINDEX
|
||||||
|
|
||||||
_WORKNAME = _("Family Events")
|
_WORKNAME = _("Family")
|
||||||
_FATHNAME = _("Events father")
|
_FATHNAME = _("Father")
|
||||||
_MOTHNAME = _("Events mother")
|
_MOTHNAME = _("Mother")
|
||||||
|
|
||||||
_MSG = {
|
_MSG = {
|
||||||
'add' : _('Add a new family event'),
|
'add' : _('Add a new family event'),
|
||||||
@ -71,14 +71,15 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
|||||||
#index = column in model. Value =
|
#index = column in model. Value =
|
||||||
# (name, sortcol in model, width, markup/text, weigth_col
|
# (name, sortcol in model, width, markup/text, weigth_col
|
||||||
_column_names = [
|
_column_names = [
|
||||||
(_('Description'), -1, 240, 0, EventRefModel.COL_FONTWEIGHT[0]),
|
(_('Description'), EventRefModel.COL_DESCR[0], 150, 0, -1),
|
||||||
(_('Type'), EventRefModel.COL_TYPE[0], 100, 0,
|
(_('Type'), EventRefModel.COL_TYPE[0], 120, 0,
|
||||||
EventRefModel.COL_FONTWEIGHT[0]),
|
|
||||||
(_('ID'), EventRefModel.COL_GID[0], 60, 0,
|
|
||||||
EventRefModel.COL_FONTWEIGHT[0]),
|
EventRefModel.COL_FONTWEIGHT[0]),
|
||||||
|
(_('ID'), -1, 100, 0, -1),
|
||||||
(_('Date'), EventRefModel.COL_SORTDATE[0], 150, 1, -1),
|
(_('Date'), EventRefModel.COL_SORTDATE[0], 150, 1, -1),
|
||||||
(_('Place'), EventRefModel.COL_PLACE[0], 140, 0, -1),
|
(_('Place'), EventRefModel.COL_PLACE[0], 240, 0, -1),
|
||||||
(_('Role'), EventRefModel.COL_ROLE[0], 80, 0, -1),
|
(_('Role'), EventRefModel.COL_ROLE[0], 80, 0, -1),
|
||||||
|
(_('Main Participants'), EventRefModel.COL_PARTIC[0], 240, 0,
|
||||||
|
EventRefModel.COL_FONTWEIGHT[0]),
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None
|
None
|
||||||
@ -150,14 +151,14 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
|||||||
#family events
|
#family events
|
||||||
if not self._data or self.changed:
|
if not self._data or self.changed:
|
||||||
self._data = [self.obj.get_event_ref_list()]
|
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
|
#father events
|
||||||
fhandle = self.obj.get_father_handle()
|
fhandle = self.obj.get_father_handle()
|
||||||
if fhandle:
|
if fhandle:
|
||||||
fdata = self.dbstate.db.get_person_from_handle(fhandle).\
|
fdata = self.dbstate.db.get_person_from_handle(fhandle).\
|
||||||
get_event_ref_list()
|
get_event_ref_list()
|
||||||
if fdata:
|
if fdata:
|
||||||
self._groups.append((fhandle, self._FATHNAME))
|
self._groups.append((fhandle, self._FATHNAME, ''))
|
||||||
self._data.append(fdata)
|
self._data.append(fdata)
|
||||||
#mother events
|
#mother events
|
||||||
mhandle = self.obj.get_mother_handle()
|
mhandle = self.obj.get_mother_handle()
|
||||||
@ -165,7 +166,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
|||||||
mdata = self.dbstate.db.get_person_from_handle(mhandle).\
|
mdata = self.dbstate.db.get_person_from_handle(mhandle).\
|
||||||
get_event_ref_list()
|
get_event_ref_list()
|
||||||
if mdata:
|
if mdata:
|
||||||
self._groups.append((mhandle, self._MOTHNAME))
|
self._groups.append((mhandle, self._MOTHNAME, ''))
|
||||||
self._data.append(mdata)
|
self._data.append(mdata)
|
||||||
#we register all events that need to be tracked
|
#we register all events that need to be tracked
|
||||||
for group in self._data:
|
for group in self._data:
|
||||||
@ -186,7 +187,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
|||||||
The columns to show as a tuple containing
|
The columns to show as a tuple containing
|
||||||
tuples (show/noshow, model column)
|
tuples (show/noshow, model column)
|
||||||
"""
|
"""
|
||||||
return ((1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5))
|
return ((1, 1), (1, 6), (1, 3), (1, 4), (1, 0), (1, 5), (1, 2))
|
||||||
|
|
||||||
def default_types(self):
|
def default_types(self):
|
||||||
return [
|
return [
|
||||||
|
@ -42,8 +42,10 @@ import cgi
|
|||||||
# GRAMPS classes
|
# GRAMPS classes
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
from gen.lib import EventRoleType
|
||||||
import DateHandler
|
import DateHandler
|
||||||
import config
|
import config
|
||||||
|
import Utils
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -68,12 +70,13 @@ class EventRefModel(gtk.TreeStore):
|
|||||||
COL_DATE = (3, str)
|
COL_DATE = (3, str)
|
||||||
COL_PLACE = (4, str)
|
COL_PLACE = (4, str)
|
||||||
COL_ROLE = (5, str)
|
COL_ROLE = (5, str)
|
||||||
COL_SORTDATE = (6, str)
|
COL_PARTIC = (6, str)
|
||||||
COL_EVENTREF = (7, object)
|
COL_SORTDATE = (7, str)
|
||||||
COL_FONTWEIGHT = (8, int)
|
COL_EVENTREF = (8, object)
|
||||||
|
COL_FONTWEIGHT = (9, int)
|
||||||
|
|
||||||
COLS = (COL_DESCR, COL_TYPE, COL_GID, COL_DATE, COL_PLACE, COL_ROLE,
|
COLS = (COL_DESCR, COL_TYPE, COL_GID, COL_DATE, COL_PLACE, COL_ROLE,
|
||||||
COL_SORTDATE, COL_EVENTREF, COL_FONTWEIGHT)
|
COL_PARTIC, COL_SORTDATE, COL_EVENTREF, COL_FONTWEIGHT)
|
||||||
|
|
||||||
def __init__(self, event_list, db, groups):
|
def __init__(self, event_list, db, groups):
|
||||||
"""
|
"""
|
||||||
@ -96,7 +99,9 @@ class EventRefModel(gtk.TreeStore):
|
|||||||
|
|
||||||
def row_group(self, index, group):
|
def row_group(self, index, group):
|
||||||
name = self.namegroup(index, len(group))
|
name = self.namegroup(index, len(group))
|
||||||
return [name, '', '', '', '', '', '', (index, None), WEIGHT_BOLD]
|
spouse = self.groups[index][2]
|
||||||
|
return ['', name, '', '', '', '', spouse, '', (index, None),
|
||||||
|
WEIGHT_BOLD]
|
||||||
|
|
||||||
def namegroup(self, groupindex, length):
|
def namegroup(self, groupindex, length):
|
||||||
return self._GROUPSTRING % {'groupname': self.groups[groupindex][1],
|
return self._GROUPSTRING % {'groupname': self.groups[groupindex][1],
|
||||||
@ -109,6 +114,7 @@ class EventRefModel(gtk.TreeStore):
|
|||||||
self.column_date(eventref),
|
self.column_date(eventref),
|
||||||
self.column_place(eventref),
|
self.column_place(eventref),
|
||||||
self.column_role(eventref),
|
self.column_role(eventref),
|
||||||
|
self.column_participant(eventref),
|
||||||
self.column_sort_date(eventref),
|
self.column_sort_date(eventref),
|
||||||
(index, eventref),
|
(index, eventref),
|
||||||
self.colweight(index),
|
self.colweight(index),
|
||||||
@ -144,3 +150,10 @@ class EventRefModel(gtk.TreeStore):
|
|||||||
if place_handle:
|
if place_handle:
|
||||||
return self.db.get_place_from_handle(place_handle).get_title()
|
return self.db.get_place_from_handle(place_handle).get_title()
|
||||||
return u""
|
return u""
|
||||||
|
|
||||||
|
def column_participant(self, event_ref):
|
||||||
|
if int(event_ref.get_role()) not in (EventRoleType.PRIMARY,
|
||||||
|
EventRoleType.FAMILY):
|
||||||
|
return Utils.get_participant_from_event(self.db, event_ref.ref)
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
@ -47,8 +47,9 @@ import Errors
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class PersonEventEmbedList(EventEmbedList):
|
class PersonEventEmbedList(EventEmbedList):
|
||||||
|
|
||||||
_WORKNAME = _("Personal Events")
|
_WORKNAME = _("Personal")
|
||||||
_FAMNAME = _("With %(namepartner)s (%(famid)s)")
|
#_FAMNAME = _("With %(namepartner)s (%(famid)s)")
|
||||||
|
_FAMNAME = _("Family")
|
||||||
_UNKNOWNNAME = _("<Unknown>")
|
_UNKNOWNNAME = _("<Unknown>")
|
||||||
|
|
||||||
_MSG = {
|
_MSG = {
|
||||||
@ -67,7 +68,7 @@ class PersonEventEmbedList(EventEmbedList):
|
|||||||
def get_data(self):
|
def get_data(self):
|
||||||
if not self._data or self.changed:
|
if not self._data or self.changed:
|
||||||
self._data = [self.obj.get_event_ref_list()]
|
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
|
# own family events
|
||||||
family_handle_list = self.obj.get_family_handle_list()
|
family_handle_list = self.obj.get_family_handle_list()
|
||||||
if family_handle_list:
|
if family_handle_list:
|
||||||
@ -86,10 +87,8 @@ class PersonEventEmbedList(EventEmbedList):
|
|||||||
else:
|
else:
|
||||||
groupname = self._UNKNOWNNAME
|
groupname = self._UNKNOWNNAME
|
||||||
self._data.append(family.get_event_ref_list())
|
self._data.append(family.get_event_ref_list())
|
||||||
self._groups.append((family_handle, self._FAMNAME % {
|
self._groups.append((family_handle, self._FAMNAME,
|
||||||
'namepartner': groupname,
|
groupname))
|
||||||
'famid': family.get_gramps_id()
|
|
||||||
}))
|
|
||||||
self.changed = False
|
self.changed = False
|
||||||
|
|
||||||
return self._data
|
return self._data
|
||||||
|
Loading…
Reference in New Issue
Block a user