betty.gramps.loader module

Provide an API to load Gramps family trees into Betty ancestries.

class betty.gramps.loader.GrampsEntityReference[source]

Bases: object

A reference to an entity in a Gramps family tree.

__init__(entity_type: GrampsEntityType, entity_id: str) None
entity_id: str
entity_type: GrampsEntityType
class betty.gramps.loader.GrampsEntityType[source]

Bases: Enum

The supported Gramps entity types.

CITATION = 'citation'
EVENT = 'event'
OBJECT = 'object'
PERSON = 'person'
SOURCE = 'source'
exception betty.gramps.loader.GrampsLoadFileError[source]

Bases: GrampsError, RuntimeError

An error occurred when loading a Gramps family tree file.

class betty.gramps.loader.GrampsLoader[source]

Bases: object

Load Gramps family history data into a project.

__init__(project: Project, *, localizer: Localizer)[source]
add_association(*args: Any, **kwargs: Any) None[source]

Add an association between two entities to the ancestry.

add_entity(entity: Entity | AliasedEntity[Entity]) None[source]

Add entities to the ancestry.

async load_file(file_path: Path) None[source]

Load family history data from any of the supported Gramps file types.

async load_gpkg(gpkg_path: Path) None[source]

Load family history data from a Gramps *.gpkg file.

async load_gramps(gramps_path: Path) None[source]

Load family history data from a Gramps *.gramps file.

async load_tree(tree: ElementTree, gramps_tree_directory_path: Path) None[source]

Load family history data from a Gramps XML tree.

async load_xml(xml: str | Path, gramps_tree_directory_path: Path) None[source]

Load family history data from XML.

Parameters:

xml – The raw XML or the path to an XML file.

exception betty.gramps.loader.XPathError[source]

Bases: GrampsError, RuntimeError

An error occurred when evaluating an XPath selector on Gramps XML.