Added is_type('Name'), is_burial(), and is_baptism()

svn: r15670
This commit is contained in:
Doug Blank 2010-07-31 15:17:23 +00:00
parent 9ddb7990f5
commit e4bb905303

View File

@ -203,6 +203,13 @@ class EventType(GrampsType):
otherwise.
"""
return self.value == self.BIRTH
def is_baptism(self):
"""
Returns True if EventType is BAPTISM, False
otherwise.
"""
return self.value == self.BAPTISM
def is_death(self):
"""
@ -211,6 +218,13 @@ class EventType(GrampsType):
"""
return self.value == self.DEATH
def is_burial(self):
"""
Returns True if EventType is BURIAL, False
otherwise.
"""
return self.value == self.BURIAL
def is_birth_fallback(self):
"""
Returns True if EventType is a birth fallback, False
@ -239,6 +253,15 @@ class EventType(GrampsType):
"""
return self.value == self.DIVORCE
def is_type(self, event_name):
"""
Returns True if EventType has name EVENT_NAME, False otherwise.
"""
event_type = [tup for tup in self._DATAMAP if tup[2] == event_name]
if len(event_type) > 0:
return self.value == event_type[0][0] # first one, the code
return False
def get_abbreviation(self):
"""
Returns the abbreviation for this event. Uses the explicitly