Adapt a built-in Report
A question was posted to the Discourse forum wondering if there were tips somewhere for copying an internal Gramps report to a make an experimental add-on?
It seems like more people would be intrigued with the possibilities of tweaking reports without the risk of breaking a feature. Particularly one that they use often enough that tweaking it seemed like a good idea.
Making a duplicate add-on sidesteps putting the original at risk. However, there are differences between built-ins and 3rd party add-ons. It seemed like that might require at least converting the library paths and making a new
.gpr.py registration file. What else?
In a private message, GaryG privately replied and sent a few copies of reports generated that address the question.
In the sample cases, Gary had taken the Detailed Ancestor and Detailed Descendant stock reports and added the ability to include *all* images for everyone. The Detailed individual report had that functionality, but the ancestor/descendant did not.
The important changes
- Change the Class names to be unique. Each report has 2 classes - one for the code and one for the report. In my cases, I added a trailing ‘i’.
- Change the name of the report styles. This is necessary if you are using books, not absolutely required if not. For the Descendant report I changed the style prefix from DDR to DDRI, for instance. I didn’t change the Ancestor report.
- Update the
.gpr.pyregistration file to point to the correct file and correct classes.
Attaching are 2 samples with the old (names ending with report.py) and the new code (names ending with reporti.py) as well as the revised
.gpr.py files. The old code may have changed since I wrote the new code quite a while ago - so every diff may not be important.
Sample Report Specifications
Stub, english (default)
Please update or expand this section.
À compléter !
Si vous pouvez aider à la traduction ou l'adapter à la culture francophone.
N'hésitez pas à améliorer cette page.
Embeddable Snippets (Subsection)
- Family Families
- more of the standard icons
Text formatting (Level 2 Subsection)
italic, bold, bold & italic
Images (Level 3 Subsection)
Annotations of User Activities (Level 4 Subsection)
Commands you type at the command line
- Filenames or
- Replaceable text
- Labels for buttons and other portions of the graphical interface
- hint text for roll-over tooltip hints that identify elements of the graphical interface
- Menu selections look like this: Menu ➡ Submenu ▶ Menu Item (always pad unicode symbols like these arrows with spaces so that robot translators see recognizable words)
- Pop-up menu down ▼ arrowhead, (triangle) button
- Buttons you can click
- CTRL+D see Keybindings for a list of keyboard combinations used in Gramps.
- Anything you type in
- Checked - Selected Checkbox ☑ template
- Unchecked - Checkbox that is ❏ unselected
Title of Tip