The "Biography" QuickView Report is now listed & documented

The Biography QuickView Report add-on is one of the most useful to configure with the Quick View shell gramplet. (The screen capture below has the Biography Quick Report in a detached/undocked Quick View Gramplet.)

Unfortunately, it is one of the add-ons that hasn’t made it to the Wiki. (See the “Talk” discussion page about the Gramps Add-ons wiki page. The Not Listed section itemizes add-ons that still are missing any documentation.)

The Biography Quick Report has no options and is fairly self explanatory. Because there’s nothing needing explanation, no wiki page has ever been generated for it. But, like all Quick Reports, it’s also quite invisible.

How can its profile be lifted out of “Easter Egg” status ?
[22 Aug 2022 : Added Addon:Biography Quickview wikipage and to the Addon list]

1 Like

Thank you for posting about this. I think I had noticed it long ago but forgot about it. It seems like it would be very useful for copying and pasting information into WikiTree. And maybe with a few changes, it could be formatted the way that WikiTree prefers for its biographies, sources, and research notes.

2 Likes

Yes. A WikiTree-styled Biography variant fork could be created (or maybe added as a Configuration option).

I’d like to see an option that added a simple list of Events that were NOT recognized and folded into the biography.

This is one of the FEW features where you can quickly Clipboard a plain language composition of information about the active person with events dates & places. (Noting that Copying the selected text to the OS Clipboard can only be done from the right-click context menu. The Copy keybinding tries to go to the Gramps clipboard but the selected text content is incompatible.)

The BiographyQuickView.py calls the narrator library (line 39: from gramps.plugins.lib.libnarrate import Narrator) to generate the text strings of the generated biography.

The included Names, Places and Dates all respond to the format editor customizations saved in the Display tab of the Gramps Preferences.

The narrator.get_died_string(True) on Line 82 generates a string that includes the calculated age… but does not reflect the Age format change.

Any idea where and how the narrator.get_died_string function should be hacked to use the Age format Preferences?

@emyoulation Good question. Learning how to access Gramps settings has been on my learning list, so I took the opportunity to dig around a little bit and found that gen/config.py configures preferences, and preferences.age-display-precision holds the setting that you’re looking for.

libnarrate.py doesn’t use the config class at the moment, so first it will need to be imported and after obtaining the age preference, apply it to format the age in __get_age_at_death, like this:

from gramps.gen.config import config

                if span:
                    age = span.format(config.get('preferences.age-display-precision'), False, self._locale)
                    age_index = _AGE_INDEX

I’m not 100% sure about the second parameter False so if this was going to be committed, someone with a better grasp of the date class would need to review it.

In addition to that, modifying this method also affects other plugins, but it should be better because it honors user settings: Ancestor Report, Detailed Ancestor Report, Detailed Descendant Report, Detailed Descendant Indented Tree, Detailed Descendant Book Report, and Detailed Descendant Report (these names may not be the exact addon/report names, but should be close).

Let me know if this works for you.

1 Like

Something seems wrong about that. The other 3 format configurations ARE being considered in other function calls to the libnarrate.py library.

So how do those function calls get around the Config class to format the Name, Date, & Place strings?

Note, Preferences throws up a warning (“Change is not immediate Changing the date format will not take effect until the next time Gramps is started.”), so the Name & Place reflect changes immediately but new date format is not used without restarting Gramps.

@emyoulation
Name and Place objects handled in libnarrator are being formatted using displayer classes, which in turn use config internally. At first glance it appears that Span classes don’t have equivalent displayer classes so libnarrator has converts it to a string, but doesn’t take into account user preferences.

The change I suggested fetches the preference passes it on to the formatter, but perhaps someone with stronger knowledge of Date and Span classes can tell us if there is an equivalent of displayer classes, which would make the change cleaner and more consistent.

BTW, the warning shown about Age settings not applying till Gramps restart is true for other parts of Gramps, but change I suggested in Biography Quick View report queries it at execution time so the current setting is used without restart.

Getting errors with the 2 lines changed in libnarrate.py
Changed line 2265
age = span.get_repr(dlocale=self._locale)
to
age = span.format(config.get('preferences.age-display-precision'), False, self._locale)
and then inserted new line 46
from gramps.gen.config import config

Will keep trying after posting this status report.

Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\plug\_manager.py", line 252, in load_plugin
    _module = self.import_plugin(pdata)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\plug\_manager.py", line 285, in import_plugin
    module = __import__(pdata.mod_name)
  File "C:\Users\DistrictSupport\AppData\Roaming\gramps\gramps51\plugins\BiographyQuickview\BiographyQuickview.py", line 40, in <module>
    from gramps.plugins.lib.libnarrate import Narrator
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\lib\libnarrate.py", line 2267
    age = span.format(config.get('preferences.age-display-precision'), False, self._locale)
                                                                                          ^
TabError: inconsistent use of tabs and spaces in indentation
QuickView Error: plugin does not load

When doing my earlier tests, I did not compare the Event data against what was generated. It turns our that the Age returned has other problems, even in the original incarnation. At no point does it include all 3 increments: years, months, & days.

The returned age omitted the Month. I assumed the example.gramps Home Person age just dropped a zero month. Which was the case:
He died on 28 June 1911 in Twin Falls, Twin Falls, ID, USA at the age of 56 years, 7 days.

So I added a month to the Death & Burial events to add a month. But then the Age text returned:
He died on 28 July 1911 in Twin Falls, Twin Falls, ID, USA at the age of 56 years, 1 month.

Just to see what happened, moved the Birth back a month. Which then returned:
He died on 28 July 1911 in Twin Falls, Twin Falls, ID, USA at the age of 56 years, 2 months.

Here’s the initial event data for :

Sorted events of Garner von Zieliński, Lewis Anderson Sr

0, Birth [E0001656], 21 June 1855, Great Falls, MT, USA, 2398756
1, Marriage [E0002815], 1 April 1875, Paragould, Greene, AR, USA, 2405980
2, Death [E0001657], 28 June 1911, Twin Falls, Twin Falls, ID, USA, 2419216
3, Burial [E0001658], 1 July 1911, Twin Falls, Twin Falls, ID, USA, 2419219

This is most likely due to a mix of tabs and spaces as the error message says. I uploaded a branch to my gramps fork with this change. You can fetch libnarrate.py from there by clicking on the ‘Raw’ button and saving it locally.

That worked! Thank you. The fussy (and too invisible) white space sensitivity is what I hate about Python.

Could you add a 2022 Copyright line to document your fix?

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