betty.gramps.loader module¶
Provide an API to load Gramps family trees into Betty ancestries.
- final 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_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.GrampsFileNotFound[source]¶
Bases:
GrampsError
,FileNotFound
Raised when a Gramps family tree file cannot be found.
- class betty.gramps.loader.GrampsLoader[source]¶
Bases:
object
Load Gramps family history data into a project.
This is internal. It MAY be used anywhere in Betty’s source code, but MUST NOT be used by third-party code.
- __init__(ancestry: Ancestry, *, factory: Factory[Any], localizer: Localizer, copyright_notices: PluginRepository[CopyrightNotice], licenses: PluginRepository[License], attribute_prefix_key: str | None = None, event_type_map: Mapping[str, type[EventType]] | None = None, gender_map: Mapping[str, type[Gender]] | None = None, place_type_map: Mapping[str, type[PlaceType]] | None = None, presence_role_map: Mapping[str, type[PresenceRole]] | None = None)[source]¶
- async load_file(file_path: Path) None [source]¶
Load family history data from any of the supported Gramps file types.
- Raises:
- async load_gpkg(gpkg_path: Path) None [source]¶
Load family history data from a Gramps *.gpkg file.
- Raises:
- exception betty.gramps.loader.LoaderUsedAlready[source]¶
Bases:
GrampsError
Raised when a
betty.gramps.loader.GrampsLoader
is used more than once.
- exception betty.gramps.loader.XPathError[source]¶
Bases:
GrampsError
An error occurred when evaluating an XPath selector on Gramps XML.