Fix Person, Family Sidebar Filters to add custom Event types

Fixes #10112
Also fix Family Sidebar Filter RelType init with closed db
This commit is contained in:
prculley 2017-12-01 15:21:26 -06:00 committed by Nick Hall
parent d624d4a0bb
commit d8057c2b0b
2 changed files with 23 additions and 10 deletions

View File

@ -67,21 +67,29 @@ class FamilySidebarFilter(SidebarFilter):
self.filter_event = Event()
self.filter_event.set_type((EventType.CUSTOM, ''))
self.etype = Gtk.ComboBox(has_entry=True)
self.family_stub = Family()
self.family_stub.set_relationship((FamilyRelType.CUSTOM, ''))
self.rtype = Gtk.ComboBox(has_entry=True)
self.custom_types = dbstate.db.get_family_relation_types()
if dbstate.is_open():
self.custom_types = dbstate.db.get_event_types()
else:
self.custom_types = []
self.event_menu = widgets.MonitoredDataType(
self.etype,
self.filter_event.set_type,
self.filter_event.get_type)
self.filter_event.get_type,
custom_values=self.custom_types)
self.filter_family = Family()
self.filter_family.set_relationship((FamilyRelType.CUSTOM, ''))
self.rtype = Gtk.ComboBox(has_entry=True)
if dbstate.is_open():
self.custom_types = dbstate.db.get_family_relation_types()
else:
self.custom_types = []
self.rel_menu = widgets.MonitoredDataType(
self.rtype,
self.family_stub.set_relationship,
self.family_stub.get_relationship,
self.filter_family.set_relationship,
self.filter_family.get_relationship,
custom_values=self.custom_types)
self.filter_note = widgets.BasicEntry()
@ -139,7 +147,7 @@ class FamilySidebarFilter(SidebarFilter):
child = str(self.filter_child.get_text()).strip()
note = str(self.filter_note.get_text()).strip()
etype = self.filter_event.get_type().xml_str()
rtype = self.family_stub.get_relationship().xml_str()
rtype = self.filter_family.get_relationship().xml_str()
regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
generic = self.generic.get_active() > 0

View File

@ -78,10 +78,15 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_event = Event()
self.filter_event.set_type((EventType.CUSTOM, ''))
self.etype = Gtk.ComboBox(has_entry=True)
if dbstate.is_open():
self.custom_types = dbstate.db.get_event_types()
else:
self.custom_types = []
self.event_menu = widgets.MonitoredDataType(
self.etype,
self.filter_event.set_type,
self.filter_event.get_type)
self.filter_event.get_type,
custom_values=self.custom_types)
self.filter_note = widgets.BasicEntry()
self.filter_gender = Gtk.ComboBoxText()