betty.gramps module#

Integrate Betty with Gramps.

final class betty.gramps.GrampsEntityReference#

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.GrampsEntityType#

Bases: Enum

The supported Gramps entity types.

CITATION = 'citation'#
EVENT = 'event'#
OBJECT = 'object'#
PERSON = 'person'#
SOURCE = 'source'#
exception betty.gramps.GrampsError#

Bases: Exception

A Gramps API error.

exception betty.gramps.GrampsFileNotFound#

Bases: UserFacingGrampsError, FileNotFound

Raised when a Gramps family tree file cannot be found.

class betty.gramps.GrampsLoader#

Bases: object

Load Gramps family history data into a project.

__init__(project: Project, *, attribute_prefix_key: str | None = None, event_type_mapping: Mapping[str, ResolvablePluginManufacturer[EventTypeDefinition, EventType]] | None = None, place_type_mapping: Mapping[str, ResolvablePluginManufacturer[PlaceTypeDefinition, PlaceType]] | None = None, role_mapping: Mapping[str, ResolvablePluginManufacturer[RoleDefinition, Role]] | None = None, executable: StrPath | None = None)#
async load_file(file: StrPath, /) None#

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

Raises:

betty.gramps.error.GrampsError

async load_gpkg(gpkg: StrPath, /) None#

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

Raises:

betty.gramps.error.GrampsError

async load_gramps(gramps: StrPath, /) None#

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

Raises:

betty.gramps.error.GrampsError

async load_locale(locale: str) Locale | None#

Load a locale.

async load_name(name: str) None#

Load family history data directly from Gramps using a family tree name.

Raises:

betty.gramps.error.GrampsError

async load_xml(xml: str) None#

Load family history data from XML.

Raises:

betty.gramps.error.GrampsError

exception betty.gramps.LoaderUsedAlready#

Bases: GrampsError

Raised when a betty.gramps.GrampsLoader is used more than once.

exception betty.gramps.UserFacingGrampsError#

Bases: GrampsError, HumanFacingException

A user-facing Gramps API error.

exception betty.gramps.XPathError#

Bases: GrampsError

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

betty.gramps.machinify(gramps_id: str, /) MachineName#

Convert a Gramps identifier into its machine name.