Can add-on gramplets use the Lib plugin type to supersede built-ins?

The Isotammi Filter+ addon gramplets by @kku are direct replacements (with a couple extra features) for the built-in Filter gramplets.

It is a tedious process to replace those built-ins in the sidebars of all categories after an update to Gramps, a reset to defaults or the clearing of the gramps sidebar.ini files. This means that fewer users switch over to the more capable gramplets and increases the chance the enhanced version will disappear in the future.

Could those Gramplets use a different plug-in type to supplant the Filters built-in call?

Alternately, what scriptable Python function could be used to swap one Gramplet for another… instead of using the GUI to do it manually?

Another option would be to target replacing the built-in Filter gramplets for the 5.3 release.

Kari has suggested layout improvement patches by anyone with Glade experience would be welcome. He wants to concentrate on adding functionality, rather than exploring the Gramps UI style guide and Glade layout in English.

So repositioning the Define filter button and “Elapsed time” performance counter onto the line with Find and ⮪Reset buttons might make sense. (And give an opportunity to have more separation between the most frequently used (Find) and most perilous (⮪Reset) buttons.

Both the Filter and Filter+ gramplets only have a Help button when undocked from the Sidebar. Since both the “Custom Filter” and “Use regular expressions” are complex enough to have enormous need for easy access to help. Hotlinks on the feature labels might be an option.

(A RegEx help will be useful for anyone who doesn’t use the feature often enough to remember the correct syntax to search for “Empty” or “not empty”. A complete exploration of RegEx is beyond the scope of our wiki. But an improved introduction with pointers to complete references and a few common samples is reasonable.)

Could those Gramplets use a different plug-in type to supplant the Filters built-in call?

I don’t see a way to do this. I don’t quite understand the idea though.

Alternately, what scriptable Python function could be used to swap one Gramplet for another… instead of using the GUI to do it manually?

I don’t see a practical way to do this either. Maybe it could be done with some tricky code but it doesn’t seem to be worth the effort.

I looked through the Sphinx-based developer docs and didn’t really see a way either. (But that doesn’t mean much. I have problems following that documentation format.)

I was thinking that there might be a way to walk through the Preferences for each Category looking for Filter gramplets and, if found, check for a Filter+ in that category and swap it in.

An example would be useful for other projects to manipulate gramplet sets too. (I was thinking of a script to do several dashboard sets or to select between a Novice set of preferences and an Expert set.

Why don’t we just replace the Filter gramplets with the Filter+ gramplets in v5.3?

I don’t see any disadvantages. They just add a little more functionality, but are as easy to use as the originals.

2 Likes

That seems like the most straightforward decision.

Would it require rolling in the “Generic <object> filter” set of Rules too? Are they needed for scraping the parameters? From the GUI, it looks like scraping just needs the standard Custom Filter and built-in rules.

(Should those Generics be named as Rules rather than Filters?)

I’m not entirely sure if this is what you mean, but my forms gramplet settings addon I’ve been developing builds a bunch of interfaces from template files on launch. To switch between them I have been using a gtk.Stack() object whose visible child is determined by a selection from a treeview object.

Which results in this being possible:


So you could probably create a unifying gramplet that contains both interfaces in a gtk.Stack() and just tie which one is visible to a selector.

2 Likes

That’s very interesting for interactively showing and hiding interface items within a gramplet.

But I was thinking more about the organization of the Gramplet sets in the splitbars (sidebar and bottombars of the various View modes of the Categories) and the Dashboard rather than the features of the Gramplets themselves. Given that there are 13 Categories and 5 of those have multiple view modes, there are too many Configurations to manage efficiently with a manual process.

As an example, there are about 23 separate view mode sidebars which default to having category-specific instances of the Filter gramplet. (More when you start installing add-on view modes.) Each has a separate _sidebar.ini config file once the view mode has been active.

And when trying to manipulate the GUI, it is preferable to stay within the gramps.gui module and leverage the callback methods’s handling of signals.

1 Like

I created a pull request: Enhanced version of the Filter gramplet by kkujansuu ¡ Pull Request #1721 ¡ gramps-project/gramps ¡ GitHub

The Filter+ addon used some kind of “monkey-patching”. Therefore I thought it is better to implement this in a “proper” way by making the corresponding changes to Gramps main code, mainly to gramps.gui.filters.sidebar.SidebarFilter.

Note that this my first PR ever - let me know if there are any issues.

3 Likes

The following quote from the PR#1721 comments describes the changes:

This is an enhanced version of the Filter gramplet. The enhancements are:

  1. The elapsed time is displayed.
  2. A new ‘Define filter’ button that opens a filter editor dialog and automatically populates it with the rules that correspond to values given in the gramplet.
  3. The person filter has two new fields: Birth place and Death place
  4. The default confidence value in the Citation filter is ‘Very low’.
  5. Place filter: An error message is displayed if the user fills in the ‘Within’ value but no place is active
1 Like

I just discovered an oddity in the add-on Filter+ for the People category’s flat list view mode. The Birth date and Death date fields have a validation error red border and non-functional “x” button when the field is blank.

The Grouped view mode for Filter+ (and the original Filter gramplets) only have the red border and (still non-functional) ‘x’ button when the field is non-blank with an unparsable date text.

Does this occur the 5.3 Filter that has the Filter+ features addition?

Not seeing it on Win10. Filter+ version 1.0.9

The error coloring is created by your theme. i.e. red border verses red lettering or a full red box. I am currently using YaruOK. My theme adds a red circle on error where you are showing the X.

To be clear, I am not showing any errors.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.