betty.gramps.loader module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.gramps.loader module

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

class betty.gramps.loader.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.loader.GrampsEntityType

  Bases: `Enum`

  The supported Gramps entity types.

  CITATION = 'citation'
  EVENT = 'event'
  OBJECT = 'object'
  PERSON = 'person'
  SOURCE = 'source'

exception betty.gramps.loader.GrampsFileNotFound

  Bases: `GrampsError`, `FileNotFound`

  Raised when a Gramps family tree file cannot be found.

class betty.gramps.loader.GrampsLoader

  Bases: `object`

  Load Gramps family history data into a project.

  __init__(project: Project, *, localizer: Localizer)
  async load_file(file_path: Path) → None

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

    Raises:

      betty.gramps.error.GrampsError –

  async load_gpkg(gpkg_path: Path) → None

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

    Raises:

      betty.gramps.error.GrampsError –

  async load_gramps(gramps_path: Path) → None

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

    Raises:

      betty.gramps.error.GrampsError –

  async load_xml(xml: str, gramps_tree_directory_path: Path) → None

    Load family history data from XML.

    Raises:

      betty.gramps.error.GrampsError –

exception betty.gramps.loader.LoaderUsedAlready

  Bases: `GrampsError`

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

exception betty.gramps.loader.XPathError

  Bases: `GrampsError`

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