Package gen :: Package lib :: 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)
Create a new Family instance.
source code
tuple
serialize(self)
Convert the data held in the event to a Python tuple that represents all the data elements.
source code
 
unserialize(self, data)
Convert 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)
Return the list of all textual attributes of the object.
source code
list
get_text_data_child_list(self)
Return the list of child objects that may carry textual data.
source code
list
get_sourcref_child_list(self)
Return the list of child secondary objects that may refer sources.
source code
list
get_note_child_list(self)
Return the list of child secondary objects that may refer notes.
source code
list
get_referenced_handles(self)
Return the list of (classname, handle) tuples for all directly referenced primary objects.
source code
list
get_handle_referents(self)
Return the list of child objects which may, directly or through their children, reference primary objects..
source code
 
set_relationship(self, relationship_type)
Set the relationship type between the people identified as the father and mother in the relationship.
source code
 
get_relationship(self)
Return the relationship type between the people identified as the father and mother in the relationship.
source code
 
set_father_handle(self, person_handle)
Set the database handle for Person that corresponds to male of the relationship.
source code
str
get_father_handle(self)
Return the database handle of the Person identified as the father of the Family.
source code
 
set_mother_handle(self, person_handle)
Set the database handle for Person that corresponds to male of the relationship.
source code
str
get_mother_handle(self)
Return the database handle of the Person identified as the mother of the Family.
source code
 
add_child_ref(self, child_ref)
Add the database handle for Person to the Family's list of children.
source code
bool
remove_child_ref(self, child_ref)
Remove 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)
Remove 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)
Return the list of ChildRef handles identifying the children of the Family.
source code
 
set_child_ref_list(self, child_ref_list)
Assign the passed list to the Family's list children.
source code
 
add_event_ref(self, event_ref)
Add the EventRef to the Family instance's EventRef list.
source code
 
get_event_list(self) source code
list
get_event_ref_list(self)
Return the list of EventRef objects associated with Event instances.
source code
 
set_event_ref_list(self, event_ref_list)
Set the Family instance's EventRef list to the passed list.
source code

Inherited from srcbase.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 attrbase.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 primaryobj.PrimaryObject: get_marker, has_handle_reference, remove_handle_references, replace_handle_reference, set_marker

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

Inherited from baseobj.BaseObject: get_referenced_handles_recursively, matches_regexp, matches_string

Inherited from privacybase.PrivacyBase: get_privacy, set_privacy

Method Details

__init__(self)
(Constructor)

source code 

Create a new Family instance.

After initialization, most data items have empty or null values, including the database handle.

Parameters:
  • source - Object used to initialize the new object
Overrides: privacybase.PrivacyBase.__init__

serialize(self)

source code 

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 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: privacybase.PrivacyBase.serialize

unserialize(self, data)

source code 

Convert the data held in a tuple created by the serialize method back into the data in a Family structure.

Overrides: privacybase.PrivacyBase.unserialize

get_text_data_list(self)

source code 

Return the list of all textual attributes of the object.

Returns: list
Returns the list of all textual attributes of the object.
Overrides: baseobj.BaseObject.get_text_data_list

get_text_data_child_list(self)

source code 

Return the list of child objects that may carry textual data.

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

get_sourcref_child_list(self)

source code 

Return 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: srcbase.SourceBase.get_sourcref_child_list

get_note_child_list(self)

source code 

Return the list of child secondary objects that may refer notes.

Returns: list
Returns the list of child secondary child objects that may refer notes.
Overrides: notebase.NoteBase.get_note_child_list

get_referenced_handles(self)

source code 

Return the list of (classname, handle) tuples for all directly referenced primary objects.

Returns: list
List of (classname, handle) tuples for referenced objects.
Overrides: baseobj.BaseObject.get_referenced_handles

get_handle_referents(self)

source code 

Return 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: baseobj.BaseObject.get_handle_referents

set_relationship(self, relationship_type)

source code 

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:

  • 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 

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

get_father_handle(self)

source code 

Return 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 

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

get_mother_handle(self)

source code 

Return 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 

Add 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 

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

remove_child_handle(self, child_handle)

source code 

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

get_child_ref_list(self)

source code 

Return 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 

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.

add_event_ref(self, event_ref)

source code 

Add 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 

Return 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 

Set the Family instance's EventRef list to the passed list.

Parameters:
  • event_ref_list (list) - List of valid EventRef objects