From dcb926bf876acb34c6d0c1da6813b2931420d259 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 20 Dec 2009 22:12:29 +0000 Subject: [PATCH] Cleaning up Utils and refactoring common functionality svn: r13860 --- src/gen/lib/eventroletype.py | 11 +++++++++-- src/gen/lib/eventtype.py | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/gen/lib/eventroletype.py b/src/gen/lib/eventroletype.py index 5e2d25527..9a9c67d67 100644 --- a/src/gen/lib/eventroletype.py +++ b/src/gen/lib/eventroletype.py @@ -71,6 +71,13 @@ class EventRoleType(GrampsType): def is_primary(self): """ - Returns True if EventRoleType is primary, False otherwise. + Returns True if EventRoleType is PRIMARY, False otherwise. """ - return self.__value == self.PRIMARY + return self.value == self.PRIMARY + + def is_family(self): + """ + Returns True if EventRoleType is FAMILY, False otherwise. + """ + return self.value == self.FAMILY + diff --git a/src/gen/lib/eventtype.py b/src/gen/lib/eventtype.py index c4d317128..c67e8fb1b 100644 --- a/src/gen/lib/eventtype.py +++ b/src/gen/lib/eventtype.py @@ -190,4 +190,30 @@ class EventType(GrampsType): def __init__(self, value=None): GrampsType.__init__(self, value) + def is_birth_fallback(self): + """ + Returns True if EventRoleType is a birth fallback, False + otherwise. + """ + return self.value in [self.CHRISTEN, + self.BAPTISM] + + def is_death_fallback(self): + """ + Returns True if EventRoleType is a death fallback, False + otherwise. + """ + return self.value in [self.BURIAL, + self.CREMATION, + self.CAUSE_DEATH] + def is_marriage(self): + """ + Returns True if EventRoleType is MARRIAGE, False otherwise. + """ + return self.value == self.MARRIAGE + def is_divorce(self): + """ + Returns True if EventRoleType is DIVORCE, False otherwise. + """ + return self.value == self.DIVORCE