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_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 source references from the object.
In the base class no such references exist. Derived classes should override this if they provide source 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_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.
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’s EventRef list.
This is accomplished by assigning the EventRef of a valid Event in the current database.
Parameters: event_ref (EventRef) – the EventRef to be added to the Person’s EventRef list.
- add_family_handle(family_handle)[source]¶
Add the Family handle to the Person instance’s Family 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 corresponding Family. The developer is responsible to make sure that when a Family is added to Person, that the Person is assigned to either the father or mother role in the Family.
Parameters: family_handle (str) – handle of the Family to be added to the Person’s Family 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 corresponding Family. The developer is responsible to make sure that when a Family is added to Person, that the Person is added to the Family instance’s child list.
Parameters: family_handle (str) – handle of the Family to be added to the Person’s Family list.
- add_person_ref(person_ref)[source]¶
Add the PersonRef to the Person instance’s PersonRef list.
Parameters: person_ref (PersonRef) – the PersonRef to be added to the Person’s PersonRef list.
- classmethod from_struct(struct)[source]¶
Given a struct data representation, return a serialized object.
Returns: Returns a serialized object
- get_alternate_names()[source]¶
Return the list of alternate Name instances.
Returns: List of Name instances Return type: list
- get_birth_ref()[source]¶
Return the EventRef for Person’s birth event.
This should correspond to an Event in the database’s Event list.
Returns: Returns the birth EventRef or None if no birth Event 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’s Event list.
Returns: Returns the death EventRef or None if no death Event has been assigned. Return type: event_ref
- get_event_ref_list()[source]¶
Return the list of EventRef objects associated with Event 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 main Family in which the Person is a child.
Returns: Returns the family_handle if a family_handle exists, If no Family is 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 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 with Event 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
- 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 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 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 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 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 the Family typically used for reports and navigation. This is accomplished by moving the Family 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 main Family 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 first Family in the Family list, and is typically used to indicate the preferred Family 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 preferred Family. Returns: True if the call succeeded, False if the family_handle was not already in the Family list. Return type: bool
- set_primary_name(name)[source]¶
Set the primary name of the Person to the specified Name instance.
Parameters: name (Name) – Name to be assigned to the person
- to_struct()[source]¶
Convert the data held in this object to a structure (eg, struct) that represents all the data elements.
This method is used to recursively convert the object into a self-documenting form that can easily be used for various purposes, including diffs and queries.
These structures may be primitive Python types (string, integer, boolean, etc.) or complex Python types (lists, tuples, or dicts). If the return type is a dict, then the keys of the dict match the fieldname of the object. If the return struct (or value of a dict key) is a list, then it is a list of structs. Otherwise, the struct is just the value of the attribute.
Returns: Returns a struct containing the data of the object. Return type: dict
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’s EventRef list.
This is accomplished by assigning the EventRef for the valid Event in the current database.
Parameters: event_ref (EventRef) – the EventRef to be added to the Person’s EventRef list.
- classmethod from_struct(struct)[source]¶
Given a struct data representation, return a serialized object.
Returns: Returns a serialized object
- 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 with Event 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 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 Person identified as the mother of the Family.
Returns: Person database 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.
- 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 the Person is already in the list.
Parameters: child_handle (str) – Person database 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 Person to the Family’s list of children if the Person 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.
- to_struct()[source]¶
Convert the data held in this object to a structure (eg, struct) that represents all the data elements.
This method is used to recursively convert the object into a self-documenting form that can easily be used for various purposes, including diffs and queries.
These structures may be primitive Python types (string, integer, boolean, etc.) or complex Python types (lists, tuples, or dicts). If the return type is a dict, then the keys of the dict match the fieldname of the object. If the return struct (or value of a dict key) is a list, then it is a list of structs. Otherwise, the struct is just the value of the attribute.
Returns: Returns a struct containing the data of the object. Return type: dict
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
- classmethod from_struct(struct)[source]¶
Given a struct data representation, return a serialized object.
Returns: Returns a serialized object
- 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
- 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
- to_struct()[source]¶
Convert the data held in this object to a structure (eg, struct) that represents all the data elements.
This method is used to recursively convert the object into a self-documenting form that can easily be used for various purposes, including diffs and queries.
These structures may be primitive Python types (string, integer, boolean, etc.) or complex Python types (lists, tuples, or dicts). If the return type is a dict, then the keys of the dict match the fieldname of the object. If the return struct (or value of a dict key) is a list, then it is a list of structs. Otherwise, the struct is just the value of the attribute.
Returns: Returns a struct containing the data of the object. Return type: dict
- 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
- classmethod from_struct(struct)[source]¶
Given a struct data representation, return a serialized object.
Returns: Returns a serialized object
- 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
- 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 Locations for the Place Return 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 strings
- 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: 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_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
- 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 of Location 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 strings) – 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: title (str) – 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
- set_type(place_type)[source]¶
Set the type of the Place object.
Parameters: type (PlaceType) – type to assign to the Place
- to_struct()[source]¶
Convert the data held in this object to a structure (eg, struct) that represents all the data elements.
This method is used to recursively convert the object into a self-documenting form that can easily be used for various purposes, including diffs and queries.
These structures may be primitive Python types (string, integer, boolean, etc.) or complex Python types (lists, tuples, or dicts). If the return type is a dict, then the keys of the dict match the fieldname of the object. If the return struct (or value of a dict key) is a list, then it is a list of structs. Otherwise, the struct is just the value of the attribute.
Returns: Returns a struct containing the data of the object. Return type: dict
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.
- classmethod from_struct(struct)[source]¶
Given a struct data representation, return a serialized object.
Returns: Returns a serialized object
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 Source Return type: list
- 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.
- set_title(title)[source]¶
Set the descriptive title of the Source object.
Parameters: title (str) – descriptive title to assign to the Source
- to_struct()[source]¶
Convert the data held in this object to a structure (eg, struct) that represents all the data elements.
This method is used to recursively convert the object into a self-documenting form that can easily be used for various purposes, including diffs and queries.
These structures may be primitive Python types (string, integer, boolean, etc.) or complex Python types (lists, tuples, or dicts). If the return type is a dict, then the keys of the dict match the fieldname of the object. If the return struct (or value of a dict key) is a list, then it is a list of structs. Otherwise, the struct is just the value of the attribute.
Returns: Returns a struct containing the data of the object. Return type: dict
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¶
- classmethod from_struct(struct)[source]¶
Given a struct data representation, return a serialized object.
Returns: Returns a serialized object
- 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_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 citation.
Parameters: acquisition (Citation) – The citation to merge with the present citation.
- to_struct()[source]¶
Convert the data held in this object to a structure (eg, struct) that represents all the data elements.
This method is used to recursively convert the object into a self-documenting form that can easily be used for various purposes, including diffs and queries.
These structures may be primitive Python types (string, integer, boolean, etc.) or complex Python types (lists, tuples, or dicts). If the return type is a dict, then the keys of the dict match the fieldname of the object. If the return struct (or value of a dict key) is a list, then it is a list of structs. Otherwise, the struct is just the value of the attribute.
Returns: Returns a struct containing the data of the object. Return type: dict
Media Object¶
Media object for Gramps.
- class gramps.gen.lib.mediaobj.MediaObject(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.
- classmethod from_struct(struct)[source]¶
Given a struct data representation, return a serialized object.
Returns: Returns a serialized object
- 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 MediaObject.
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
- 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 (MediaObject) – 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
- set_mime_type(mime_type)[source]¶
Set the MIME type associated with the MediaObject.
Parameters: mime_type (str) – MIME type to be assigned to the object
- to_struct()[source]¶
Convert the data held in this object to a structure (eg, struct) that represents all the data elements.
This method is used to recursively convert the object into a self-documenting form that can easily be used for various purposes, including diffs and queries.
These structures may be primitive Python types (string, integer, boolean, etc.) or complex Python types (lists, tuples, or dicts). If the return type is a dict, then the keys of the dict match the fieldname of the object. If the return struct (or value of a dict key) is a list, then it is a list of structs. Otherwise, the struct is just the value of the attribute.
Returns: Returns a struct containing the data of the object. Return type: dict
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.
- classmethod from_struct(struct)[source]¶
Given a struct data representation, return a serialized object.
Returns: Returns a serialized object
- 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_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.
- to_struct()[source]¶
Convert the data held in this object to a structure (eg, struct) that represents all the data elements.
This method is used to recursively convert the object into a self-documenting form that can easily be used for various purposes, including diffs and queries.
These structures may be primitive Python types (string, integer, boolean, etc.) or complex Python types (lists, tuples, or dicts). If the return type is a dict, then the keys of the dict match the fieldname of the object. If the return struct (or value of a dict key) is a list, then it is a list of structs. Otherwise, the struct is just the value of the attribute.
Returns: Returns a struct containing the data of the object. Return type: dict
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() and set() methods.
To get and set the formatted version of the Note’s text use the get_styledtext() and set_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: - FLOWED – indicates flowed format
- FORMATTED – indicates formatted format (respecting whitespace needed)
- POS_<x> – (int) Position of <x> attribute in the serialized format of an instance.
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.
- classmethod from_struct(struct)[source]¶
Given a struct data representation, return a serialized object.
Returns: Returns a serialized object
- 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
- 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.
- set_type(the_type)[source]¶
Set descriptive type of the Note.
Parameters: the_type (str) – descriptive type of the Note
- to_struct()[source]¶
Convert the data held in this object to a structure (eg, struct) that represents all the data elements.
This method is used to recursively convert the object into a self-documenting form that can easily be used for various purposes, including diffs and queries.
These structures may be primitive Python types (string, integer, boolean, etc.) or complex Python types (lists, tuples, or dicts). If the return type is a dict, then the keys of the dict match the fieldname of the object. If the return struct (or value of a dict key) is a list, then it is a list of structs. Otherwise, the struct is just the value of the attribute.
Returns: Returns a struct containing the data of the object. Return type: dict