From cc3497ad6a0c4b2e301264d4d4482ff29fc0cad3 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 1 Jun 2012 21:52:59 +0000 Subject: [PATCH] Separate start dates are needed for family and person as the two views may not be related svn: r19742 --- src/plugins/gramplet/Events.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/plugins/gramplet/Events.py b/src/plugins/gramplet/Events.py index 69d2a1e98..ea4d37752 100644 --- a/src/plugins/gramplet/Events.py +++ b/src/plugins/gramplet/Events.py @@ -25,7 +25,7 @@ from gen.plug import Gramplet from gen.ggettext import gettext as _ from gen.display.name import displayer as name_displayer import gen.datehandler -from gen.utils import get_birth_or_fallback +from gen.utils import get_birth_or_fallback, get_marriage_or_fallback import Errors import gtk import config @@ -112,16 +112,6 @@ class Events(Gramplet): else: return "" - def get_start_date(self): - """ - Get the start date for a person, usually a birth date, or - something close to birth. - """ - active_handle = self.get_active('Person') - active = self.dbstate.db.get_person_from_handle(active_handle) - event = get_birth_or_fallback(self.dbstate.db, active) - return event.get_date_object() if event else None - def edit_event(self, treeview): """ Edit the selected event. @@ -191,6 +181,16 @@ class PersonEvents(Events): self.add_event_ref(event_ref, spouse) self.set_has_data(self.model.count > 0) + def get_start_date(self): + """ + Get the start date for a person, usually a birth date, or + something close to birth. + """ + active_handle = self.get_active('Person') + active = self.dbstate.db.get_person_from_handle(active_handle) + event = get_birth_or_fallback(self.dbstate.db, active) + return event.get_date_object() if event else None + class FamilyEvents(Events): """ Displays the events for a family. @@ -231,3 +231,13 @@ class FamilyEvents(Events): self.add_event_ref(event_ref) self.set_has_data(self.model.count > 0) + def get_start_date(self): + """ + Get the start date for a family, usually a marriage date, or + something close to marriage. + """ + active_handle = self.get_active('Family') + active = self.dbstate.db.get_family_from_handle(active_handle) + event = get_marriage_or_fallback(self.dbstate.db, active) + return event.get_date_object() if event else None +