From Gramps
Revision as of 06:35, 26 January 2012 by Lcc (Talk | contribs) (maintenance)

Jump to: navigation, search
Lines of descendants chart
DescendantsLines, example Gramps data, inc_marriages and inc_places.
Shakespeare family tree, DescendantsLines
Shakespeare family tree, DescendantsLines, including event places

DescendantsLines is an in-development addon for Gramps which generates a graphical descendants tree using orthogonal edges and routing ("square edges").


2007: Adam Sampson has written a standalone python script for parsing data.gramps (GRAMPS XML). [1]

2010: this script needs some updates for avoiding minor issues.

A modified script is available on the addons repository. [2]


The program DescendantsLines, as the script in which it is based, is written in Python, using PyCairo and the Python XML library. Many Gramps modules are also used.

Current limitations

  1. Partial quoting of xml-syntax-like data. Data which resembles xml syntax (tags, etc) may cause error.
  2. Script ignores role on event (was added in 2007)
  3. Script ignores localized date handlers (using ISO date format, date quality in english)
  4. Memory limitation with a large database (DOM parsing)
  5. The last pixel column of each secondary line of each entry is wrong coloured (red instead black)
  6. The addon DescendantsLines does not use the Gramps document interface. (perhaps the Gramps document interface options should be hidden)
  7. DestinationOption does not have the usual error handling and user checking (e.g. for overwriting files)
Known issues

There is a problem with people who appear both as spouses and descendants with the inc_marriages option, where there can be confusion regarding marriage events.


Gramps 3.3 version

The Gramps 3.3 version of DescendantsLines can be installed through the Gramps Plugin Manager.

Gramps 3.4 version

To use the Gramps 3.4 version of DescendantsLines, on Gramps Trunk, now gramps34:

  1. Create the directory $GRAMPSHOME/gramps/gramps34/plugins/DescendantsLines/ .
  2. Copy the files and from Gramps-addons trunk svn to the directory $GRAMPSHOME/gramps/gramps34/plugins/DescendantsLines/ .


  1. Open Gramps and generate the report -- Reports -> Graphical Reports -> Descendants Lines. Choose the output path on "Destination" (default $GRAMPSHOME/DescendantsLines.png). The "Filename" option will contain an empty file after the report is run.
  2. The script currently runs in "debug mode" so it generates copious terminal output such as "Unknown event type: ..." or "Unknown spouse: ...". These warnings are harmless.


The options for the addon DescendantsLines are:

  • S_DOWN - The length of the vertical edges from descendant to spouse-bar
  • S_UP - The length of the vertical edges from spouse-bar to spouse
  • S_VPAD - Length of vertical padding spacing between spouse and spouse-bar (?)
  • FL_PAD - Length of padding spacing between S_UP edges (vertical edges from spouse-bar to spouse) and O_DOWN edges (vertical edges from spouse-bar to child-bar)
  • OL_PAD
  • O_DOWN - The length of the vertical edges from spouse-bar to child-bar
  • C_PAD - Length of padding spacing between children
  • F_PAD - Length of padding spacing between families (?)
  • C_UP - The length of the vertical edges from child to child-bar
  • SP_PAD - Length of padding spacing between spouses
  • output_fmt - The output format (PNG, SVG, PDF or PS)
  • output_fn - The output filename
  • max_gen - Maximum number of generations to include. (0 for unlimited)
  • name_format - The name format
  • inc_places - Whether to include event places in the output
  • inc_marriages - Whether to include marriage information in the output



There is an in-development migration of this Gtk/cairo code to a draw plugin working into Gramps (font, style, path, canvas, output formats). This migration, DescendantsLines, does not use the Document interface of Gramps.

Draft version is available on Addons repository as unstable (beta). [3]

The idea is keeping Gramps XML parsing, but with a copy of the active database and use of current report environment (output formats, style, path).


  • Add option to include event places. (done in Gramps-addons)
  • Add option to include marriage information. (done in Gramps-addons)
  • Using the library get_event_or_fallback() methods from gen.utils. (done in Gramps-addons)
  • Add optional generation limit. (done in Gramps-addons)
  • Make the XML export smaller. Use filter. (done in Gramps-addons)
  • Add option for output format. (PNG, SVG, PDF or PS) (done in Gramps-addons)
  • Add option for name display format. (done in Gramps-addons trunk)
  • Think of optional tree compression algorithms.
  • Add option to include divorces.
  • Add option to include spouse parents.
  • Add option to include spouse ancestries.
    • Add option to include arbitrary spouse ancestries.
  • Add option to include notes.
  • Add option to include sources.
  • Add option to include images.

The hardcoded number option limits can be altered by users, by altering the code.


Pass 1: generate a tmp XML with only data needed for the report, to load it as input

  1. Enable Person selection (Gramps ID) - done
  2. Generate a temp Gramps XML database matching 'IsDescendantFamilyOf' filter rule - done
  3. Input path - done (need to set @prefix@: path_to_SVN/src on
  4. Clean-up - done
  • simple Gramps XML template with events, persons, families objects (only export primary event role reference).
  • 'localized' dates (does not follow last DTD, which uses english and ISO format).

FINISHED - it works fine!

Pass 2: use draw report environment

  1. Generate a plugins/docgen/ file [4]
  2. Move Gtk code to draw report (if possible)
  3. Move cairo code to draw report (if possible)
  4. Output path
  5. Clean-up, pylint, etc ...

Pass 2 (Alternate): use of user-defined (mega)-widgets

  1. Have a look at mega-widget request and implementation [5]
  2. Output path through mega-widget
  3. Clean-up, pylint, etc ...

Pass 2 (Alternate): use a DestinationOption

  1. Use a DestinationOption
  2. Ignore standard Filename option

Command Line Interface

Gramps provides a cli support for running reports and tools [6].

  • use stdin and stdout for command line import/export [7]

Feel free to contribute or improve it.