Package RelLib :: Module _Family :: Class Family
[frames] | no frames]

Class Family

source code


Introduction

The Family record is the GRAMPS in-memory representation of the relationships between people. It contains all the information related to the relationship.

Usage

Family objects are usually created in one of two ways.
  1. Creating a new Family object, which is then initialized and added to the database.
  2. 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.

Instance Methods
 
__init__(self)
Creates a new Family instance.
source code
tuple
serialize(self)
Converts the data held in the event to a Python tuple that represents all the data elements.
source code
 
unserialize(self, data)
Converts the data held in a tuple created by the serialize method back into the data in a Family structure.
source code
list
get_text_data_list(self)
Returns the list of all textual attributes of the object.
source code
list
get_text_data_child_list(self)
Returns the list of child objects that may carry textual data.
source code
list
get_sourcref_child_list(self)
Returns the list of child secondary objects that may refer sources.
source code
list
get_referenced_handles(self)
Returns the list of (classname,handle) tuples for all directly referenced primary objects.
source code
list
get_handle_referents(self)
Returns the list of child objects which may, directly or through their children, reference primary objects..
source code
 
set_relationship(self, relationship_type)
Sets the relationship type between the people identified as the father and mother in the relationship.
source code
 
get_relationship(self)
Returns the relationship type between the people identified as the father and mother in the relationship.
source code
 
set_father_handle(self, person_handle)
Sets the database handle for Person that corresponds to male of the relationship.
source code
str
get_father_handle(self)
Returns the database handle of the Person identified as the father of the Family.
source code
 
set_mother_handle(self, person_handle)
Sets the database handle for Person that corresponds to male of the relationship.
source code
str
get_mother_handle(self)
Returns the database handle of the Person identified as the mother of the Family.
source code
 
add_child_ref(self, child_ref)
Adds the database handle for Person to the Family's list of children.
source code
bool
remove_child_ref(self, child_ref)
Removes the database handle for Person to the Family's list of children if the Person is already in the list.
source code
bool
remove_child_handle(self, child_handle)
Removes the database handle for Person to the Family's list of children if the Person is already in the list.
source code
list
get_child_ref_list(self)
Returns the list of ChildRef handles identifying the children of the Family.
source code
 
set_child_ref_list(self, child_ref_list)
Assigns the passed list to the Family's list children.
source code
 
add_event_ref(self, event_ref)
Adds the EventRef to the Family instance's EventRef list.
source code
 
get_event_list(self) source code
list
get_event_ref_list(self)
Returns the list of EventRef objects associated with Event instances.
source code
 
set_event_ref_list(self, event_ref_list)
Sets the Family instance's EventRef list to the passed list.
source code

Inherited from _SourceBase.SourceBase: add_source_reference, get_source_references, has_source_reference, remove_source_references, replace_source_references, set_source_reference_list

Inherited from _NoteBase.NoteBase: add_note, get_note_list, get_referenced_note_handles, remove_note, set_note_list

Inherited from _MediaBase.MediaBase: add_media_reference, get_media_list, has_media_reference, remove_media_references, replace_media_references, set_media_list

Inherited from _AttributeBase.AttributeBase: add_attribute, get_attribute_list, remove_attribute, set_attribute_list

Inherited from _LdsOrdBase.LdsOrdBase: add_lds_ord, get_lds_ord_list, remove_lds_ord, set_lds_ord_list

Inherited from _PrimaryObject.PrimaryObject: get_marker, has_handle_reference, remove_handle_references, replace_handle_reference, set_marker

Inherited from _BasicPrimaryObject.BasicPrimaryObject: get_change_display, get_change_time, get_gramps_id, get_handle, set_gramps_id, set_handle

Inherited from _BaseObject.BaseObject: get_referenced_handles_recursively, matches_regexp, matches_string

Inherited from _PrivacyBase.PrivacyBase: get_privacy, set_privacy

Method Details

__init__(self)
(Constructor)

source code 
Creates a new Family instance. After initialization, most data items have empty or null values, including the database handle.
Overrides: _SourceBase.SourceBase.__init__

serialize(self)

source code 

Converts 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 primative Python types (string, integers), complex Python types (lists or tuples, or Python objects. If the target database cannot handle complex types (such as objectes or lists), the database is responsible for converting the data into a form that it can use.
Returns: tuple
Returns a python tuple containing the data that should be considered persistent.
Overrides: _SourceBase.SourceBase.serialize

unserialize(self, data)

source code 
Converts the data held in a tuple created by the serialize method back into the data in a Family structure.
Overrides: _SourceBase.SourceBase.unserialize

get_text_data_list(self)

source code 
Returns the list of all textual attributes of the object.
Returns: list
Returns the list of all textual attributes of the object.
Overrides: _BaseObject.BaseObject.get_text_data_list

get_text_data_child_list(self)

source code 
Returns the list of child objects that may carry textual data.
Returns: list
Returns the list of child objects that may carry textual data.
Overrides: _BaseObject.BaseObject.get_text_data_child_list

get_sourcref_child_list(self)

source code 
Returns the list of child secondary objects that may refer sources.
Returns: list
Returns the list of child secondary child objects that may refer sources.
Overrides: _SourceBase.SourceBase.get_sourcref_child_list

get_referenced_handles(self)

source code 
Returns the list of (classname,handle) tuples for all directly referenced primary objects.
Returns: list
List of (classname,handle) tuples for referenced objects.
Overrides: _BaseObject.BaseObject.get_referenced_handles

get_handle_referents(self)

source code 
Returns the list of child objects which may, directly or through their children, reference primary objects..
Returns: list
Returns the list of objects refereincing primary objects.
Overrides: _BaseObject.BaseObject.get_handle_referents

set_relationship(self, relationship_type)

source code 
Sets 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:
  • 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.

set_father_handle(self, person_handle)

source code 
Sets 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

get_father_handle(self)

source code 
Returns the database handle of the Person identified as the father of the Family.
Returns: str
Person database handle

set_mother_handle(self, person_handle)

source code 
Sets 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

get_mother_handle(self)

source code 
Returns the database handle of the Person identified as the mother of the Family.
Returns: str
Person database handle

add_child_ref(self, child_ref)

source code 
Adds the database handle for Person to the Family's list of children.
Parameters:
  • child_ref (ChildRef) - Child Reference instance

remove_child_ref(self, child_ref)

source code 
Removes 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: bool
True if the handle was removed, False if it was not in the list.

remove_child_handle(self, child_handle)

source code 
Removes 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: bool
True if the handle was removed, False if it was not in the list.

get_child_ref_list(self)

source code 
Returns the list of ChildRef handles identifying the children of the Family.
Returns: list
Returns the list of ChildRef handles assocated with the Family.

set_child_ref_list(self, child_ref_list)

source code 
Assigns 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.

add_event_ref(self, event_ref)

source code 
Adds the EventRef to the Family instance's EventRef list. This is accomplished by assigning the EventRef for the valid Eventin the current database.
Parameters:
  • event_ref (EventRef) - the EventRef to be added to the Person's EventRef list.

get_event_ref_list(self)

source code 
Returns the list of EventRef objects associated with Event instances.
Returns: list
Returns the list of EventRef objects associated with the Family instance.

set_event_ref_list(self, event_ref_list)

source code 
Sets the Family instance's EventRef list to the passed list.
Parameters:
  • event_ref_list (list) - List of valid EventRef objects