From f4a15e1b153bbbc0eabaf87ee8871c3fe28f3ff2 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 27 Apr 2006 17:20:19 +0000 Subject: [PATCH] * src/DisplayTabs.py: check of event==None when determining default type svn: r6465 --- gramps2/ChangeLog | 1 + gramps2/src/DisplayTabs.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 6a14410a1..faee19538 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,5 @@ 2006-04-27 Don Allingham + * src/DisplayTabs.py: check of event==None when determining default type * src/ViewManager.py: support for keypress events * src/gramps.py: fix gnome init diff --git a/gramps2/src/DisplayTabs.py b/gramps2/src/DisplayTabs.py index 3941ad145..bf15c18f5 100644 --- a/gramps2/src/DisplayTabs.py +++ b/gramps2/src/DisplayTabs.py @@ -741,17 +741,18 @@ class PersonEventEmbedList(EventEmbedList): type_list = [] ref_list = [ e for e in [self.obj.get_birth_ref(), self.obj.get_death_ref()] + \ self.obj.get_event_ref_list() if e ] - + + event = None for event_ref in ref_list: event = self.dbstate.db.get_event_from_handle(event_ref.ref) type_list.append(int(event.get_type())) - etype = event.get_type() - for etype in [RelLib.EventType.BIRTH, RelLib.EventType.DEATH]: - if etype not in type_list: - return RelLib.EventType(etype) - else: - return RelLib.EventType(RelLib.EventType.BIRTH) + if event: + etype = event.get_type() + for etype in [RelLib.EventType.BIRTH, RelLib.EventType.DEATH]: + if etype not in type_list: + return RelLib.EventType(etype) + return RelLib.EventType(RelLib.EventType.BIRTH) def get_ref_editor(self): from Editors import EditEventRef