8725: Create Filter from the [xxxxx] selected, in Clipboard (and add use_regex)

This commit is contained in:
Doug Blank 2015-07-19 11:32:37 -04:00
parent 029241bae9
commit f30a353e15

View File

@ -35,7 +35,7 @@ def make_filter(dbstate, uistate, objclass, gramps_ids, title=None):
>>> make_filter(dbstate, uistate, 'Person', ['I0003', ...]) >>> make_filter(dbstate, uistate, 'Person', ['I0003', ...])
""" """
FilterClass = GenericFilterFactory(objclass) FilterClass = GenericFilterFactory(objclass)
rule = getattr(getattr(rules, objclass),'RegExpIdOf') rule = getattr(getattr(rules, objclass.lower()),'RegExpIdOf')
filter = FilterClass() filter = FilterClass()
if title is None: if title is None:
title = _("Filter %s from Clipboard") % objclass title = _("Filter %s from Clipboard") % objclass
@ -48,7 +48,9 @@ def make_filter(dbstate, uistate, objclass, gramps_ids, title=None):
'month': struct_time.tm_mon, 'month': struct_time.tm_mon,
'day': struct_time.tm_mday}) 'day': struct_time.tm_mday})
re = "|".join(["^%s$" % gid for gid in sorted(gramps_ids)]) re = "|".join(["^%s$" % gid for gid in sorted(gramps_ids)])
filter.add_rule(rule([re])) re_rule = rule([re])
re_rule.use_regex = True
filter.add_rule(re_rule)
filterdb = FilterList(CUSTOM_FILTERS) filterdb = FilterList(CUSTOM_FILTERS)
filterdb.load() filterdb.load()
EditFilter(objclass, dbstate, uistate, [], EditFilter(objclass, dbstate, uistate, [],