Customize reports with XML tool

From Gramps
Revision as of 15:52, 26 March 2021 by JohnRSibert (talk | contribs) (Initial commit of How To for managing xml)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Gnome-important.png
🚧 Work In Progress

This wikipage is an outline from a template being roughed in. Please don't edit just yet. Instead, contribute suggestions on the Discussion page.

This page is not planned be linked to a public page until about 2 weeks after 26 March 2021.

If this notice remains after that date, please feel welcome to remove this notice and consider the content 'fair game' for unlimited editing.

See also

The Group As name override
unify similar surmanes [sic] thread
threads with "Group As name"



Paste the raw Tutorials outline for the How Do I... article above the See also section. This might start with pasting in a copy of a useful thread from one of the Gramps maillists.


Saving this file as a 'work in progress' will insert the code behind this reference template. (Preview only show the results, not the markup formatting control.) You can use the appended special formatting example template to pre-populate a virtual Copy&Paste clipboard. Snip pieces to paste special formatting to enhance the outline.


Adding a feature documentation link pointing to the introduction of the interface element in the wiki will relieve you of the burden explaining how to find the feature.

Finding a Gramps Glossary term to link may be easier than choosing the best introductory section in the wiki.

 [[Gramps_Glossary#active_person|Active Person]]
 [[Gramps_Glossary#P|Primary Object]]

Glossary terms (like Active Person above) are normally lowercase and use an underscore between words. They have a brief description and may already have the introductory text and practical tutorial linked. You can fall back to the Letter index (like using 'P' with Primary Object above) if you don't know the exact entry.

Since most of these How do I... tutorials are likely to have been prompted by a MailList discussion, a set of example 'See also' link are included for reference.

Pointing the maillist archived thread link to the original message that inspired the tutorial give proper credit for the idea & reveals the background discussion.

Pointing another link to a good search phrase for the archive allows similar discussions to be explored.


Once the tutorial Preview is satisfactory, save a revision of the document. Then clean out the virtual Copy&Paste clipboard cluttering up your tutorial and save a final revision.


To remove the virtual Copy&Paste clipboard, simply delete everything from the beginning of this section to the bottom of the document. It is all disposable.

If the Copy&Paste clipboard is needed again, simply paste the following line at the end of the Edit box, Save a revision, & edit again.(Previewing isn't enough... a revision must be saved.)

   {{subst:Template:How_do_I}}

Other wiki Templates can be used as virtual Copy&Paste clipboards in the same way.


Writing a 'How do I...' article.

{{subst:Gramps_{{man version}}_Wiki_Manual_-_Preface}}
{{subst:WikiContributorRecruiting}

(Section)

Stub, english (default)

Gramps-notes.png

This article's content is incomplete or a placeholder stub.
Please update or expand this section.


Gramps-notes.png

Ébauche

À compléter !

Si vous pouvez aider à la traduction ou l'adapter à la culture francophone.

N'hésitez pas à améliorer cette page.


Stub, french

Embeddable Snippets (Subsection)

Icons

Dashboard Dashboard
People People
Relationships Relationships
Family Family Families
Charts Charts
Events Events
Places Places
Geography Geography
Sources (v3.4.x) Sources
Citations Citations
Repositories Repositories
Media Media
Notes Notes
more of the standard icons

List object tools
STOCK_ADD STOCK_INDEX (used for share) STOCK_EDIT STOCK_REMOVE Symbol question.svg Symbol question.svg
Add Share Edit Remove Move
Upwards
Move
Downwards

Text formatting (Level 2 Subsection)

italic, bold, bold & italic

Images (Level 3 Subsection)
Fig. .1 A screenshot caption

Logo

Annotations of User Activities (Level 4 Subsection)
  • Commands you type at the command line
  • Filenames or Filenames
  • 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

Boxed annotations

Tango-Dialog-information.png
Title of Tip

Tips text.

Gramps-notes.png
Example Note

Notes text.

Gnome-important.png
WarningTitle/Heading

warning text

JohnRSibert (talk) 15:52, 26 March 2021 (UTC)

Families often have complicated structure, especially for Twenty-first century blended families. Creating a Family Lines Graph for such families often involves carefully selecting multiple people to include.

Gramps stores these selections in a file named report_options.xml in the ~/.gramps User directory. The report options are overwritten every time a graphical report is created.

It is possible to edit this file manually with a text editor, but that is a tedious and error-prone procedure. The following bash script will take care of the process for you backing up the current file and saving the list of person IDs in a file that can be reused.


#!/bin/bash
if [ $# -lt 1 ];then
    echo "Utility to replace list of People of Interest in Gramps Family Lines Graph."
    echo "The file 'report_options.xml' is overwritten after making a backup."
    echo "The current list of People of Interest is saved for possible reuse" 
    echo "Usage: "$0" current_pid [new_pid]"
    echo "   current_pid is the file name in which to save current pid list"
    echo "   Optional. If present, new_pid is the name of the file containing"
    echo "   the new pid list"
    echo "   eg " $0" bigfamily.pid three_gen.pid"
    exit 1
fi 

gramps_home=~/.gramps/
#echo "gramps_home = "$gramps_home
opts=$gramps_home"report_options.xml"
#echo "opts = "$opts
bak=$opts".bak"
#echo "bak = "$bak

echo "Backing up "$opts " to " $bak 
cp -irp $opts $bak

echo "Saving current pid list to "$gramps_home$1
lxprintf -e 'module[@name="familylines_graph"]/option[@name="gidlist"]'\
 "%s\n" @value $opts > $gramps_home$1

echo "Replacing pids in "$opts
echo "    with the contents of "$gramps_home$2

# replacing the xml in situ does not seem to work correctly
# instead send it to a temporary file and copy
lxreplace -q \
  'module[@name="familylines_graph"]/option[@name="gidlist"]' \
  -@ '"value"' "'`cat $gramps_home$2`'" \
  ~/.gramps/report_options.xml > /tmp/temp.xml

cp -fv /tmp/temp.xml $opts 2>>/dev/null
echo "Updated "$opts

Copy the this code into a file, or get the most recent version of the script from github, and save it to a directory on your PATH.