Hello,
I have used a Supertool script to list attributes of people, events, sources and citations.
In Expressions to display I have Gramps_id, title, attribute and it works well.
How to display only non private attributes and how to make them private?
Thank you pour your answer!
Since the ‘Private’ lock (and ‘probably living’ filter) is normally only considered during export and report generation, perhaps you ought to clarify what your goal is in setting Privacy on all the secondary objects?
Generally, when locking the Privacy on a Person, the secondary objects are going to be omitted from the export/report when the Person is omitted.
Setting additional locks might be work that you don’t need to do.
(Note that I generally mark all eMail addresses as Private as well as my Research Notes that are logs of discussion threads. Those secondary objects are clearly modern with living people and it is difficult to predict where people will feel confidentiality was implied.)
Thank you emyoulation,
I use attributes for personal informations and researchs in people, events, sources, citations, and I don’t want them to be exported. For this, I want to make them private.
In Supertool is it possible to display the “private statut” of these attributs in people, events, sources and citations? And to make them private?
Yes. The script can be Execute without the “Commit changes” option selected to show the current status and what the status would be after ‘committing’. Here, I have used the script in Places category with a few places selected from the Example.gramps sample tree. (Added a "longname, type, " to the Expressions to Display to make the results more human-readable):
Just making certain that your goal is to set the Privacy so these items can be excluded in a subsequent Export or for Reports, right? Since there is no global Privacy redaction for data in the GUI. (The filter gramplets can hide stuff… but it is sloooowwwww and would have to be filtered at each separate view.)
Given the above assumption, your script above is not doing a .set_privacy(True) for any of the attribute objects being listed. So even if the ‘commit changes’ was set, it doesn’t make the change. (Since I don’t like changing values in the blind, I always .get_privacy() to read the original privacy flag setting, list that and then the updated value. It is reassuring to do a test run without committing changes first.)
Unfortunately Patrice’s code does not work because ‘attributes’ is just a list of (name,value) tuples and does not give access to the underlying Gramps Attribute objects. Maybe that was a bad design decision but that is how it works.
Instead you could use the lower-level Gramps method ‘get_attribute_list’, something like
for attr in obj.get_attribute_list():
if not attr.get_privacy():
attr.set_privacy(True)
[Gramps SuperTool script file]
version=1
[title]
Attributs_des_sources - 3 --> OK
[category]
Sources
[initial_statements]
#
# Mise en privé des attributs de la source
#
[statements]
for attr in obj.get_attribute_list():
#
# voir test si pas d'attribut
#
myinitprivacy = attr.get_privacy()
if not attr.get_privacy():
attr.set_privacy(True)
myendprivacy = attr.get_privacy()
[filter]
gramps_id
[expressions]
gramps_id, title, attributes, myinitprivacy, myendprivacy
[scope]
selected
[unwind_lists]
True
[commit_changes]
False
[summary_only]
False
Thank you emyoulation, PLegoux and kku for your answers!
You should add some comments that describe the purpose of the script and a URL of this discussion.
A library of saved scripts gets unruly very quickly. So you need strict organization workflows. (It is similar with the more complex custom filters.)
Also, add a bookmark in the GTK File Chooser dialog so you can find your saved scripts easily. (I bookmarked the Gramps User Directory and have a folder for my scripts there.)