betty.gramps.loader module¶
Provide an API to load Gramps family trees into Betty ancestries.
- class betty.gramps.loader.GrampsEntityReference[source]¶
Bases:
objectA reference to an entity in a Gramps family tree.
- Parameters:
entity_type (
betty.gramps.loader.GrampsEntityType)entity_id (
str)
- __init__(entity_type: betty.gramps.loader.GrampsEntityType, entity_id: str) None¶
- Parameters:
entity_type (
betty.gramps.loader.GrampsEntityType)entity_id (
str)
-
entity_type:
betty.gramps.loader.GrampsEntityType¶
- class betty.gramps.loader.GrampsEntityType[source]¶
Bases:
EnumThe supported Gramps entity types.
- CITATION = 'citation'¶
- EVENT = 'event'¶
- OBJECT = 'object'¶
- PERSON = 'person'¶
- SOURCE = 'source'¶
- exception betty.gramps.loader.GrampsFileNotFoundError[source]¶
Bases:
GrampsError,FileNotFoundErrorA Gramps family tree file could not be file.
- Parameters:
message (
betty.locale.Localizable)
- exception betty.gramps.loader.GrampsLoadFileError[source]¶
Bases:
GrampsError,RuntimeErrorAn error occurred when loading a Gramps family tree file.
- Parameters:
message (
betty.locale.Localizable)
- class betty.gramps.loader.GrampsLoader[source]¶
Bases:
objectLoad Gramps family history data into a project.
- Parameters:
project_or_ancestry (
betty.project.Project|betty.model.ancestry.Ancestry)localizer (
betty.locale.Localizer)
- __init__(project_or_ancestry: betty.project.Project | betty.model.ancestry.Ancestry, *, localizer: betty.locale.Localizer)[source]¶
- Parameters:
project_or_ancestry (
betty.project.Project|betty.model.ancestry.Ancestry)localizer (
betty.locale.Localizer)
- add_association(*args: Any, **kwargs: Any) None[source]¶
Add an association between two entities to the ancestry.
- Parameters:
args (
typing.Any)kwargs (
typing.Any)
- Return type:
- add_entity(entity: betty.model.Entity | betty.model.AliasedEntity[betty.model.Entity]) None[source]¶
Add entities to the ancestry.
- Parameters:
entity (
typing.Union[betty.model.Entity,betty.model.AliasedEntity[betty.model.Entity]])- Return type:
- async load_file(file_path: pathlib.Path) None[source]¶
Load family history data from any of the supported Gramps file types.
- Parameters:
file_path (
pathlib.Path)- Return type:
- async load_gpkg(gpkg_path: pathlib.Path) None[source]¶
Load family history data from a Gramps *.gpkg file.
- Parameters:
gpkg_path (
pathlib.Path)- Return type:
- async load_gramps(gramps_path: pathlib.Path) None[source]¶
Load family history data from a Gramps *.gramps file.
- Parameters:
gramps_path (
pathlib.Path)- Return type:
- async load_tree(tree: xml.etree.ElementTree.ElementTree, gramps_tree_directory_path: pathlib.Path) None[source]¶
Load family history data from a Gramps XML tree.
- Parameters:
gramps_tree_directory_path (
pathlib.Path)
- Return type:
- async load_xml(xml: str | pathlib.Path, gramps_tree_directory_path: pathlib.Path) None[source]¶
Load family history data from XML.
- Parameters:
xml (
str|pathlib.Path) – The raw XML or the path to an XML file.gramps_tree_directory_path (
pathlib.Path)
- Return type:
- exception betty.gramps.loader.XPathError[source]¶
Bases:
GrampsError,RuntimeErrorAn error occurred when evaluating an XPath selector on Gramps XML.
- Parameters:
message (
betty.locale.Localizable)