Package gen :: Package lib :: Module person :: Class Person
[frames] | no frames]

Class Person

source code



Introduction
============
The Person record is the GRAMPS in-memory representation of an
individual person. It contains all the information related to
an individual.

Usage
=====
Person objects are usually created in one of two ways.

1. Creating a new person object, which is then initialized and added to 
    the database.
2. 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.

Instance Methods
 
__init__(self, data=None)
Create a new Person instance.
source code
tuple
serialize(self)
Convert the data held in the Person 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 Person object.
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_primary_name(self, name)
Set the primary name of the Person to the specified Name instance.
source code
Name
get_primary_name(self)
Return the Name instance marked as the Person's primary name.
source code
list
get_alternate_names(self)
Return the list of alternate Name instances.
source code
 
set_alternate_names(self, alt_name_list)
Change the list of alternate names to the passed list.
source code
 
add_alternate_name(self, name)
Add a Name instance to the list of alternative names.
source code
 
get_nick_name(self) source code
 
set_gender(self, gender)
Set the gender of the Person.
source code
int
get_gender(self)
Return the gender of the Person.
source code
 
set_birth_ref(self, event_ref)
Assign the birth event to the Person object.
source code
 
set_death_ref(self, event_ref)
Assign the death event to the Person object.
source code
EventRef
get_birth_ref(self)
Return the EventRef for Person's birth event.
source code
event_ref
get_death_ref(self)
Return the EventRef for the Person's death event.
source code
 
add_event_ref(self, event_ref)
Add the EventRef to the Person instance's EventRef list.
source code
list
get_event_ref_list(self)
Return the list of EventRef objects associated with Event instances.
source code
list
get_primary_event_ref_list(self)
Return the list of EventRef objects associated with Event instances that have been marked as primary events.
source code
 
set_event_ref_list(self, event_ref_list)
Set the Person instance's EventRef list to the passed list.
source code
 
add_family_handle(self, family_handle)
Add the Family handle to the Person instance's Family list.
source code
bool
set_preferred_family_handle(self, family_handle)
Set the family_handle specified to be the preferred Family.
source code
list
get_family_handle_list(self)
Return the list of Family handles in which the person is a parent or spouse.
source code
 
set_family_handle_list(self, family_list)
Assign the passed list to the Person's list of families in which it is a parent or spouse.
source code
 
clear_family_handle_list(self)
Remove all Family handles from the Family list.
source code
bool
remove_family_handle(self, family_handle)
Remove the specified Family handle from the list of marriages/partnerships.
source code
list
get_parent_family_handle_list(self)
Return the list of Family handles in which the person is a child.
source code
list
set_parent_family_handle_list(self, family_list)
Return the list of Family handles in which the person is a child.
source code
 
add_parent_family_handle(self, family_handle)
Add the Family handle to the Person instance's list of families in which it is a child.
source code
 
clear_parent_family_handle_list(self)
Remove all Family handles from the parent Family list.
source code
tuple
remove_parent_family_handle(self, family_handle)
Remove the specified Family handle from the list of parent families (families in which the parent is a child).
source code
bool
set_main_parent_family_handle(self, family_handle)
Set the main Family in which the Person is a child.
source code
str
get_main_parents_family_handle(self)
Return the handle of the Family considered to be the main Family in which the Person is a child.
source code
 
add_person_ref(self, person_ref)
Add the PersonRef to the Person instance's PersonRef list.
source code
list
get_person_ref_list(self)
Return the list of PersonRef objects.
source code
 
set_person_ref_list(self, person_ref_list)
Set the Person instance's PersonRef 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 attrbase.AttributeBase: add_attribute, get_attribute_list, remove_attribute, set_attribute_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 addressbase.AddressBase: add_address, get_address_list, remove_address, set_address_list

Inherited from urlbase.UrlBase: add_url, get_url_list, remove_url, set_url_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

Class Variables
  UNKNOWN = 2
  MALE = 1
  FEMALE = 0
Method Details

__init__(self, data=None)
(Constructor)

source code 

Create a new Person 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 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 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 Person object.

Parameters:
  • data (tuple) - tuple containing the persistent data associated the Person object
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_primary_name(self, name)

source code 

Set the primary name of the Person to the specified Name instance.

Parameters:
  • name (Name) - Name to be assigned to the person

get_primary_name(self)

source code 

Return the Name instance marked as the Person's primary name.

Returns: Name
Returns the primary name

get_alternate_names(self)

source code 

Return the list of alternate Name instances.

Returns: list
List of Name instances

set_alternate_names(self, alt_name_list)

source code 

Change the list of alternate names to the passed list.

Parameters:
  • alt_name_list (list) - List of Name instances

add_alternate_name(self, name)

source code 

Add a Name instance to the list of alternative names.

Parameters:

set_gender(self, gender)

source code 

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
    

get_gender(self)

source code 

Return the gender of the Person.

Returns: int
Returns one of the following constants:
   Person.MALE
   Person.FEMALE
   Person.UNKNOWN

set_birth_ref(self, event_ref)

source code 

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(self, event_ref)

source code 

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.

get_birth_ref(self)

source code 

Return the EventRef for Person's birth event.

This should correspond to an Event in the database's Event list.

Returns: EventRef
Returns the birth EventRef or None if no birth Event has been assigned.

get_death_ref(self)

source code 

Return the EventRef for the Person's death event.

This should correspond to an Event in the database's Event list.

Returns: event_ref
Returns the death EventRef or None if no death Event has been assigned.

add_event_ref(self, event_ref)

source code 

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.

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 Person instance.

get_primary_event_ref_list(self)

source code 

Return the list of EventRef objects associated with Event instances that have been marked as primary events.

Returns: list
Returns the list of EventRef objects associated with the Person instance.

set_event_ref_list(self, event_ref_list)

source code 

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

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

add_family_handle(self, family_handle)

source code 

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.

set_preferred_family_handle(self, family_handle)

source code 

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: bool
True if the call succeeded, False if the family_handle was not already in the Family list

get_family_handle_list(self)

source code 

Return the list of Family handles in which the person is a parent or spouse.

Returns: list
Returns the list of handles corresponding to the Family records with which the person is associated.

set_family_handle_list(self, family_list)

source code 

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

remove_family_handle(self, family_handle)

source code 

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

get_parent_family_handle_list(self)

source code 

Return the list of Family handles in which the person is a child.

Returns: list
Returns the list of handles corresponding to the Family records with which the person is a child.

set_parent_family_handle_list(self, family_list)

source code 

Return the list of Family handles in which the person is a child.

Returns: list
Returns the list of handles corresponding to the Family records with which the person is a child.

add_parent_family_handle(self, family_handle)

source code 

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.

remove_parent_family_handle(self, family_handle)

source code 

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: tuple
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.

set_main_parent_family_handle(self, family_handle)

source code 

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: bool
Returns True if the assignment has successful

get_main_parents_family_handle(self)

source code 

Return the handle of the Family considered to be the main Family in which the Person is a child.

Returns: str
Returns the family_handle if a family_handle exists, If no Family is assigned, None is returned

add_person_ref(self, person_ref)

source code 

Add the PersonRef to the Person instance's PersonRef list.

Parameters:

get_person_ref_list(self)

source code 

Return the list of PersonRef objects.

Returns: list
Returns the list of PersonRef objects.

set_person_ref_list(self, person_ref_list)

source code 

Set the Person instance's PersonRef list to the passed list.

Parameters:
  • person_ref_list (list) - List of valid PersonRef objects