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.TagBaseThe BasicPrimaryObject is the base class for
Noteobjects.It is also the base class for the
PrimaryObjectclass.The
PrimaryObjectis 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.BasicPrimaryObjectThe 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.PrimaryObjectThe 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_event_ref(event_ref)[source]¶ Add the
EventRefto the Person instance’sEventReflist.This is accomplished by assigning the
EventRefof a validEventin the current database.
-
add_family_handle(family_handle)[source]¶ Add the
Familyhandle to the Person instance’sFamilylist.This is accomplished by assigning the handle of a valid
Familyin the current database.Adding a
Familyhandle to a Person does not automatically update the correspondingFamily. The developer is responsible to make sure that when aFamilyis added to Person, that the Person is assigned to either the father or mother role in theFamily.
-
add_parent_family_handle(family_handle)[source]¶ Add the
Familyhandle to the Person instance’s list of families in which it is a child.This is accomplished by assigning the handle of a valid
Familyin the current database.Adding a
Familyhandle to a Person does not automatically update the correspondingFamily. The developer is responsible to make sure that when aFamilyis added to Person, that the Person is added to theFamilyinstance’s child list.
-
property
gender¶ Returns or sets the gender of the person
-
get_alternate_names()[source]¶ Return the list of alternate
Nameinstances.- Returns
List of
Nameinstances- Return type
list
-
get_birth_ref()[source]¶ Return the
EventReffor Person’s birth event.This should correspond to an
Eventin the database’sEventlist.
-
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
EventReffor the Person’s death event.This should correspond to an
Eventin the database’sEventlist.
-
get_event_ref_list()[source]¶ Return the list of
EventRefobjects associated withEventinstances.- Returns
Returns the list of
EventRefobjects associated with the Person instance.- Return type
list
-
get_family_handle_list()[source]¶ Return the list of
Familyhandles in which the person is a parent or spouse.- Returns
Returns the list of handles corresponding to the
Familyrecords 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
Familyconsidered to be the mainFamilyin which the Person is a child.- Returns
Returns the family_handle if a family_handle exists, If no
Familyis assigned, None is returned- 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_parent_family_handle_list()[source]¶ Return the list of
Familyhandles in which the person is a child.- Returns
Returns the list of handles corresponding to the
Familyrecords with which the person is a child.- Return type
list
-
get_person_ref_list()[source]¶ Return the list of
PersonRefobjects.- Returns
Returns the list of
PersonRefobjects.- Return type
list
-
get_primary_event_ref_list()[source]¶ Return the list of
EventRefobjects associated withEventinstances that have been marked as primary events.- Returns
Returns generator of
EventRefobjects associated with the Person instance.- Return type
generator
-
get_primary_name()[source]¶ Return the
Nameinstance marked as the Person’s primary name.- Returns
Returns the primary name
- Return type
-
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
Familyhandle from the list of marriages/partnerships.If the handle does not exist in the list, the operation has no effect.
- Parameters
family_handle (str) –
Familyhandle to remove from the list- Returns
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
Familyhandle 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) –
Familyhandle to remove from the list- Returns
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
Nameinstances
-
set_birth_ref(event_ref)[source]¶ Assign the birth event to the Person object.
This is accomplished by assigning the
EventRefof the birth event in the current database.
-
set_death_ref(event_ref)[source]¶ Assign the death event to the Person object.
This is accomplished by assigning the
EventRefof the death event in the current database.
-
set_event_ref_list(event_ref_list)[source]¶ Set the Person instance’s
EventReflist to the passed list.- Parameters
event_ref_list (list) – List of valid
EventRefobjects.
-
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
Familyhandles 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
Familyin which the Person is a child.The main
Familyis theFamilytypically used for reports and navigation. This is accomplished by moving theFamilyto the beginning of the list. The family_handle must be in the list for this to have any effect.
-
set_parent_family_handle_list(family_list)[source]¶ Return the list of
Familyhandles in which the person is a child.- Returns
Returns the list of handles corresponding to the
Familyrecords with which the person is a child.- Return type
list
-
set_person_ref_list(person_ref_list)[source]¶ Set the Person instance’s
PersonReflist to the passed list.- Parameters
person_ref_list (list) – List of valid
PersonRefobjects
-
set_preferred_family_handle(family_handle)[source]¶ Set the family_handle specified to be the preferred
Family.The preferred
Familyis determined by the firstFamilyin theFamilylist, and is typically used to indicate the preferredFamilyfor navigation or reporting.The family_handle must already be in the list, or the function call has no effect.
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.PrimaryObjectThe 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
Personto the Family’s list of children.- Parameters
child_ref (ChildRef) – Child Reference instance
-
add_event_ref(event_ref)[source]¶ Add the
EventRefto the Family instance’sEventReflist.This is accomplished by assigning the
EventReffor the validEventin the current database.
-
get_child_ref_list()[source]¶ Return the list of
ChildRefhandles identifying the children of the Family.- Returns
Returns the list of
ChildRefhandles 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
EventRefobjects associated withEventinstances.- Returns
Returns the list of
EventRefobjects associated with the Family instance.- Return type
list
-
get_father_handle()[source]¶ Return the database handle of the
Personidentified as the father of the Family.- Returns
Persondatabase handle- 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_mother_handle()[source]¶ Return the database handle of the
Personidentified as the mother of the Family.- Returns
Persondatabase handle- 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
-
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
Personto the Family’s list of children if thePersonis already in the list.- Parameters
child_handle (str) –
Persondatabase handle- Returns
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
Personto the Family’s list of children if thePersonis 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
ChildRefinstances) – 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
EventReflist to the passed list.- Parameters
event_ref_list (list) – List of valid
EventRefobjects
-
set_father_handle(person_handle)[source]¶ Set the database handle for
Personthat 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) –
Persondatabase handle
-
set_mother_handle(person_handle)[source]¶ Set the database handle for
Personthat 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) –
Persondatabase 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.PrimaryObjectThe 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
-
property
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
-
property
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.PrimaryObjectContains 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_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
Locationobjects 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.
-
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
-
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
Locationobject list with the new one.
-
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.PrimaryObjectA record of a source of information.
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
RepoRefinstances associated with the Source.- Returns
list of
RepoRefinstances associated with the Source- 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
-
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
RepoRefinstances associated with the Source. It replaces the previous list.- Parameters
reporef_list (list) – list of
RepoRefinstances 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.PrimaryObjectA 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.PrimaryObjectContainer 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.PrimaryObjectA 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.BasicPrimaryObjectDefine a text note.
Starting from Gramps 3.1 Note object stores the text in
StyledTextinstance, 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
-
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.