Primary objects¶
BasicPrimaryObject¶
Basic Primary Object class for Gramps.
-
class
gramps.gen.lib.primaryobj.
BasicPrimaryObject
(source=None)[source]¶ Bases:
gramps.gen.lib.tableobj.TableObject
,gramps.gen.lib.privacybase.PrivacyBase
,gramps.gen.lib.tagbase.TagBase
The BasicPrimaryObject is the base class for
Note
objects.It is also the base class for the
PrimaryObject
class.The
PrimaryObject
is the base class for all other primary objects in the database. Primary objects are the core objects in the database. Each object has a database handle and a Gramps ID value. The database handle is used as the record number for the database, and the Gramps ID is the user visible version.-
get_gramps_id
()[source]¶ Return the Gramps ID for the primary object.
Returns: Gramps ID associated with the object Return type: str
-
has_citation_reference
(handle)[source]¶ Indicate if the object has a citation references.
In the base class, no such references exist. Derived classes should override this if they provide citation references.
-
has_handle_reference
(classname, handle)[source]¶ Return True if the object has reference to a given handle of given primary object type.
Parameters: - classname (str) – The name of the primary object class.
- handle (str) – The handle to be checked.
Returns: Returns whether the object has reference to this handle of this object type.
Return type: bool
-
has_media_reference
(handle)[source]¶ Indicate if the object has a media references.
In the base class, no such references exist. Derived classes should override this if they provide media references.
-
remove_citation_references
(handle_list)[source]¶ Remove the specified citation references from the object.
In the base class no such references exist. Derived classes should override this if they provide citation references.
-
remove_handle_references
(classname, handle_list)[source]¶ Remove all references in this object to object handles in the list.
Parameters: - classname (str) – The name of the primary object class.
- handle_list (str) – The list of handles to be removed.
-
remove_media_references
(handle_list)[source]¶ Remove the specified media references from the object.
In the base class no such references exist. Derived classes should override this if they provide media references.
-
replace_citation_references
(old_handle, new_handle)[source]¶ Replace all references to the old citation handle with those to the new citation handle.
-
replace_handle_reference
(classname, old_handle, new_handle)[source]¶ Replace all references to old handle with those to the new handle.
Parameters: - classname (str) – The name of the primary object class.
- old_handle (str) – The handle to be replaced.
- new_handle (str) – The handle to replace the old one with.
-
replace_media_references
(old_handle, new_handle)[source]¶ Replace all references to the old media handle with those to the new media handle.
-
PrimaryObject¶
-
class
gramps.gen.lib.primaryobj.
PrimaryObject
(source=None)[source]¶ Bases:
gramps.gen.lib.primaryobj.BasicPrimaryObject
The PrimaryObject is the base class for all primary objects in the database.
Primary objects are the core objects in the database. Each object has a database handle and a Gramps ID value. The database handle is used as the record number for the database, and the Gramps ID is the user visible version.
-
has_handle_reference
(classname, handle)[source]¶ Return True if the object has reference to a given handle of given primary object type.
Parameters: - classname (str) – The name of the primary object class.
- handle (str) – The handle to be checked.
Returns: Returns whether the object has reference to this handle of this object type.
Return type: bool
-
remove_handle_references
(classname, handle_list)[source]¶ Remove all references in this object to object handles in the list.
Parameters: - classname (str) – The name of the primary object class.
- handle_list (str) – The list of handles to be removed.
-
replace_handle_reference
(classname, old_handle, new_handle)[source]¶ Replace all references to old handle with those to the new handle.
Parameters: - classname (str) – The name of the primary object class.
- old_handle (str) – The handle to be replaced.
- new_handle (str) – The handle to replace the old one with.
-
Person¶
Person object for Gramps.
-
class
gramps.gen.lib.person.
Person
(data=None)[source]¶ Bases:
gramps.gen.lib.citationbase.CitationBase
,gramps.gen.lib.notebase.NoteBase
,gramps.gen.lib.attrbase.AttributeBase
,gramps.gen.lib.mediabase.MediaBase
,gramps.gen.lib.addressbase.AddressBase
,gramps.gen.lib.urlbase.UrlBase
,gramps.gen.lib.ldsordbase.LdsOrdBase
,gramps.gen.lib.primaryobj.PrimaryObject
The Person record is the Gramps in-memory representation of an individual person. It contains all the information related to an individual.
Person objects are usually created in one of two ways.
- Creating a new person object, which is then initialized and added to the database.
- Retrieving an object from the database using the records handle.
Once a Person object has been modified, it must be committed to the database using the database object’s commit_person function, or the changes will be lost.
-
FEMALE
= 0¶
-
MALE
= 1¶
-
UNKNOWN
= 2¶
-
add_alternate_name
(name)[source]¶ Add a
Name
instance to the list of alternative names.Parameters: name ( Name
) –Name
to add to the list
-
add_event_ref
(event_ref)[source]¶ Add the
EventRef
to the Person instance’sEventRef
list.This is accomplished by assigning the
EventRef
of a validEvent
in the current database.Parameters: event_ref (EventRef) – the EventRef
to be added to the Person’sEventRef
list.
-
add_family_handle
(family_handle)[source]¶ Add the
Family
handle to the Person instance’sFamily
list.This is accomplished by assigning the handle of a valid
Family
in the current database.Adding a
Family
handle to a Person does not automatically update the correspondingFamily
. The developer is responsible to make sure that when aFamily
is added to Person, that the Person is assigned to either the father or mother role in theFamily
.Parameters: family_handle (str) – handle of the Family
to be added to the Person’sFamily
list.
-
add_parent_family_handle
(family_handle)[source]¶ Add the
Family
handle to the Person instance’s list of families in which it is a child.This is accomplished by assigning the handle of a valid
Family
in the current database.Adding a
Family
handle to a Person does not automatically update the correspondingFamily
. The developer is responsible to make sure that when aFamily
is added to Person, that the Person is added to theFamily
instance’s child list.Parameters: family_handle (str) – handle of the Family
to be added to the Person’sFamily
list.
-
add_person_ref
(person_ref)[source]¶ Add the
PersonRef
to the Person instance’sPersonRef
list.Parameters: person_ref (PersonRef) – the PersonRef
to be added to the Person’sPersonRef
list.
-
gender
¶ Returns or sets the gender of the person
-
get_alternate_names
()[source]¶ Return the list of alternate
Name
instances.Returns: List of Name
instancesReturn type: list
-
get_birth_ref
()[source]¶ Return the
EventRef
for Person’s birth event.This should correspond to an
Event
in the database’sEvent
list.Returns: Returns the birth EventRef
or None if no birthEvent
has been assigned.Return type: EventRef
-
get_citation_child_list
()[source]¶ Return the list of child secondary objects that may refer citations.
Returns: Returns the list of child secondary child objects that may refer citations. Return type: list
-
get_death_ref
()[source]¶ Return the
EventRef
for the Person’s death event.This should correspond to an
Event
in the database’sEvent
list.Returns: Returns the death EventRef
or None if no deathEvent
has been assigned.Return type: event_ref
-
get_event_ref_list
()[source]¶ Return the list of
EventRef
objects associated withEvent
instances.Returns: Returns the list of EventRef
objects associated with the Person instance.Return type: list
-
get_family_handle_list
()[source]¶ Return the list of
Family
handles in which the person is a parent or spouse.Returns: Returns the list of handles corresponding to the Family
records with which the person is associated.Return type: list
-
get_gender
()[source]¶ Return the gender of the Person.
Returns: Returns one of the following constants: - Person.MALE
- Person.FEMALE
- Person.UNKNOWN
Return type: int
-
get_handle_referents
()[source]¶ Return the list of child objects which may, directly or through their children, reference primary objects.
Returns: Returns the list of objects referencing primary objects. Return type: list
-
get_main_parents_family_handle
()[source]¶ Return the handle of the
Family
considered to be the mainFamily
in which the Person is a child.Returns: Returns the family_handle if a family_handle exists, If no Family
is assigned, None is returnedReturn type: str
-
get_note_child_list
()[source]¶ Return the list of child secondary objects that may refer notes.
Returns: Returns the list of child secondary child objects that may refer notes. Return type: list
-
get_parent_family_handle_list
()[source]¶ Return the list of
Family
handles in which the person is a child.Returns: Returns the list of handles corresponding to the Family
records with which the person is a child.Return type: list
-
get_person_ref_list
()[source]¶ Return the list of
PersonRef
objects.Returns: Returns the list of PersonRef
objects.Return type: list
-
get_primary_event_ref_list
()[source]¶ Return the list of
EventRef
objects associated withEvent
instances that have been marked as primary events.Returns: Returns generator of EventRef
objects associated with the Person instance.Return type: generator
-
get_primary_name
()[source]¶ Return the
Name
instance marked as the Person’s primary name.Returns: Returns the primary name Return type: Name
-
get_referenced_handles
()[source]¶ Return the list of (classname, handle) tuples for all directly referenced primary objects.
Returns: List of (classname, handle) tuples for referenced objects. Return type: list
-
classmethod
get_schema
()[source]¶ Returns the JSON Schema for this class.
Returns: Returns a dict containing the schema. Return type: dict
-
get_text_data_child_list
()[source]¶ Return the list of child objects that may carry textual data.
Returns: Returns the list of child objects that may carry textual data. Return type: list
-
get_text_data_list
()[source]¶ Return the list of all textual attributes of the object.
Returns: Returns the list of all textual attributes of the object. Return type: list
-
merge
(acquisition)[source]¶ Merge the content of acquisition into this person.
Parameters: acquisition (Person) – The person to merge with the present person.
-
remove_family_handle
(family_handle)[source]¶ Remove the specified
Family
handle from the list of marriages/partnerships.If the handle does not exist in the list, the operation has no effect.
Parameters: family_handle (str) – Family
handle to remove from the listReturns: True if the handle was removed, False if it was not in the list. Return type: bool
-
remove_parent_family_handle
(family_handle)[source]¶ Remove the specified
Family
handle from the list of parent families (families in which the parent is a child).If the handle does not exist in the list, the operation has no effect.
Parameters: family_handle (str) – Family
handle to remove from the listReturns: Returns a tuple of three strings, consisting of the removed handle, relationship to mother, and relationship to father. None is returned if the handle is not in the list. Return type: tuple
-
serialize
()[source]¶ Convert the data held in the Person to a Python tuple that represents all the data elements.
This method is used to convert the object into a form that can easily be saved to a database.
These elements may be primitive Python types (string, integers), complex Python types (lists or tuples, or Python objects. If the target database cannot handle complex types (such as objects or lists), the database is responsible for converting the data into a form that it can use.
Returns: Returns a python tuple containing the data that should be considered persistent. Return type: tuple
-
set_alternate_names
(alt_name_list)[source]¶ Change the list of alternate names to the passed list.
Parameters: alt_name_list (list) – List of Name
instances
-
set_birth_ref
(event_ref)[source]¶ Assign the birth event to the Person object.
This is accomplished by assigning the
EventRef
of the birth event in the current database.Parameters: event_ref (EventRef) – the EventRef
object associated with the Person’s birth.
-
set_death_ref
(event_ref)[source]¶ Assign the death event to the Person object.
This is accomplished by assigning the
EventRef
of the death event in the current database.Parameters: event_ref (EventRef) – the EventRef
object associated with the Person’s death.
-
set_event_ref_list
(event_ref_list)[source]¶ Set the Person instance’s
EventRef
list to the passed list.Parameters: event_ref_list (list) – List of valid EventRef
objects.
-
set_family_handle_list
(family_list)[source]¶ Assign the passed list to the Person’s list of families in which it is a parent or spouse.
Parameters: family_list (list) – List of Family
handles to be associated with the Person
-
set_gender
(gender)[source]¶ Set the gender of the Person.
Parameters: gender (int) – Assigns the Person’s gender to one of the following constants:
- Person.MALE
- Person.FEMALE
- Person.UNKNOWN
-
set_main_parent_family_handle
(family_handle)[source]¶ Set the main
Family
in which the Person is a child.The main
Family
is theFamily
typically used for reports and navigation. This is accomplished by moving theFamily
to the beginning of the list. The family_handle must be in the list for this to have any effect.Parameters: family_handle (str) – handle of the Family
to be marked as the mainFamily
Returns: Returns True if the assignment has successful Return type: bool
-
set_parent_family_handle_list
(family_list)[source]¶ Return the list of
Family
handles in which the person is a child.Returns: Returns the list of handles corresponding to the Family
records with which the person is a child.Return type: list
-
set_person_ref_list
(person_ref_list)[source]¶ Set the Person instance’s
PersonRef
list to the passed list.Parameters: person_ref_list (list) – List of valid PersonRef
objects
-
set_preferred_family_handle
(family_handle)[source]¶ Set the family_handle specified to be the preferred
Family
.The preferred
Family
is determined by the firstFamily
in theFamily
list, and is typically used to indicate the preferredFamily
for navigation or reporting.The family_handle must already be in the list, or the function call has no effect.
Parameters: family_handle (str) – Handle of the Family
to make the preferredFamily
.Returns: True if the call succeeded, False if the family_handle was not already in the Family
list.Return type: bool
Family¶
Family object for Gramps.
-
class
gramps.gen.lib.family.
Family
[source]¶ Bases:
gramps.gen.lib.citationbase.CitationBase
,gramps.gen.lib.notebase.NoteBase
,gramps.gen.lib.mediabase.MediaBase
,gramps.gen.lib.attrbase.AttributeBase
,gramps.gen.lib.ldsordbase.LdsOrdBase
,gramps.gen.lib.primaryobj.PrimaryObject
The Family record is the Gramps in-memory representation of the relationships between people. It contains all the information related to the relationship.
Family objects are usually created in one of two ways.
- Creating a new Family object, which is then initialized and added to the database.
- Retrieving an object from the database using the records handle.
Once a Family object has been modified, it must be committed to the database using the database object’s commit_family function, or the changes will be lost.
-
add_child_ref
(child_ref)[source]¶ Add the database handle for
Person
to the Family’s list of children.Parameters: child_ref (ChildRef) – Child Reference instance
-
add_event_ref
(event_ref)[source]¶ Add the
EventRef
to the Family instance’sEventRef
list.This is accomplished by assigning the
EventRef
for the validEvent
in the current database.Parameters: event_ref (EventRef) – the EventRef
to be added to the Person’sEventRef
list.
-
get_child_ref_list
()[source]¶ Return the list of
ChildRef
handles identifying the children of the Family.Returns: Returns the list of ChildRef
handles associated with the Family.Return type: list
-
get_citation_child_list
()[source]¶ Return the list of child secondary objects that may refer citations.
Returns: Returns the list of child secondary child objects that may refer citations. Return type: list
-
get_event_ref_list
()[source]¶ Return the list of
EventRef
objects associated withEvent
instances.Returns: Returns the list of EventRef
objects associated with the Family instance.Return type: list
-
get_father_handle
()[source]¶ Return the database handle of the
Person
identified as the father of the Family.Returns: Person
database handleReturn type: str
-
get_handle_referents
()[source]¶ Return the list of child objects which may, directly or through their children, reference primary objects..
Returns: Returns the list of objects referencing primary objects. Return type: list
-
get_mother_handle
()[source]¶ Return the database handle of the
Person
identified as the mother of the Family.Returns: Person
database handleReturn type: str
-
get_note_child_list
()[source]¶ Return the list of child secondary objects that may refer notes.
Returns: Returns the list of child secondary child objects that may refer notes. Return type: list
-
get_referenced_handles
()[source]¶ Return the list of (classname, handle) tuples for all directly referenced primary objects.
Returns: List of (classname, handle) tuples for referenced objects. Return type: list
-
get_relationship
()[source]¶ Return the relationship type between the people identified as the father and mother in the relationship.
-
classmethod
get_schema
()[source]¶ Returns the JSON Schema for this class.
Returns: Returns a dict containing the schema. Return type: dict
-
get_text_data_child_list
()[source]¶ Return the list of child objects that may carry textual data.
Returns: Returns the list of child objects that may carry textual data. Return type: list
-
get_text_data_list
()[source]¶ Return the list of all textual attributes of the object.
Returns: Returns the list of all textual attributes of the object. Return type: list
-
merge
(acquisition)[source]¶ Merge the content of acquisition into this family.
Lost: handle, id, relation, father, mother of acquisition.
Parameters: acquisition (Family) – The family to merge with the present family.
-
remove_child_handle
(child_handle)[source]¶ Remove the database handle for
Person
to the Family’s list of children if thePerson
is already in the list.Parameters: child_handle (str) – Person
database handleReturns: True if the handle was removed, False if it was not in the list. Return type: bool
-
remove_child_ref
(child_ref)[source]¶ Remove the database handle for
Person
to the Family’s list of children if thePerson
is already in the list.Parameters: child_ref (ChildRef) – Child Reference instance Returns: True if the handle was removed, False if it was not in the list. Return type: bool
-
serialize
()[source]¶ Convert the data held in the event to a Python tuple that represents all the data elements.
This method is used to convert the object into a form that can easily be saved to a database.
These elements may be primitive Python types (string, integers), complex Python types (lists or tuples, or Python objects. If the target database cannot handle complex types (such as objects or lists), the database is responsible for converting the data into a form that it can use.
Returns: Returns a python tuple containing the data that should be considered persistent. Return type: tuple
-
set_child_ref_list
(child_ref_list)[source]¶ Assign the passed list to the Family’s list children.
Parameters: child_ref_list (list of ChildRef
instances) – List of Child Reference instances to be associated as the Family’s list of children.
-
set_event_ref_list
(event_ref_list)[source]¶ Set the Family instance’s
EventRef
list to the passed list.Parameters: event_ref_list (list) – List of valid EventRef
objects
-
set_father_handle
(person_handle)[source]¶ Set the database handle for
Person
that corresponds to male of the relationship.For a same sex relationship, this can represent either of people involved in the relationship.
Parameters: person_handle (str) – Person
database handle
-
set_mother_handle
(person_handle)[source]¶ Set the database handle for
Person
that corresponds to male of the relationship.For a same sex relationship, this can represent either of people involved in the relationship.
Parameters: person_handle (str) – Person
database handle
-
set_relationship
(relationship_type)[source]¶ Set the relationship type between the people identified as the father and mother in the relationship.
The type is a tuple whose first item is an integer constant and whose second item is the string. The valid values are:
Type Description FamilyRelType.MARRIED indicates a legally recognized married relationship between two individuals. This may be either an opposite or a same sex relationship. FamilyRelType.UNMARRIED indicates a relationship between two individuals that is not a legally recognized relationship. FamilyRelType.CIVIL_UNION indicates a legally recongnized, non-married relationship between two individuals of the same sex. FamilyRelType.UNKNOWN indicates that the type of relationship between the two individuals is not know. FamilyRelType.CUSTOM indicates that the type of relationship between the two individuals does not match any of the other types. Parameters: relationship_type (tuple) – (int,str) tuple of the relationship type between the father and mother of the relationship.
Event¶
Event object for Gramps.
-
class
gramps.gen.lib.event.
Event
(source=None)[source]¶ Bases:
gramps.gen.lib.citationbase.CitationBase
,gramps.gen.lib.notebase.NoteBase
,gramps.gen.lib.mediabase.MediaBase
,gramps.gen.lib.attrbase.AttributeBase
,gramps.gen.lib.datebase.DateBase
,gramps.gen.lib.placebase.PlaceBase
,gramps.gen.lib.primaryobj.PrimaryObject
The Event record is used to store information about some type of action that occurred at a particular place at a particular time, such as a birth, death, or marriage.
A possible definition: Events are things that happen at some point in time (that we may not know precisely, though), at some place, may involve several people (witnesses, officers, notaries, priests, etc.) and may of course have sources, notes, media, etc. Compare this with attribute:
Attribute
-
are_equal
(other)[source]¶ Return True if the passed Event is equivalent to the current Event.
Parameters: other (Event) – Event to compare against Returns: True if the Events are equal Return type: bool
-
description
¶ Returns or sets description of the event
-
get_citation_child_list
()[source]¶ Return the list of child secondary objects that may refer citations.
Returns: Returns the list of child secondary child objects that may refer citations. Return type: list
-
get_description
()[source]¶ Return the description of the Event.
Returns: Returns the description of the Event Return type: str
-
get_handle_referents
()[source]¶ Return the list of child objects which may, directly or through their children, reference primary objects.
Returns: Returns the list of objects referencing primary objects. Return type: list
-
get_note_child_list
()[source]¶ Return the list of child secondary objects that may refer notes.
Returns: Returns the list of child secondary child objects that may refer notes. Return type: list
-
get_referenced_handles
()[source]¶ Return the list of (classname, handle) tuples for all directly referenced primary objects.
Returns: List of (classname, handle) tuples for referenced objects. Return type: list
-
classmethod
get_schema
()[source]¶ Returns the JSON Schema for this class.
Returns: Returns a dict containing the schema. Return type: dict
-
get_text_data_child_list
()[source]¶ Return the list of child objects that may carry textual data.
Returns: Returns the list of child objects that may carry textual data. Return type: list
-
get_text_data_list
()[source]¶ Return the list of all textual attributes of the object.
Returns: Returns the list of all textual attributes of the object. Return type: list
-
is_empty
()[source]¶ Return True if the Event is an empty object (no values set).
Returns: True if the Event is empty Return type: bool
-
merge
(acquisition)[source]¶ Merge the content of acquisition into this event.
Lost: handle, id, marker, type, date, place, description of acquisition.
Parameters: acquisition (Event) – The event to merge with the present event.
-
serialize
(no_text_date=False)[source]¶ Convert the data held in the event to a Python tuple that represents all the data elements.
This method is used to convert the object into a form that can easily be saved to a database.
These elements may be primitive Python types (string, integers), complex Python types (lists or tuples, or Python objects. If the target database cannot handle complex types (such as objects or lists), the database is responsible for converting the data into a form that it can use.
Returns: Returns a python tuple containing the data that should be considered persistent. Return type: tuple
-
set_description
(description)[source]¶ Set the description of the Event to the passed string.
The string may contain any information.
Parameters: description (str) – Description to assign to the Event
-
set_type
(the_type)[source]¶ Set the type of the Event to the passed (int,str) tuple.
Parameters: the_type (tuple) – Type to assign to the Event
-
type
¶ Returns or sets type of the event
-
Place¶
Place object for Gramps.
-
class
gramps.gen.lib.place.
Place
(source=None)[source]¶ Bases:
gramps.gen.lib.citationbase.CitationBase
,gramps.gen.lib.notebase.NoteBase
,gramps.gen.lib.mediabase.MediaBase
,gramps.gen.lib.urlbase.UrlBase
,gramps.gen.lib.primaryobj.PrimaryObject
Contains information related to a place, including multiple address information (since place names can change with time), longitude, latitude, a collection of images and URLs, a note and a source.
-
add_alternate_locations
(location)[source]¶ Add a
Location
object to the alternate location list.Parameters: location ( Location
) –Location
instance to add
-
add_alternative_name
(name)[source]¶ Add a name to the alternative names list.
Parameters: name (string) – name to add
-
add_placeref
(placeref)[source]¶ Add a place reference to the list of place references.
Parameters: code (PlaceRef) – place reference to append to the list
-
get_all_names
()[source]¶ Return a list of all names of the Place object.
Returns: Returns a list of all names of the Place Return type: list of PlaceName
-
get_alternate_locations
()[source]¶ Return a list of alternate
Location
objects the present alternate information about the current Place.A Place can have more than one
Location
, since names and jurisdictions can change over time for the same place.Returns: Returns the alternate Location
s for the PlaceReturn type: list of Location
objects
-
get_alternative_names
()[source]¶ Return a list of alternative names for the current Place.
Returns: Returns the alternative names for the Place Return type: list of PlaceName
-
get_citation_child_list
()[source]¶ Return the list of child secondary objects that may refer citations.
Returns: List of child secondary child objects that may refer citations. Return type: list
-
get_code
()[source]¶ Return the code of the Place object.
Returns: Returns the code of the Place Return type: str
-
get_handle_referents
()[source]¶ Return the list of child objects which may, directly or through their children, reference primary objects.
Returns: Returns the list of objects referencing primary objects. Return type: list
-
get_latitude
()[source]¶ Return the latitude of the Place object.
Returns: Returns the latitude of the Place Return type: str
-
get_longitude
()[source]¶ Return the longitude of the Place object.
Returns: Returns the longitude of the Place Return type: str
-
get_name
()[source]¶ Return the name of the Place object.
Returns: Returns the name of the Place Return type: PlaceName
-
get_note_child_list
()[source]¶ Return the list of child secondary objects that may refer notes.
Returns: Returns the list of child secondary child objects that may refer notes. Return type: list
-
get_placeref_list
()[source]¶ Return the place reference list for the Place object.
Returns: Returns the place reference list for the Place Return type: list
-
get_referenced_handles
()[source]¶ Return the list of (classname, handle) tuples for all directly referenced primary objects.
Returns: List of (classname, handle) tuples for referenced objects. Return type: list
-
classmethod
get_schema
()[source]¶ Returns the JSON Schema for this class.
Returns: Returns a dict containing the schema. Return type: dict
-
get_text_data_child_list
()[source]¶ Return the list of child objects that may carry textual data.
Returns: Returns the list of child objects that may carry textual data. Return type: list
-
get_text_data_list
()[source]¶ Return the list of all textual attributes of the object.
Returns: Returns the list of all textual attributes of the object. Return type: list
-
get_title
()[source]¶ Return the descriptive title of the Place object.
Returns: Returns the descriptive title of the Place Return type: str
-
get_type
()[source]¶ Return the type of the Place object.
Returns: Returns the type of the Place Return type: PlaceType
-
merge
(acquisition)[source]¶ Merge the content of acquisition into this place.
Parameters: acquisition (Place) – The place to merge with the present place.
-
serialize
()[source]¶ Convert the data held in the Place to a Python tuple that represents all the data elements.
This method is used to convert the object into a form that can easily be saved to a database.
These elements may be primitive Python types (string, integers), complex Python types (lists or tuples, or Python objects. If the target database cannot handle complex types (such as objects or lists), the database is responsible for converting the data into a form that it can use.
Returns: Returns a python tuple containing the data that should be considered persistent. Return type: tuple
-
set_alternate_locations
(location_list)[source]¶ Replace the current alternate
Location
object list with the new one.Parameters: location_list (list of Location
objects) – The list ofLocation
objects to assign to the Place’s internal list.
-
set_alternative_names
(name_list)[source]¶ Replace the current alternative names list with the new one.
Parameters: name_list (list of PlaceName) – The list of names to assign to the Place’s internal list.
-
set_code
(code)[source]¶ Set the code of the Place object.
Parameters: code (str) – code to assign to the Place
-
set_latitude
(latitude)[source]¶ Set the latitude of the Place object.
Parameters: latitude (str) – latitude to assign to the Place
-
set_longitude
(longitude)[source]¶ Set the longitude of the Place object.
Parameters: longitude (str) – longitude to assign to the Place
-
set_name
(name)[source]¶ Set the name of the Place object.
Parameters: name (PlaceName) – name to assign to the Place
-
set_placeref_list
(placeref_list)[source]¶ Set the place reference list for the Place object.
Parameters: code (list) – place reference list to assign to the Place
-
set_title
(title)[source]¶ Set the descriptive title of the Place object.
Parameters: title (str) – descriptive title to assign to the Place
-
Source¶
Source object for Gramps.
-
class
gramps.gen.lib.src.
Source
[source]¶ Bases:
gramps.gen.lib.mediabase.MediaBase
,gramps.gen.lib.notebase.NoteBase
,gramps.gen.lib.attrbase.SrcAttributeBase
,gramps.gen.lib.citationbase.IndirectCitationBase
,gramps.gen.lib.primaryobj.PrimaryObject
A record of a source of information.
-
add_repo_reference
(repo_ref)[source]¶ Add a
RepoRef
instance to the Source’s reporef list.Parameters: repo_ref ( RepoRef
) –RepoRef
instance to be added to the object’s reporef list.
Return the author of the Source.
-
get_citation_child_list
()[source]¶ Return the list of child secondary objects that may refer citations.
Returns: Returns the list of child secondary child objects that may refer citations. Return type: list
-
get_handle_referents
()[source]¶ Return the list of child objects which may, directly or through their children, reference primary objects.
Returns: Returns the list of objects referencing primary objects. Return type: list
-
get_note_child_list
()[source]¶ Return the list of child secondary objects that may refer notes.
Returns: Returns the list of child secondary child objects that may refer notes. Return type: list
-
get_referenced_handles
()[source]¶ Return the list of (classname, handle) tuples for all directly referenced primary objects.
Returns: List of (classname, handle) tuples for referenced objects. Return type: list
-
get_reporef_list
()[source]¶ Return the list of
RepoRef
instances associated with the Source.Returns: list of RepoRef
instances associated with the SourceReturn type: list
-
classmethod
get_schema
()[source]¶ Returns the JSON Schema for this class.
Returns: Returns a dict containing the schema. Return type: dict
-
get_text_data_child_list
()[source]¶ Return the list of child objects that may carry textual data.
Returns: Returns the list of child objects that may carry textual data. Return type: list
-
get_text_data_list
()[source]¶ Return the list of all textual attributes of the object.
Returns: Returns the list of all textual attributes of the object. Return type: list
-
get_title
()[source]¶ Return the descriptive title of the Place object.
Returns: Returns the descriptive title of the Place Return type: str
-
has_repo_reference
(repo_handle)[source]¶ Return True if the Source has reference to this Repository handle.
Parameters: repo_handle (str) – The Repository handle to be checked. Returns: Returns whether the Source has reference to this Repository handle. Return type: bool
-
merge
(acquisition)[source]¶ Merge the content of acquisition into this source.
Parameters: acquisition (Source) – The source to merge with the present source.
-
remove_repo_references
(repo_handle_list)[source]¶ Remove references to all Repository handles in the list.
Parameters: repo_handle_list (list) – The list of Repository handles to be removed.
-
replace_repo_references
(old_handle, new_handle)[source]¶ Replace all references to old Repository handle with the new handle and merge equivalent entries.
Parameters: - old_handle (str) – The Repository handle to be replaced.
- new_handle (str) – The Repository handle to replace the old one with.
Set the author of the Source.
-
set_reporef_list
(reporef_list)[source]¶ Set the list of
RepoRef
instances associated with the Source. It replaces the previous list.Parameters: reporef_list (list) – list of RepoRef
instances to be assigned to the Source.
-
Citation¶
Citation object for Gramps.
-
class
gramps.gen.lib.citation.
Citation
[source]¶ Bases:
gramps.gen.lib.mediabase.MediaBase
,gramps.gen.lib.notebase.NoteBase
,gramps.gen.lib.attrbase.SrcAttributeBase
,gramps.gen.lib.citationbase.IndirectCitationBase
,gramps.gen.lib.datebase.DateBase
,gramps.gen.lib.primaryobj.PrimaryObject
A record of a citation of a source of information.
In GEDCOM this is called a SOURCE_CITATION. The data provided in the <<SOURCE_CITATION>> structure is source-related information specific to the data being cited.
-
CONF_HIGH
= 3¶
-
CONF_LOW
= 1¶
-
CONF_NORMAL
= 2¶
-
CONF_VERY_HIGH
= 4¶
-
CONF_VERY_LOW
= 0¶
-
get_citation_child_list
()[source]¶ Return the list of child secondary objects that may refer citations.
Returns: Returns the list of child secondary child objects that may refer citations. Return type: list
-
get_handle_referents
()[source]¶ Return the list of child objects which may, directly or through their children, reference primary objects.
Returns: Returns the list of objects referencing primary objects. Return type: list
-
get_note_child_list
()[source]¶ Return the list of child secondary objects that may refer notes.
Returns: Returns the list of child secondary child objects that may refer notes. Return type: list
-
get_referenced_handles
()[source]¶ Return the list of (classname, handle) tuples for all directly referenced primary objects.
Returns: List of (classname, handle) tuples for referenced objects. Return type: list
-
classmethod
get_schema
()[source]¶ Returns the JSON Schema for this class.
Returns: Returns a dict containing the schema. Return type: dict
-
get_text_data_child_list
()[source]¶ Return the list of child objects that may carry textual data.
Returns: Returns the list of child objects that may carry textual data. Return type: list
-
get_text_data_list
()[source]¶ Return the list of all textual attributes of the object.
Returns: Returns the list of all textual attributes of the object. Return type: list
-
Media¶
Media object for Gramps.
-
class
gramps.gen.lib.media.
Media
(source=None)[source]¶ Bases:
gramps.gen.lib.citationbase.CitationBase
,gramps.gen.lib.notebase.NoteBase
,gramps.gen.lib.datebase.DateBase
,gramps.gen.lib.attrbase.AttributeBase
,gramps.gen.lib.primaryobj.PrimaryObject
Container for information about an image file, including location, description and privacy.
-
get_citation_child_list
()[source]¶ Return the list of child secondary objects that may refer to citations.
Returns: Returns the list of child secondary child objects that may refer to citations. Return type: list
-
get_handle_referents
()[source]¶ Return the list of child objects which may, directly or through their children, reference primary objects.
Returns: Returns the list of objects referencing primary objects. Return type: list
-
get_mime_type
()[source]¶ Return the MIME type associated with the Media.
Returns: Returns the associated MIME type Return type: str
-
get_note_child_list
()[source]¶ Return the list of child secondary objects that may refer notes.
Returns: Returns the list of child secondary child objects that may refer notes. Return type: list
-
get_referenced_handles
()[source]¶ Return the list of (classname, handle) tuples for all directly referenced primary objects.
Returns: List of (classname, handle) tuples for referenced objects. Return type: list
-
classmethod
get_schema
()[source]¶ Returns the JSON Schema for this class.
Returns: Returns a dict containing the schema. Return type: dict
-
get_text_data_child_list
()[source]¶ Return the list of child objects that may carry textual data.
Returns: Returns the list of child objects that may carry textual data. Return type: list
-
get_text_data_list
()[source]¶ Return the list of all textual attributes of the object.
Returns: Returns the list of all textual attributes of the object. Return type: list
-
merge
(acquisition)[source]¶ Merge the content of acquisition into this media object.
Lost: handle, id, file, date of acquisition.
Parameters: acquisition (Media) – The media object to merge with the present object.
-
serialize
(no_text_date=False)[source]¶ Convert the data held in the event to a Python tuple that represents all the data elements.
This method is used to convert the object into a form that can easily be saved to a database.
These elements may be primitive Python types (string, integers), complex Python types (lists or tuples, or Python objects. If the target database cannot handle complex types (such as objects or lists), the database is responsible for converting the data into a form that it can use.
Returns: Returns a python tuple containing the data that should be considered persistent. Return type: tuple
-
Repository¶
Repository object for Gramps.
-
class
gramps.gen.lib.repo.
Repository
[source]¶ Bases:
gramps.gen.lib.notebase.NoteBase
,gramps.gen.lib.addressbase.AddressBase
,gramps.gen.lib.urlbase.UrlBase
,gramps.gen.lib.citationbase.IndirectCitationBase
,gramps.gen.lib.primaryobj.PrimaryObject
A location where collections of Sources are found.
-
get_citation_child_list
()[source]¶ Return the list of child secondary objects that may refer citations.
Returns: Returns the list of child secondary child objects that may refer citations. Return type: list
-
get_handle_referents
()[source]¶ Return the list of child objects which may, directly or through their children, reference primary objects.
Returns: Returns the list of objects referencing primary objects. Return type: list
-
get_note_child_list
()[source]¶ Return the list of child secondary objects that may refer notes.
Returns: Returns the list of child secondary child objects that may refer notes. Return type: list
-
get_referenced_handles
()[source]¶ Return the list of (classname, handle) tuples for all directly referenced primary objects.
Returns: List of (classname, handle) tuples for referenced objects. Return type: list
-
classmethod
get_schema
()[source]¶ Returns the JSON Schema for this class.
Returns: Returns a dict containing the schema. Return type: dict
-
get_text_data_child_list
()[source]¶ Return the list of child objects that may carry textual data.
Returns: Returns the list of child objects that may carry textual data. Return type: list
-
get_text_data_list
()[source]¶ Return the list of all textual attributes of the object.
Returns: Returns the list of all textual attributes of the object. Return type: list
-
merge
(acquisition)[source]¶ Merge the content of acquisition into this repository.
Parameters: acquisition (Repository) – The repository to merge with the present repository.
-
Note¶
Note class for Gramps.
-
class
gramps.gen.lib.note.
Note
(text='')[source]¶ Bases:
gramps.gen.lib.primaryobj.BasicPrimaryObject
Define a text note.
Starting from Gramps 3.1 Note object stores the text in
StyledText
instance, thus it can have text formatting information.To get and set only the clear text of the note use the
get()
andset()
methods.To get and set the formatted version of the Note’s text use the
get_styledtext()
andset_styledtext()
methods.The note may be ‘preformatted’ or ‘flowed’, which indicates that the text string is considered to be in paragraphs, separated by newlines.
Variables: Warning
The POS_<x> class variables reflect the serialized object, they have to be updated in case the data structure or the
serialize()
method changes!-
FLOWED
= 0¶
-
FORMATTED
= 1¶
-
POS_CHANGE
= 5¶
-
POS_FORMAT
= 3¶
-
POS_HANDLE
= 0¶
-
POS_ID
= 1¶
-
POS_PRIVATE
= 7¶
-
POS_TAGS
= 6¶
-
POS_TEXT
= 2¶
-
POS_TYPE
= 4¶
-
append
(text)[source]¶ Append the specified text to the text associated with the note.
Parameters: text (str or StyledText
) – Text string to be appended to the note.
-
get
()[source]¶ Return the text string associated with the note.
Returns: The clear text of the note contents. Return type: unicode
-
get_format
()[source]¶ Return the format of the note.
The value can either indicate Flowed or Preformatted.
Returns: 0 indicates Flowed, 1 indicates Preformated Return type: int
-
get_links
()[source]¶ Get the jump links from this note. Links can be external, to urls, or can be internal to gramps objects.
Return examples:
[("gramps", "Person", "handle", "7657626365362536"), ("external", "www", "url", "http://example.com")]
Returns: list of [(domain, type, propery, value), …] Return type: list
-
get_referenced_handles
()[source]¶ Return the list of (classname, handle) tuples for all directly referenced primary objects.
Returns: List of (classname, handle) tuples for referenced objects. Return type: list
-
classmethod
get_schema
()[source]¶ Returns the JSON Schema for this class.
Returns: Returns a dict containing the schema. Return type: dict
-
get_styledtext
()[source]¶ Return the text string associated with the note.
Returns: The formatted text of the note contents. Return type: StyledText
-
get_text_data_list
()[source]¶ Return the list of all textual attributes of the object.
Returns: The list of all textual attributes of the object. Return type: list
-
get_type
()[source]¶ Get descriptive type of the Note.
Returns: the descriptive type of the Note Return type: str
-
merge
(acquisition)[source]¶ Merge the content of acquisition into this note.
Lost: handle, id, type, format, text and styles of acquisition.
Parameters: acquisition (Note) – The note to merge with the present note.
-
serialize
()[source]¶ Convert the object to a serialized tuple of data.
Returns: The serialized format of the instance. Return type: tuple
-
set
(text)[source]¶ Set the text associated with the note to the passed string.
Parameters: text (str) – The clear text defining the note contents.
-
set_format
(format)[source]¶ Set the format of the note to the passed value.
Parameters: format (int) – The value can either indicate Flowed or Preformatted.
-
set_styledtext
(text)[source]¶ Set the text associated with the note to the passed string.
Parameters: text ( StyledText
) – The formatted text defining the note contents.
-