I looked into what the References tabs are showing. They are the backlinks
, not the list of secondary objects.
[Gramps SuperTool script file]
version=1
[title]
People Backlinks (see Print output tab)
[description]
find the `backlinks` shown in References tab in People object editor. `find_backlink_handles(handle)`
https://github.com/gramps-project/gramps/blob/maintenance/gramps52/gramps/plugins/gramplet/backlinks.py5
https://gramps.discourse.group/t/need-to-add-the-references-tab-to-family-window/7135/5
[category]
People
[statements]
handle = obj.handle
backlinks = db.find_backlink_handles(handle)
print(f"Backlinks for {category} ({handle}): {gramps_id}")
for class_name, bhandle in backlinks:
obj_id = None
if class_name == 'Person':
obj_id = db.get_person_from_handle(bhandle).gramps_id
elif class_name == 'Family':
obj_id = db.get_family_from_handle(bhandle).gramps_id
elif class_name == 'Event':
obj_id = db.get_event_from_handle(bhandle).gramps_id
elif class_name == 'Place':
obj_id = db.get_place_from_handle(bhandle).gramps_id
elif class_name == 'Source':
obj_id = db.get_source_from_handle(bhandle).gramps_id
elif class_name == 'Citation':
obj_id = db.get_citation_from_handle(bhandle).gramps_id
elif class_name == 'Repository':
obj_id = db.get_repository_from_handle(bhandle).gramps_id
elif class_name == 'Media':
obj_id = db.get_media_from_handle(bhandle).gramps_id
elif class_name == 'Note':
obj_id = db.get_note_from_handle(bhandle).gramps_id
print(f"- {class_name}: {bhandle} (ID: {obj_id})")
[scope]
selected
returns (for Home Person of example.gramps)
Backlinks for People (GNUJQCL9MD64AM56OH): I0044
- Person: Q8HKQC3VMRM1M6M7ES (ID: I1200)
- Family: 9OUJQCBOHW9UEK9CNV (ID: F0017)
- Person: VJFKQCFO7WESWPNKHE (ID: I1106)
- Note: ac380498bac48eedee8 (ID: N0001)
- Note: d0436be64ac277b615b79b34e72 (ID: _custom1)
- Note: f68ce7c9cc166a6424e4fe11a1f (ID: N0024)
- Family: 8OUJQCUVZ0XML7BQLF (ID: F0018)
Every reference instead of (or optionally) just backlinks
@PLegoux Do you want to request an enhancement for all the References tabs? (6.0 PR#1832 will give a bit more functionality to the tab with a context menu.)
[Gramps SuperTool script file]
version=1
[title]
People Secondary Objects (see Print output tab)
[description]
find the "Secondary objects", augments the References tab in People object editor. (`get_referenced_handles_recursively`)
https://github.com/gramps-project/gramps/blob/maintenance/gramps52/gramps/plugins/gramplet/backlinks.py5
https://gramps.discourse.group/t/need-to-add-the-references-tab-to-family-window/7135/5
[category]
People
[statements]
handle = obj.handle
secondarylinks = obj.get_referenced_handles_recursively()
print(f"Secondary links for {category} ({handle}): {gramps_id}")
for class_name, bhandle in secondarylinks:
obj_id = None
if class_name == 'Person':
obj_id = db.get_person_from_handle(bhandle).gramps_id
elif class_name == 'Family':
obj_id = db.get_family_from_handle(bhandle).gramps_id
elif class_name == 'Event':
obj_id = db.get_event_from_handle(bhandle).gramps_id
elif class_name == 'Place':
obj_id = db.get_place_from_handle(bhandle).gramps_id
elif class_name == 'Source':
obj_id = db.get_source_from_handle(bhandle).gramps_id
elif class_name == 'Citation':
obj_id = db.get_citation_from_handle(bhandle).gramps_id
elif class_name == 'Repository':
obj_id = db.get_repository_from_handle(bhandle).gramps_id
elif class_name == 'Media':
obj_id = db.get_media_from_handle(bhandle).gramps_id
elif class_name == 'Note':
obj_id = db.get_note_from_handle(bhandle).gramps_id
print(f"- {class_name}: {bhandle} (ID: {obj_id})")
[scope]
selected
returns (for Home Person of example.gramps)
Secondary links for People (GNUJQCL9MD64AM56OH): I0044
- Family: 9OUJQCBOHW9UEK9CNV (ID: F0017)
- Family: 8OUJQCUVZ0XML7BQLF (ID: F0018)
- Note: ac380498c020c7bcdc7 (ID: N0003)
- Note: b39ff01f75c1f76859a (ID: N0013)
- Note: b39ff11d8912173cded (ID: N0014)
- Note: c140d4c29520c92055c (ID: N0015)
- Citation: c140d5e5dbf300411bf (ID: C2831)
- Citation: c140d25efc045ab2ea5 (ID: C0974)
- Citation: c140d25efe703834da4 (ID: C0975)
- Citation: c140d53ab8b377b4174 (ID: C2828)
- Citation: fb471c4e917139fd7ee300b9b28 (ID: C02863)
- Tag: bb80c2b235b0a1b3f49 (ID: None)
- Citation: c140d56d19a1ced4c7a (ID: C2829)
- Media: B1AUFQV7H8R9NR4SZM (ID: O0008)
- Media: 238CGQ939HG18SS5MG (ID: O0010)
- Note: ac380498bac48eedee8 (ID: N0001)
- Citation: c140d25ef1c0e90ee81 (ID: C0973)
- Citation: c140d5aa362797c32d4 (ID: C2830)
- Citation: c140d5e5dbf300411bf (ID: C2831)
- Citation: c140d73a2ca52f37800 (ID: C2835)
- Place: WTAKQCGG8L8LYZCSBB (ID: P1643)
- Family: 8OUJQCUVZ0XML7BQLF (ID: F0018)
- Note: ac3804a8405171ef666 (ID: N0006)
- Citation: c140d694e647717b683 (ID: C2832)
- Citation: f7074a2495c517d87df60cd47ab (ID: C2857)
- Person: VJFKQCFO7WESWPNKHE (ID: I1106)
- Person: Q8HKQC3VMRM1M6M7ES (ID: I1200)
- Citation: c140d694e647717b683 (ID: C2832)
- Person: VJFKQCFO7WESWPNKHE (ID: I1106)
- Event: a5af0ecb107303354a0 (ID: E1656)
- Citation: c140d7c7bdc1fedb030 (ID: C2836)
- Event: a5af0ecb11f5ac3110e (ID: E1657)
- Event: a5af0ecb12e29af8a5d (ID: E1658)