Add Stillbirth as pre-defined event type
Add Stillbirth as a fallback for both Birth and Death events.
This commit is contained in:
		
				
					committed by
					
						
						Nick Hall
					
				
			
			
				
	
			
			
			
						parent
						
							222bfff175
						
					
				
				
					commit
					278c168f9b
				
			@@ -82,6 +82,7 @@ class EventType(GrampsType):
 | 
			
		||||
    .. attribute DIV_FILING:     Divorce Filing
 | 
			
		||||
    .. attribute ANNULMENT:      Annulment
 | 
			
		||||
    .. attribute MARR_ALT:        Alternate Marriage
 | 
			
		||||
    .. attribute STILLBIRTH:      Stillbirth
 | 
			
		||||
    """
 | 
			
		||||
    UNKNOWN = -1
 | 
			
		||||
    CUSTOM = 0
 | 
			
		||||
@@ -129,13 +130,14 @@ class EventType(GrampsType):
 | 
			
		||||
    RESIDENCE = 42
 | 
			
		||||
    RETIREMENT = 43
 | 
			
		||||
    WILL = 44
 | 
			
		||||
    STILLBIRTH = 45
 | 
			
		||||
 | 
			
		||||
    # _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh
 | 
			
		||||
    def _T_(value, context=''): # enable deferred translations
 | 
			
		||||
        return "%s\x04%s" % (context, value) if context else value
 | 
			
		||||
 | 
			
		||||
    _MENU = [[_T_('Life Events'),
 | 
			
		||||
              [BIRTH, BAPTISM, DEATH, BURIAL, CREMATION, ADOPT]],
 | 
			
		||||
              [BIRTH, BAPTISM, DEATH, STILLBIRTH, BURIAL, CREMATION, ADOPT]],
 | 
			
		||||
             [_T_('Family'),
 | 
			
		||||
              [ENGAGEMENT, MARRIAGE, DIVORCE, ANNULMENT, MARR_SETTL, MARR_LIC,
 | 
			
		||||
               MARR_CONTR, MARR_BANNS, DIV_FILING, MARR_ALT]],
 | 
			
		||||
@@ -205,6 +207,7 @@ class EventType(GrampsType):
 | 
			
		||||
        (DIV_FILING, _("Divorce Filing"), "Divorce Filing"),
 | 
			
		||||
        (ANNULMENT, _("Annulment"), "Annulment"),
 | 
			
		||||
        (MARR_ALT, _("Alternate Marriage"), "Alternate Marriage"),
 | 
			
		||||
        (STILLBIRTH, _("Stillbirth"), "Stillbirth"),
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
    _ABBREVIATIONS = {
 | 
			
		||||
@@ -253,7 +256,8 @@ class EventType(GrampsType):
 | 
			
		||||
        ENGAGEMENT: _T_("engd.", "Engagement abbreviation"),
 | 
			
		||||
        DIVORCE: _T_("div.", "Divorce abbreviation"),
 | 
			
		||||
        DIV_FILING: _T_("div.f.", "Divorce Filing abbreviation"),
 | 
			
		||||
        ANNULMENT: _T_("annul.", "Annulment abbreviation")
 | 
			
		||||
        ANNULMENT: _T_("annul.", "Annulment abbreviation"),
 | 
			
		||||
        STILLBIRTH: _T_("still.", "Stillbirth abbreviation")
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    def __init__(self, value=None):
 | 
			
		||||
@@ -292,17 +296,20 @@ class EventType(GrampsType):
 | 
			
		||||
        Returns True if EventType is a birth fallback, False
 | 
			
		||||
        otherwise.
 | 
			
		||||
        """
 | 
			
		||||
        return self.value in [self.CHRISTEN,
 | 
			
		||||
                              self.BAPTISM]
 | 
			
		||||
        return self.value in [self.STILLBIRTH,
 | 
			
		||||
                              self.BAPTISM,
 | 
			
		||||
                              self.CHRISTEN]
 | 
			
		||||
 | 
			
		||||
    def is_death_fallback(self):
 | 
			
		||||
        """
 | 
			
		||||
        Returns True if EventType is a death fallback, False
 | 
			
		||||
        otherwise.
 | 
			
		||||
        """
 | 
			
		||||
        return self.value in [self.BURIAL,
 | 
			
		||||
        return self.value in [self.STILLBIRTH,
 | 
			
		||||
                              self.BURIAL,
 | 
			
		||||
                              self.CREMATION,
 | 
			
		||||
                              self.CAUSE_DEATH]
 | 
			
		||||
 | 
			
		||||
    def is_marriage(self):
 | 
			
		||||
        """
 | 
			
		||||
        Returns True if EventType is MARRIAGE, False otherwise.
 | 
			
		||||
 
 | 
			
		||||
@@ -266,7 +266,7 @@ class PeopleBaseModel(BaseModel):
 | 
			
		||||
            event = self.db.get_event_from_handle(er.ref)
 | 
			
		||||
            etype = event.get_type()
 | 
			
		||||
            date_str = get_date(event)
 | 
			
		||||
            if (etype in [EventType.BAPTISM, EventType.CHRISTEN]
 | 
			
		||||
            if (etype.is_birth_fallback()
 | 
			
		||||
                and er.get_role() == EventRoleType.PRIMARY
 | 
			
		||||
                and date_str != ""):
 | 
			
		||||
                if sort_mode:
 | 
			
		||||
@@ -323,9 +323,7 @@ class PeopleBaseModel(BaseModel):
 | 
			
		||||
            event = self.db.get_event_from_handle(er.ref)
 | 
			
		||||
            etype = event.get_type()
 | 
			
		||||
            date_str = get_date(event)
 | 
			
		||||
            if (etype in [EventType.BURIAL,
 | 
			
		||||
                          EventType.CREMATION,
 | 
			
		||||
                          EventType.CAUSE_DEATH]
 | 
			
		||||
            if (etype.is_death_fallback()
 | 
			
		||||
                and er.get_role() == EventRoleType.PRIMARY
 | 
			
		||||
                and date_str):
 | 
			
		||||
                if sort_mode:
 | 
			
		||||
@@ -367,8 +365,8 @@ class PeopleBaseModel(BaseModel):
 | 
			
		||||
                er.unserialize(event_ref)
 | 
			
		||||
                event = self.db.get_event_from_handle(er.ref)
 | 
			
		||||
                etype = event.get_type()
 | 
			
		||||
                if (etype in [EventType.BAPTISM, EventType.CHRISTEN] and
 | 
			
		||||
                    er.get_role() == EventRoleType.PRIMARY):
 | 
			
		||||
                if (etype.is_birth_fallback()
 | 
			
		||||
                    and er.get_role() == EventRoleType.PRIMARY):
 | 
			
		||||
                        place_title = place_displayer.display_event(self.db, event)
 | 
			
		||||
                        if place_title:
 | 
			
		||||
                            value = "<i>%s</i>" % escape(place_title)
 | 
			
		||||
@@ -407,8 +405,7 @@ class PeopleBaseModel(BaseModel):
 | 
			
		||||
                er.unserialize(event_ref)
 | 
			
		||||
                event = self.db.get_event_from_handle(er.ref)
 | 
			
		||||
                etype = event.get_type()
 | 
			
		||||
                if (etype in [EventType.BURIAL, EventType.CREMATION,
 | 
			
		||||
                              EventType.CAUSE_DEATH]
 | 
			
		||||
                if (etype.is_death_fallback()
 | 
			
		||||
                    and er.get_role() == EventRoleType.PRIMARY):
 | 
			
		||||
 | 
			
		||||
                        place_title = place_displayer.display_event(self.db, event)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user