Creating a Custom Filter by scraping

Kari is developing a new functionality in SuperTool. This feature looks at the current Gramps Filter and scrapes the parameters to create a new Custom Filter.

Such a custom filter would have a lot of uses. Prime example: reports, tools, and exports may be quickly filtered to match contents of a view.

(This eases the convoluted and slow process of: filtering a view, create a new tag, select all the object in the view, apply the tag, create a custom filter on the tag, use the filter with the report, tool, or export. Then clean up the tag & tag filter.)

But in conjunction with the FilterParams tool, using a scraped filter also creates a more advanced version of the Filter Gramplet with additional limits for some of the Filter Gramplet fields. In a scraped People Filter Gramplet, the original Death parameter only accepts a Date. But in the scraped version, you can also look for the Death Place or part of a Description. And you can apply the Regular Expressions controls with more granularity.

Now @kku is trying to determine whether this would be better as a part of SuperTool or as a separate Tool. As it stands now, there aren’t any options that would require SuperTool’s flexible controls. It just pops a dialog for choosing a name for the script. Nor would you likely run it repeatedly in a short span. So that suggests becoming a separate Tool.

But would there be use cases for this feature WITHIN SuperTool too?

This feature parallels a much more simplistic (but GUI accessible) option in the Clipboard. (Although context menus are often overlooked to the point of becoming “easter eggs”.) The “Create filter from the <object type> selected…” context menu option allows a Custom Filter to be automatically generated for the selected object(s).

Maybe it would be better to beta test the feature as a 5.1 Tool addon so that the bugs can be shaken out. Then the addon could be deprecated by rolling it into the core. Maybe as a new pop-up menu for the Filter Gramplets in 5.2? This would simplify contextual access and be consistent with existing GUI. Or, since a contextual menu with a single option is generally frowned upon, another button might be added beside the Find and Reset buttons at the bottom of the Filter Gramplets.