* src/DisplayTabs/_PersonEventEmbedList.py: fix selection of default type

svn: r6675
This commit is contained in:
Don Allingham 2006-05-15 21:59:14 +00:00
parent d7c9ed7be5
commit f4424a4c2c
2 changed files with 12 additions and 8 deletions

View File

@ -2,6 +2,7 @@
* src/GrampsDb/_DbUtils.py: import proper class. * src/GrampsDb/_DbUtils.py: import proper class.
2006-05-15 Don Allingham <don@gramps-project.org> 2006-05-15 Don Allingham <don@gramps-project.org>
* src/DisplayTabs/_PersonEventEmbedList.py: fix selection of default type
* src/Filters/__init__.py: add SidebarFilter, PersonSidebarFilter * src/Filters/__init__.py: add SidebarFilter, PersonSidebarFilter
* src/Filters/_SidebarFilter.py: added * src/Filters/_SidebarFilter.py: added
* src/Filters/_PersonSidebarFilter.py: added * src/Filters/_PersonSidebarFilter.py: added

View File

@ -36,6 +36,12 @@ import RelLib
from DdTargets import DdTargets from DdTargets import DdTargets
from _EventEmbedList import EventEmbedList from _EventEmbedList import EventEmbedList
_std_types = [
RelLib.EventType(RelLib.EventType.BIRTH),
RelLib.EventType(RelLib.EventType.DEATH),
]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# PersonEventEmbedList # PersonEventEmbedList
@ -58,17 +64,14 @@ class PersonEventEmbedList(EventEmbedList):
def default_type(self): def default_type(self):
type_list = [] type_list = []
ref_list = [ e for e in [self.obj.get_birth_ref(), self.obj.get_death_ref()] + \ ref_list = [ ref for ref in self.return_info() if ref ]
self.obj.get_event_ref_list() if e ]
event = None event = None
for event_ref in ref_list: for event_ref in ref_list:
event = self.dbstate.db.get_event_from_handle(event_ref.ref) event = self.dbstate.db.get_event_from_handle(event_ref.ref)
type_list.append(int(event.get_type())) type_list.append(event.get_type())
if event: for etype in _std_types:
etype = event.get_type()
for etype in [RelLib.EventType.BIRTH, RelLib.EventType.DEATH]:
if etype not in type_list: if etype not in type_list:
return RelLib.EventType(etype) return RelLib.EventType(etype)
return RelLib.EventType(RelLib.EventType.BIRTH) return RelLib.EventType(RelLib.EventType.BIRTH)