From e2e659dc94890c4b40e55147d0439a28dbc714de Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Wed, 25 Mar 2020 19:50:44 +0100 Subject: [PATCH] Suppress age = 0 days in events list If the reference event date is equal to the event date, don't show the age except if the date is estimated, calculated, ... Fixes #0007745 --- gramps/gui/editors/displaytabs/eventrefmodel.py | 7 +++++-- gramps/plugins/gramplet/events.py | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gramps/gui/editors/displaytabs/eventrefmodel.py b/gramps/gui/editors/displaytabs/eventrefmodel.py index 3dde65c8e..8d550042f 100644 --- a/gramps/gui/editors/displaytabs/eventrefmodel.py +++ b/gramps/gui/editors/displaytabs/eventrefmodel.py @@ -46,7 +46,7 @@ from html import escape # #------------------------------------------------------------------------- from ...widgets.undoablebuffer import UndoableBuffer -from gramps.gen.lib import EventRoleType +from gramps.gen.lib import (EventRoleType, Date) 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 @@ -175,7 +175,10 @@ class EventRefModel(Gtk.TreeStore): """ date = event.get_date_object() if date and self.start_date: - return (date - self.start_date).format(precision=age_precision) + if date == self.start_date and date.modifier == Date.MOD_NONE: + return "" + else: + return (date - self.start_date).format(precision=age_precision) else: return "" diff --git a/gramps/plugins/gramplet/events.py b/gramps/plugins/gramplet/events.py index a83f437bb..add09796b 100644 --- a/gramps/plugins/gramplet/events.py +++ b/gramps/plugins/gramplet/events.py @@ -32,6 +32,7 @@ from gi.repository import Gtk from gramps.gui.editors import EditEvent from gramps.gui.listmodel import ListModel, NOSORT from gramps.gen.plug import Gramplet +from gramps.gen.lib import Date from gramps.gen.plug.report.utils import find_spouse from gramps.gui.dbguielement import DbGUIElement from gramps.gen.display.place import displayer as place_displayer @@ -129,7 +130,10 @@ class Events(Gramplet, DbGUIElement): date = event.get_date_object() start_date = self.cached_start_date if date and start_date: - return (date - start_date).format(precision=age_precision) + if date == start_date and date.modifier == Date.MOD_NONE: + return "" + else: + return (date - start_date).format(precision=age_precision) else: return ""