Learning Gramps development by example snippets

Several plug-ins have hard-coded data which is subject to linkrot (like the Web Connect Packs) or which need regular cultivation (like Sync Associations).

The SuperTool has examples of 3 external files being referenced: the configuration .ini file (in the Plugins folder), .script files (selected from a GTK file chooser), and a helptext.txt file which has data for setting a hotlink and tooltip (in the same folder with the Addon). An upcoming release will use .json instead of .txt for the helptext file.

Are there better examples of reading external files (using standard parsing libraries) for use/display in plugins?
e.g., .csv, .xml/.gramps, .md, .html

I've lost track of a number of sample code snippets that would have been nice to use as references. Including examples showing common code-quality evolution that would be useful to Developers learning the Gramps API or Gtk idiosyncrasies. (One is particularly bothersome. I've volunteered intensive beta testing for about a half-dozen developers... and they have been very receptive to feedback. One kindly did a specific quick improvement to their add-on. And even commented the code so the commit could be better used as an example. Now I've lost track of that before finding a good place to link it in the developer tutorials.)

There’s a Useful Snippets subsection in Sphinx (documentation generator) and CMS for the Gramps API. But it is a forlorn section, abandoned with a lonely single entry with a vague “The Html Class” label, (Linked to a page that is unfortunately lacking any example code snippet.) Unlike the wiki, there is no apparent way for end-users of the documentation contribute new content for the structured Sphinx documentation. (It might also be difficult for developers if the sphinx.ext.doctest extension isn’t active.)

And there are hints about common stumbling blocks in development scatter around the forum too:

By any chance, were you thinking of Gary Griffin’s Sample Report?

No… although that’s an important one to cross-reference.

This was a correction for a common oversight when people start developing plug-ins. Like adding CLI mode support or language translation support.

You might have been thinking of adding batch option to SyncAssociation

That may be it! Thanks!

However, this far after the discussion, I find the comment on line #103 not very enlightening.

Instead of :
# Add Batch Tool check

How about:
# Add warning dialog for Batch Tool: Irreversible changes with bailout option

Updated PR to reflect comment change

1 Like

And still cannot find a good place to link this example. The wiki doesn’t yet have a simple tutorial for creating a Tool addon.

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