Say I want to make all my “reserarch” notes private.
Is there any way I can do it other than editing them one by one?
Say I want to make all my “reserarch” notes private.
Is there any way I can do it other than editing them one by one?
Set up a Custom Filter that finds all the “Research” notes.
If it was a Person, Event, or Media; then you could have used the Set Privacy addon tool (Tools → Family Tree Processing → Set Privacy… ) with that filter.
You might ask @Mattkmmr if he would expand his Set Privacy tool to handle Notes too. When someone had a similar inquiry about setting Event privacy en masse, he knocked out a very quick and powerful enhancement to his Set Privacy tool.
Thanks for the info and the links. I’m not a technical user, so unfortunately writing a script is not an option for me.
I have a small DB, It doesn’t take much time to change manually all my notes, so is not really a problem in my case. I simply assumed that this kind of batch editing was possible with the core program but I was unable to find a way to do it.
Having said that, it would be nice if the Set Privacy Tool would support notes too.
The script was REALLY easy to adapt.
Here, I’ve gone into the Notes category and created a Custom Filter for “Source Note” type Notes.
(Using the Example.gramps tree, this filtered to 2 of that tree’s 19 Notes. Always learn a new technique using a fresh import of the Example.gramps
file into a new blank tree.)
Then with the Notes category active, open Isotammi’s SuperTool addon tool and use File
→ Open
to load the script transcribed below. Test the script with the Execute… but make certain to set the “Filtered objects” radio button and have “Commit changes” deselected until after successful testings. After confirming the list shows the correct records would update, enable the “Commit changes” and Execute a final time.
View
→ Configure
options
Save the following as text file named : SuperTool-Notes Privacy.script
[Gramps SuperTool script file]
version=1
[title]
SuperTool-Notes Privacy
[category]
Notes
[initial_statements]
# A simple script to change the Gramps Privacy "padlock" Oct2022 # of filtered Notes to locked
# completely UNSAFE. Make a backup before running
# source: https://gramps.discourse.group/t/how-to-set-private-record-for-multiple-people/2885/3
[statements]
myinitprivacy = note.get_privacy()
note.set_privacy(True)
myendprivacy = note.get_privacy()
[filter]
[expressions]
note, myinitprivacy, myendprivacy
[scope]
filtered
[unwind_lists]
False
[commit_changes]
True
[summary_only]
False
The only line that’s vital in the script above is:
[statements]
note.set_privacy(True)
All the rest is about feedback & double-checking myself.
I think if you change note by obj that script will be available in any category
Thanks again, I’ve done the job manually already, but I’ll keep on eye on this thread if I need to do this in the future.
[Gramps SuperTool script file]
version=1
[title]
SuperTool-Set Privacy
[category]
[initial_statements]
# SuperTool-Set Privacy.script : A simple script to change the Gramps Privacy "padlock" of View objects to locked
# Completely without error handling. Make a backup before running
# discussion: https://gramps.discourse.group/t/batch-editing-elements/3552
# 23 Apr 2023 B.McCullough
[statements]
myinitprivacy = obj.get_privacy()
obj.set_privacy(True)
myendprivacy = obj.get_privacy()
[filter]
[expressions]
obj, myinitprivacy, myendprivacy
[scope]
selected
[unwind_lists]
False
[commit_changes]
False
[summary_only]
False
Since this thread was written, a SuperTool extension (getargs.py
or GetArguments) has been added to allow User selectable input to offer a pop-up list or checkbox in addition to a type-in textbox.
So now there is a Checkbox that lets you Set Privacy if selected, and Clear Privacy if deselected:
@include
statement to make those option available. For now, that script reads:
[Gramps SuperTool_beta script file]
version=1
[title]
SuperTool-Object Privacy
[category]
People
[initial_statements]
# A simple script to change the Gramps Privacy "padlock" Oct2022 # of selected Category object to locked
# completely UNSAFE. Make a backup before running
# based on: https://gramps.discourse.group/t/how-to-set-private-record-for-multiple-people/2885/3
@include getargs.py
args = getargs2(myTestLevel=("Set Privacy: ", bool, True))
counter = 0
[statements]
myInitPrivacy = obj.get_privacy()
if obj.get_privacy() != args.myTestLevel:
obj.set_privacy(args.myTestLevel)
counter +=1
else:
None
[filter]
[expressions]
name, myInitPrivacy, obj.get_privacy(), counter
[scope]
selected
[unwind_lists]
False
[commit_changes]
False
[summary_only]
False