diff --git a/gramps/gui/filters/sidebar/_familysidebarfilter.py b/gramps/gui/filters/sidebar/_familysidebarfilter.py index e931a08fe..7f0f6804c 100644 --- a/gramps/gui/filters/sidebar/_familysidebarfilter.py +++ b/gramps/gui/filters/sidebar/_familysidebarfilter.py @@ -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 diff --git a/gramps/gui/filters/sidebar/_personsidebarfilter.py b/gramps/gui/filters/sidebar/_personsidebarfilter.py index fc362b329..9810d2486 100644 --- a/gramps/gui/filters/sidebar/_personsidebarfilter.py +++ b/gramps/gui/filters/sidebar/_personsidebarfilter.py @@ -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()