A new WebSearch gramplet is ready

I like that the addon is writing a separate WebSearch .ini file. But wonder if the folder in gramps/gramps52/plugins is “survivable” enough?

Perhaps it should make a folder somewhere in the gramps set of folders instead? And search that location for additional (custom) CSV and JSON to augment the distribution copies.

This would allow custom files survive an uninstall/re-install cycle of the addon via the Plugin Manager of an upgrade to a new major release of Gramps. On the flip side, if corrupted .ini and/or custom files are the problem that a person is troubleshooting, that would make uninstall/re-install ineffective when trying to fix the cause. Hmmmm. That’s a judgement you’ll have to decide.

Regarding future proofing… I have a gut feeling that Gramps .ini files should log the Gramps Version and plugin version. But the core module managing this data does not support that. Sooner or later that lack will bite us when a saved preference/configuration cannot be backward compatible.

Now the gramplet columns can be reordered using drag&drop. The columns order is saved to config.

2 Likes

And again agree. I think I can add one additional UI setting with path to addational data (csv and json). If filename is the same - then we should use users’ files instead of native. These files will be safe when the gramplet is updating

1 Like

I think in new versions it will be possible to circumvent this problem with additional checks in the code. For example:

if has config.ini:
    use settings 1,2,3 from config.ini
    use settings 4,5 from config.v2.ini
else:
    use settings 1,2,3,4,5 from config.v2.ini

Did you mean this?

Close but was thinking that the test might be more simple with versioning. Such as if you had a complete configuration redesign with version 0.36.0, the test .ini versioning. If the ini’s gramps version is <5.0.0 or it’s WebSearch version is < 0.36.0 then flush the .ini totally. If you only re-use a path attribute from versions before 1.0.0, discard the earlier version .ini attributes that don’t have those attribute names.

I created my-links.csv and added it to the csv folder. So long as a list is not added for Malaysia I am safe.

And using my three initials works (so long as your initials are not UID).

2 Likes

In the past, I’ve accidentally used the uninstall in the Plugin Manager Enhanced instead of the Hide. And lost my tweaks to that addon. (Because Uninstall does not move the file to the Trash, it deletes.)

So when @Urchello leverages a different folder somewhere in the parentage of gramps/gramps52/plugins/WebSearch, I will feel more secure.

I dont know how it works for different OS. How can I get a directory where all addons can save data across all OS?

looks like custom-css files are are saving there. But I dont know where and how get the directory path from the gramplet source code

There’s a script example in this thread:

1 Like

Why not just make it gramps/gramps52/plugins

Gramps builds a list of constants that define where things are stored.
USER_PLUGINS defines where plugins are stored regardless of OS. Check out gramps\gen\const.py

2 Likes

thank you!
I will check it tomorrow and probably will make necessary updates

1 Like

The MANIFEST file needs corrected.

  1. Entries should start with the gramplet folder name (whatever you use when moving to git). For instance,
    WebSearch/assets/style.css
  2. You can use wildcards to make it easier. For instance,
    WebSearch/assets/csv/*

You can look at some of the other gramplets that use a MANIFEST -

D3Charts/MANIFEST
DynamicWeb/MANIFEST
GeoAncestor/MANIFEST
GeoTimeLines/MANIFEST
GraphView/MANIFEST
Heatmap/MANIFEST
HtreePedigreeView/MANIFEST
LifeLineChartView/MANIFEST
QuiltView/MANIFEST
TimePedigreeHTML/MANIFEST
TimelinePedigreeView/MANIFEST
lxml/MANIFEST
2 Likes

Done. Thanks!

1 Like

A new optional “Vars” column is added. It shows two digits:

  1. how many variables are found and replaced
  2. total count of variables in url template

The column is turned off by default.

1 Like

Done. I used this path:

from gramps.gen.const import USER_DATA

On my PC with Ubuntu:

user@user-desktop:~/.local/share/gramps/WebSearch$ ls
csv  json

If a user-defined file exists in this location, it will automatically override the default version with the same file name.
And one more UI icon (can be disabled in settings) is added for links which are loaded from the USER_DATA directory

Release: Release v.0.38.22 · jurchello/WebSearch · GitHub

Can you also integrate this German search engine?

1 Like

I had to confirm which folder that was. When I moved my-links.csv file there there was no recognition of the file. After searching your code files, I finally found out you created a user’s version of the WebSearch folder structure. My file is now recognized

2 Likes

Flag icons added instead of textual locales, as optional
uk-links.csv renamed to gb-links.csv

1 Like

I dont understand which variables to use: given, middle, surname,… Also, do you mean seach on the homepage only? It would be great if you give me a search link with some testing search data.