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 dd0956d6ce
commit a339e68877
2 changed files with 25 additions and 12 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()
try: # should use if dbstate.is_open(), but not in gramps42
self.custom_types = dbstate.db.get_event_types()
except:
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)
try: # should use if dbstate.is_open(), but not in gramps42
self.custom_types = dbstate.db.get_family_relation_types()
except:
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)
try: # Should use if dbstate.isopen() but not in gramps42
self.custom_types = dbstate.db.get_event_types()
except:
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()