0002122: Detailed Ancestor Report reports people as buried who have no birth events (contributed by Gerald Britton <gerald.britton@gmail.com>)

svn: r10781
This commit is contained in:
Brian Matherly 2008-06-02 00:59:14 +00:00
parent ff0c75a7fb
commit 3a98ddd4fd
15 changed files with 354 additions and 336 deletions

View File

@ -2471,7 +2471,7 @@ class GedcomParser(UpdateCallback):
self.__parse_level(sub_state, self.event_parse_tbl, self.__undefined)
if int(event.get_type()) == gen.lib.EventType.MARRIAGE:
if event.type == gen.lib.EventType.MARRIAGE:
descr = event.get_description()
if descr == "Civil Union":
state.family.type.set(gen.lib.FamilyRelType.CIVIL_UNION)
@ -2881,7 +2881,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if self.is_ftw and int(state.event.get_type()) in FTW_BAD_PLACE:
if self.is_ftw and state.event.type in FTW_BAD_PLACE:
state.event.set_description(line.data)
else:
place = self.__find_or_create_place(line.data)

File diff suppressed because it is too large Load Diff

View File

@ -361,7 +361,7 @@ class SimpleAccess:
elist = [ self.dbase.get_event_from_handle(ref.ref)
for ref in reflist ]
events = [ evnt for evnt in elist
if int(evnt.get_type()) == EventType.MARRIAGE ]
if event.type == EventType.MARRIAGE ]
if events:
place_handle = events[0].get_place_handle()
return ReportUtils.place_name(self.dbase, place_handle)
@ -391,7 +391,7 @@ class SimpleAccess:
elist = [ self.dbase.get_event_from_handle(ref.ref)
for ref in reflist ]
events = [ evnt for evnt in elist
if int(evnt.get_type()) == EventType.MARRIAGE ]
if event.type == EventType.MARRIAGE ]
if events:
date_obj = events[0].get_date_object()
if date_obj:

View File

@ -598,9 +598,9 @@ def probably_alive(person, db, current_date=None, limit=0):
# These are fairly good indications that someone's not alive.
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 [gen.lib.EventType.CAUSE_DEATH,
gen.lib.EventType.BURIAL,
gen.lib.EventType.CREMATION]:
if ev and ev.type in [gen.lib.EventType.CAUSE_DEATH,
gen.lib.EventType.BURIAL,
gen.lib.EventType.CREMATION]:
if not death_date:
death_date = ev.get_date_object()
if ev.get_date_object().get_start_date() != gen.lib.Date.EMPTY:

View File

@ -71,11 +71,11 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
PlaceBase.__init__(self, source)
if source:
self.description = source.description
self.type = source.type
self.__description = source.__description
self.__type = source.__type
else:
self.description = ""
self.type = EventType()
self.__description = ""
self.__type = EventType()
def serialize(self, no_text_date = False):
"""
@ -95,9 +95,9 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
be considered persistent.
@rtype: tuple
"""
return (self.handle, self.gramps_id, self.type.serialize(),
return (self.handle, self.gramps_id, self.__type.serialize(),
DateBase.serialize(self, no_text_date),
self.description, self.place,
self.__description, self.place,
SourceBase.serialize(self),
NoteBase.serialize(self),
MediaBase.serialize(self),
@ -114,14 +114,14 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@type data: tuple
"""
(self.handle, self.gramps_id, the_type, date,
self.description, self.place,
self.__description, self.place,
source_list, note_list, media_list, attribute_list,
self.change, marker, self.private) = data
self.marker = MarkerType()
self.marker.unserialize(marker)
self.type = EventType()
self.type.unserialize(the_type)
self.__type = EventType()
self.__type.unserialize(the_type)
DateBase.unserialize(self, date)
MediaBase.unserialize(self, media_list)
AttributeBase.unserialize(self, attribute_list)
@ -178,7 +178,7 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@return: Returns the list of all textual attributes of the object.
@rtype: list
"""
return [self.description, str(self.type), self.gramps_id]
return [self.__description, str(self.__type), self.gramps_id]
def get_text_data_child_list(self):
"""
@ -241,8 +241,8 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
"""
date = self.get_date_object()
place = self.get_place_handle()
description = self.description
the_type = self.type
description = self.__description
the_type = self.__type
return (the_type == EventType.CUSTOM and date.is_empty()
and not place and not description)
@ -258,9 +258,9 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
if other == None:
other = Event (None)
if self.type != other.type or \
if self.__type != other.__type or \
((self.place or other.place) and (self.place != other.place)) or \
self.description != other.description \
self.__description != other.__description \
or self.private != other.private or \
(not self.get_date_object().is_equal(other.get_date_object())) or \
len(self.get_source_references()) != len(other.get_source_references()):
@ -282,7 +282,7 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@param the_type: Type to assign to the Event
@type the_type: tuple
"""
self.type.set(the_type)
self.__type.set(the_type)
def get_type(self):
"""
@ -291,7 +291,8 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@return: Type of the Event
@rtype: tuple
"""
return self.type
return self.__type
type = property(get_type, get_type, None, 'Returns or sets type of the event')
def set_description(self, description):
"""
@ -302,7 +303,7 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@param description: Description to assign to the Event
@type description: str
"""
self.description = description
self.__description = description
def get_description(self) :
"""
@ -311,4 +312,5 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@return: Returns the description of the Event
@rtype: str
"""
return self.description
return self.__description
description = property(get_description, set_description, None, 'Returns or sets description of the event')

View File

@ -49,6 +49,8 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
to the refereneced event.
"""
__slots__=('.__role')
def __init__(self, source=None):
"""
Create a new EventRef instance, copying from the source if present.
@ -58,9 +60,9 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
AttributeBase.__init__(self, source)
RefBase.__init__(self, source)
if source:
self.role = source.role
self.__role = source.__role
else:
self.role = EventRoleType()
self.__role = EventRoleType()
def serialize(self):
"""
@ -71,7 +73,7 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
NoteBase.serialize(self),
AttributeBase.serialize(self),
RefBase.serialize(self),
self.role.serialize()
self.__role.serialize()
)
def unserialize(self, data):
@ -83,8 +85,8 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
NoteBase.unserialize(self, note_list)
AttributeBase.unserialize(self, attribute_list)
RefBase.unserialize(self, ref)
self.role = EventRoleType()
self.role.unserialize(role)
self.__role = EventRoleType()
self.__role.unserialize(role)
return self
def get_text_data_list(self):
@ -94,7 +96,7 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
@return: Returns the list of all textual attributes of the object.
@rtype: list
"""
return [str(self.role)]
return self.__role.string
def get_text_data_child_list(self):
"""
@ -194,10 +196,11 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
"""
Return the tuple corresponding to the preset role.
"""
return self.role
return self.__role
def set_role(self, role):
"""
Set the role according to the given argument.
"""
self.role.set(role)
self.__role.set(role)
role = property(get_role, set_role, None, 'Returns or sets role property')

View File

@ -94,6 +94,7 @@ class GrampsType(object):
_BLACKLIST = None
__metaclass__ = GrampsTypeMeta
__slots__ = ('__value','__string')
@classmethod
def __class_init__(cls, namespace):
@ -115,23 +116,23 @@ class GrampsType(object):
v = value[0]
if len(value) > 1:
s = value[1]
self.val = v
self.string = s
self.__value = v
self.__string = s
def __set_int(self, value):
self.val = value
self.string = u''
self.__value = value
self.__string = u''
def __set_instance(self, value):
self.val = value.val
self.string = value.string
self.__value = value.value
self.__string = value.string
def __set_str(self, value):
self.val = self._S2IMAP.get(value, self._CUSTOM)
if self.val == self._CUSTOM:
self.string = value
self.__value = self._S2IMAP.get(value, self._CUSTOM)
if self.__value == self._CUSTOM:
self.__string = value
else:
self.string = u''
self.__string = u''
def set(self, value):
if isinstance(value, tuple):
@ -143,8 +144,8 @@ class GrampsType(object):
elif isinstance(value, basestring):
self.__set_str(value)
else:
self.val = self._DEFAULT
self.string = u''
self.__value = self._DEFAULT
self.__string = u''
def set_from_xml_str(self, value):
"""
@ -152,38 +153,38 @@ class GrampsType(object):
(obtained e.g. from XML).
"""
if self._E2IMAP.has_key(value):
self.val = self._E2IMAP[value]
self.string = u''
self.__value = self._E2IMAP[value]
self.__string = u''
else:
self.val = self._CUSTOM
self.string = value
self.__value = self._CUSTOM
self.__string = value
def xml_str(self):
"""
Return the untranslated string (e.g. suitable for XML) corresponding
to the type.
"""
if self.val == self._CUSTOM:
return self.string
if self.__value == self._CUSTOM:
return self.__string
else:
return self._I2EMAP[self.val]
return self._I2EMAP[self.__value]
def serialize(self):
"""Convert the object to a serialized tuple of data. """
return (self.val, self.string)
return (self.__value, self.__string)
def unserialize(self, data):
"""Convert a serialized tuple of data to an object."""
self.val, self.string = data
self.__value, self.__string = data
def __str__(self):
if self.val == self._CUSTOM:
return self.string
if self.__value == self._CUSTOM:
return self.__string
else:
return self._I2SMAP.get(self.val, _('Unknown'))
return self._I2SMAP.get(self.__value, _('Unknown'))
def __int__(self):
return self.val
return self.__value
def get_map(self):
return self._I2SMAP
@ -199,26 +200,28 @@ class GrampsType(object):
if (i != self._CUSTOM) and s.strip()]
def is_custom(self):
return self.val == self._CUSTOM
return self.__value == self._CUSTOM
def is_default(self):
return self.val == self._DEFAULT
return self.__value == self._DEFAULT
def get_custom(self):
return self._CUSTOM
def __cmp__(self, value):
if isinstance(value, int):
return cmp(self.val, value)
return cmp(self.__value, value)
elif isinstance(value, basestring):
if self.val == self._CUSTOM:
return cmp(self.string, value)
if self.__value == self._CUSTOM:
return cmp(self.__string, value)
else:
return cmp(self._I2SMAP.get(self.val), value)
return cmp(self._I2SMAP.get(self.__value), value)
elif isinstance(value, tuple):
return cmp((self.val, self.string), value)
return cmp((self.__value, self.__string), value)
else:
if value.val == self._CUSTOM:
return cmp(self.string, value.string)
if value.value == self._CUSTOM:
return cmp(self.__string, value.string)
else:
return cmp(self.val, value.val)
return cmp(self.__value, value.value)
value = property(__int__, __set_int, None, "Returns or sets integer value")
string = property(__str__, __set_str, None, "Returns or sets string value")

View File

@ -168,7 +168,7 @@ def remove_child_from_family(db, person_handle, family_handle, trans=None):
def marriage_from_eventref_list(db, eventref_list):
for eventref in eventref_list:
event = db.get_event_from_handle(eventref.ref)
if int(event.get_type()) == gen.lib.EventType.MARRIAGE:
if event.type == gen.lib.EventType.MARRIAGE:
return event
else:
return None
@ -305,12 +305,12 @@ def set_birth_death_index(db, person):
for index in range(len(event_ref_list)):
ref = event_ref_list[index]
event = db.get_event_from_handle(ref.ref)
if (int(event.get_type()) == gen.lib.EventType.BIRTH) \
and (int(ref.get_role()) == gen.lib.EventRoleType.PRIMARY) \
if (event.type == gen.lib.EventType.BIRTH) \
and (ref.role == gen.lib.EventRoleType.PRIMARY) \
and (birth_ref_index == -1):
birth_ref_index = index
elif (int(event.get_type()) == gen.lib.EventType.DEATH) \
and (int(ref.get_role()) == gen.lib.EventRoleType.PRIMARY) \
elif (event.type == gen.lib.EventType.DEATH) \
and (ref.role == gen.lib.EventRoleType.PRIMARY) \
and (death_ref_index == -1):
death_ref_index = index

View File

@ -309,9 +309,9 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
# These are fairly good indications that someone's not alive.
for ev_ref in person.get_primary_event_ref_list():
ev = self.db.get_event_from_handle(ev_ref.ref)
if ev and int(ev.get_type()) in [gen.lib.EventType.CAUSE_DEATH,
gen.lib.EventType.BURIAL,
gen.lib.EventType.CREMATION]:
if ev and ev.type in [gen.lib.EventType.CAUSE_DEATH,
gen.lib.EventType.BURIAL,
gen.lib.EventType.CREMATION]:
if not death_date:
death_date = ev.get_date_object()

View File

@ -383,10 +383,10 @@ class Calendar(Report):
are_married = None
for event_ref in fam.get_event_ref_list():
event = self.database.get_event_from_handle(event_ref.ref)
if int(event.get_type()) in [gen.lib.EventType.MARRIAGE,
if event.type in [gen.lib.EventType.MARRIAGE,
gen.lib.EventType.MARR_ALT]:
are_married = event
elif int(event.get_type()) in [gen.lib.EventType.DIVORCE,
elif event.type in [gen.lib.EventType.DIVORCE,
gen.lib.EventType.ANNULMENT,
gen.lib.EventType.DIV_FILING]:
are_married = None

View File

@ -453,7 +453,7 @@ class FamilyGroup(Report):
for event_ref in family.get_event_ref_list():
if event_ref:
event = self.database.get_event_from_handle(event_ref.ref)
if int(event.get_type()) == gen.lib.EventType.MARRIAGE:
if event.type == gen.lib.EventType.MARRIAGE:
m = event
break

View File

@ -247,7 +247,7 @@ class RelGraphReport(Report):
for event_ref in fam.get_event_ref_list():
event = self.database.get_event_from_handle(
event_ref.ref)
if int(event.get_type()) == gen.lib.EventType.MARRIAGE:
if event.type == gen.lib.EventType.MARRIAGE:
label = self.get_event_string(event)
break
if self.includeid:
@ -376,10 +376,10 @@ class RelGraphReport(Report):
# missing info, use (first) christening/burial instead
for event_ref in person.get_primary_event_ref_list():
event = self.database.get_event_from_handle(event_ref.ref)
if int(event.get_type()) == gen.lib.EventType.CHRISTEN:
if event.type == gen.lib.EventType.CHRISTEN:
if not birth:
birth = self.get_event_string(event)
elif int(event.get_type()) == gen.lib.EventType.BURIAL:
elif event.type == gen.lib.EventType.BURIAL:
if not death:
death = self.get_event_string(event)
return (birth, death)
@ -574,3 +574,4 @@ pmgr.register_report(
)

View File

@ -339,7 +339,7 @@ class Extract:
if int(family.get_relationship()) == FamilyRelType.MARRIED:
for event_ref in family.get_event_ref_list():
event = self.db.get_event_from_handle(event_ref.ref)
if int(event.get_type()) == EventType.MARRIAGE:
if event.type == EventType.MARRIAGE:
marriages.append(event_ref.ref)
if marriages:
return (person, marriages)

View File

@ -642,9 +642,9 @@ class WebCalReport(Report):
married = True
for event_ref in fam.get_event_ref_list():
event = self.database.get_event_from_handle(event_ref.ref)
if event and int(event.get_type()) in [gen.lib.EventType.DIVORCE,
gen.lib.EventType.ANNULMENT,
gen.lib.EventType.DIV_FILING]:
if event and event.type in [gen.lib.EventType.DIVORCE,
gen.lib.EventType.ANNULMENT,
gen.lib.EventType.DIV_FILING]:
married = False
if married:
for event_ref in fam.get_event_ref_list():

View File

@ -313,7 +313,7 @@ class GeneWebWriter:
event_ref_list = family.get_event_ref_list()
for event_ref in event_ref:
event = self.db.get_event_from_handle(event_ref.ref)
if int(event.get_type()) == gen.lib.EventType.MARRIAGE:
if event.type == gen.lib.EventType.MARRIAGE:
w_list = event.get_witness_list()
if w_list:
for witness in w_list: