ged2doc.ancestor_tree

Module containing methods/classes for laying out ancestor trees.

Classes

AncestorTree(person[, max_gen, width, …])

Class implementing layout of ancestor trees.

AncestorTreeVisitor()

Interface for tree visitors.

TreeNode(person, gen, motherNode, …)

Class representing node in a tree, which is a box with a person name.

class ged2doc.ancestor_tree.AncestorTree(person, max_gen=4, width='5in', gen_dist='12pt', font_size='10pt')[source]

Bases: object

Class implementing layout of ancestor trees.

Parameters
personged4py.model.Individual

Corresponding individual, may be None.

max_genint

Maximum number of generations to plot, default is 4.

widthged2doc.size.Size, optional

Specification for plot width, accepts anything convertible to ged2doc.size.Size.

gen_distged2doc.size.Size, optional

Distance between generations, accepts anything convertible to ged2doc.size.Size.

font_sizeged2doc.size.Size, optional

Font size, accepts anything convertible to ged2doc.size.Size.

Attributes
height

Full height of the tree (ged2doc.size.Size)

width

Full width of the tree (ged2doc.size.Size)

Methods

visit(visitor)

Visit every node and edge in a tree.

property width

Full width of the tree (ged2doc.size.Size)

property height

Full height of the tree (ged2doc.size.Size)

visit(visitor)[source]

Visit every node and edge in a tree.

Parameters
visitorAncestorTreeVisitor

Tree visitor.

_visit(visitor, node)[source]

Helper method for recursive visiting of the nodes.

_makeTree(person, gen, max_gen, box_width, max_box_width)[source]

Recursively generate tree of TreeNode instances.

Fro internal use only.

class ged2doc.ancestor_tree.AncestorTreeVisitor[source]

Bases: object

Interface for tree visitors.

Instances of this class can be passed to AncestorTree.visit() method to iterate over all nodes and edges in an ancestor tree.

Methods

visitFatherEdge(node, parentNode)

Visitor method for an edge leading from node to its mother.

visitMotherEdge(node, parentNode)

Visitor method for an edge leading from node to its mother.

visitNode(node)

Visitor method for a node in tree.

_abc_impl = <_abc_data object>
abstract visitNode(node)[source]

Visitor method for a node in tree.

Parameters
nodeTreeNode

Tree node.

abstract visitMotherEdge(node, parentNode)[source]

Visitor method for an edge leading from node to its mother.

It is guaranteed that visitNode is called for both nodes before this method is called.

Parameters
nodeTreeNode

Tree node.

parentNodeTreeNode

Parent tree node.

abstract visitFatherEdge(node, parentNode)[source]

Visitor method for an edge leading from node to its mother.

It is guaranteed that visitNode is called for both nodes before this method is called.

Parameters
nodeTreeNode

Tree node.

parentNodeTreeNode

Parent tree node.

class ged2doc.ancestor_tree.TreeNode(person, gen, motherNode, fatherNode, box_width, max_box_width, font_size, gen_dist)[source]

Bases: object

Class representing node in a tree, which is a box with a person name.

Parameters
personged4py.model.Individual

Corresponding individual, may be None.

genint

Generation number, 0 for the tree root.

motherNodeTreeNode

Node for mother, can be None.

fatherNodeTreeNode

Node for father, can be None.

box_widthged2doc.size.Size

Desired width of this node, actual width can grow.

max_box_widthged2doc.size.Size

Maximum width this node can grow to.

font_sizeged2doc.size.Size

Size of the font for the text.

gen_distged2doc.size.Size

Horiz. distance between generations.

Attributes
person

Person corresponding to this node, can be None (ged4py.model.Individual).

subTreeHeight

The height of the whole tree including parent boxes (Size).

textbox

Textbox for this node (TextBox).

Methods

setY0(y0)

Recalculate Y position of box tree so that topmost box is at y0.

_vpadding = Size(0.027777777777777776in)
property person

Person corresponding to this node, can be None (ged4py.model.Individual).

property textbox

Textbox for this node (TextBox).

property subTreeHeight

The height of the whole tree including parent boxes (Size).

setY0(y0)[source]

Recalculate Y position of box tree so that topmost box is at y0.

Parameters
y0ged2doc.size.Size

New topmost box position, accepts anything convertible to ged2doc.size.Size.