diff --git a/gramps/plugins/gramplet/events.py b/gramps/plugins/gramplet/events.py index f905134ae..81cd83bb2 100644 --- a/gramps/plugins/gramplet/events.py +++ b/gramps/plugins/gramplet/events.py @@ -20,13 +20,16 @@ # from gramps.gui.editors import EditEvent +from gramps.gen.lib import EventRoleType from gramps.gui.listmodel import ListModel, NOSORT from gramps.gen.plug import Gramplet from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext from gramps.gen.display.name import displayer as name_displayer from gramps.gen.datehandler import get_date -from gramps.gen.utils.db import get_birth_or_fallback, get_marriage_or_fallback +from gramps.gen.utils.db import (get_participant_from_event, + get_birth_or_fallback, + get_marriage_or_fallback) from gramps.gen.errors import WindowActiveError from gi.repository import Gtk from gramps.gen.config import config @@ -52,13 +55,14 @@ class Events(Gramplet): top = Gtk.TreeView() titles = [('', NOSORT, 50,), (_('Type'), 1, 100), - (_('Details'), 2, 200), + (_('Main Participants'), 2, 200), (_('Date'), 3, 100), ('', NOSORT, 50), (_('Age'), 4, 100), ('', NOSORT, 50), (_('Place'), 5, 400), - (_('Role'), 6, 100)] + (_('Description'), 6, 150), + (_('Role'), 7, 100)] self.model = ListModel(top, titles, event_func=self.edit_event) return top @@ -75,18 +79,26 @@ class Events(Gramplet): handle = event.get_place_handle() if handle: place = self.dbstate.db.get_place_from_handle(handle).get_title() - if spouse: - details = name_displayer.display(spouse) - else: - details = event.get_description() + + participants = '' + if int(event_ref.get_role()) == EventRoleType.FAMILY: + if spouse: + participants = name_displayer.display(spouse) + + if int(event_ref.get_role()) not in (EventRoleType.PRIMARY, + EventRoleType.FAMILY): + participants = Utils.get_participant_from_event(self.dbstate.db, + event_ref.ref) + self.model.add((event.get_handle(), str(event.get_type()), - details, + participants, event_date, event_sort, person_age, person_age_sort, place, + event.get_description(), str(event_ref.get_role()))) def column_age(self, event):