Improve event type defaults for new events in display tabs
svn: r13933
This commit is contained in:
parent
2997016c04
commit
7f2174b225
@ -187,8 +187,27 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
"""
|
||||
return ((1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5))
|
||||
|
||||
def default_types(self):
|
||||
return [
|
||||
gen.lib.EventType(gen.lib.EventType.MARRIAGE),
|
||||
gen.lib.EventType(gen.lib.EventType.DIVORCE),
|
||||
]
|
||||
|
||||
def default_type(self):
|
||||
return gen.lib.EventType(gen.lib.EventType.MARRIAGE)
|
||||
type_list = []
|
||||
|
||||
# combine return info into a single flat sequence
|
||||
|
||||
event = None
|
||||
for event_ref in self.get_data()[0]:
|
||||
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
|
||||
type_list.append(event.get_type())
|
||||
|
||||
_std_types = self.default_types()
|
||||
for etype in _std_types:
|
||||
if etype not in type_list:
|
||||
return gen.lib.EventType(etype)
|
||||
return _std_types[0]
|
||||
|
||||
def default_role(self):
|
||||
return gen.lib.EventRoleType(gen.lib.EventRoleType.FAMILY)
|
||||
|
@ -38,12 +38,6 @@ from BasicUtils import name_displayer
|
||||
from eventembedlist import EventEmbedList
|
||||
from eventrefmodel import EventRefModel
|
||||
|
||||
_std_types = [
|
||||
gen.lib.EventType(gen.lib.EventType.BIRTH),
|
||||
gen.lib.EventType(gen.lib.EventType.DEATH),
|
||||
]
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PersonEventEmbedList
|
||||
@ -101,20 +95,12 @@ class PersonEventEmbedList(EventEmbedList):
|
||||
def default_role(self):
|
||||
return gen.lib.EventRoleType(gen.lib.EventRoleType.PRIMARY)
|
||||
|
||||
def default_type(self):
|
||||
type_list = []
|
||||
|
||||
# combine return info into a single flat sequence
|
||||
|
||||
event = None
|
||||
for event_ref in self.get_data()[0]:
|
||||
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
|
||||
type_list.append(event.get_type())
|
||||
|
||||
for etype in _std_types:
|
||||
if etype not in type_list:
|
||||
return gen.lib.EventType(etype)
|
||||
return gen.lib.EventType(gen.lib.EventType.BIRTH)
|
||||
def default_types(self):
|
||||
return [
|
||||
gen.lib.EventType(gen.lib.EventType.BIRTH),
|
||||
gen.lib.EventType(gen.lib.EventType.DEATH),
|
||||
gen.lib.EventType(gen.lib.EventType.BURIAL),
|
||||
]
|
||||
|
||||
def get_ref_editor(self):
|
||||
from gui.editors import EditEventRef
|
||||
|
Loading…
Reference in New Issue
Block a user