2006-11-21 Don Allingham <don@gramps-project.org>

* src/Utils.py (probably_alive): use get_primary_event_ref_list()
	* src/RelLib/_Person.py: Add get_primary_event_ref_list()



svn: r7663
This commit is contained in:
Don Allingham 2006-11-21 16:20:35 +00:00
parent d88c6bf987
commit 231f9a1277
3 changed files with 18 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2006-11-21 Don Allingham <don@gramps-project.org>
* src/Utils.py (probably_alive): use get_primary_event_ref_list()
* src/RelLib/_Person.py: Add get_primary_event_ref_list()
2006-11-20 Don Allingham <don@gramps-project.org>
* src/Editors/_EditName.py: autocomplete for surnames
* src/glade/gramps.glade: set focus properly

View File

@ -49,6 +49,7 @@ from _EventRef import EventRef
from _PersonRef import PersonRef
from _MarkerType import MarkerType
from _AttributeType import AttributeType
from _EventRoleType import EventRoleType
#-------------------------------------------------------------------------
#
@ -521,6 +522,18 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
"""
return self.event_ref_list
def get_primary_event_ref_list(self):
"""
Returns the list of L{EventRef} objects associated with L{Event}
instances that have been marked as primary events.
@returns: Returns the list of L{EventRef} objects associated with
the Person instance.
@rtype: list
"""
return [ ref for ref in self.event_ref_list \
if ref.get_role() == EventRoleType.PRIMARY ]
def set_event_ref_list(self, event_ref_list):
"""
Sets the Person instance's L{EventRef} list to the passed list.

View File

@ -573,9 +573,7 @@ def probably_alive(person,db,current_year=None,limit=0):
# Look for Cause Of Death, Burial or Cremation events.
# These are fairly good indications that someone's not alive.
for ev_ref in person.event_ref_list:
if ev_ref.get_role() != RelLib.EventRoleType.PRIMARY:
continue
for ev_ref in person.get_primary_event_ref_list():
ev = db.get_event_from_handle(ev_ref.ref)
if ev and int(ev.get_type()) in [RelLib.EventType.CAUSE_DEATH,
RelLib.EventType.BURIAL,