Package gen :: Package lib :: Module mediaobj :: Class MediaObject
[frames] | no frames]

Class MediaObject

source code


Containter for information about an image file, including location, description and privacy.

Instance Methods
 
__init__(self, source=None)
Initialize a MediaObject.
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 an Event 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_mime_type(self, mime_type)
Set the MIME type associated with the MediaObject.
source code
str
get_mime_type(self)
Return the MIME type associated with the MediaObject.
source code
 
set_path(self, path)
Set the file path to the passed path.
source code
 
get_path(self)
Return the file path.
source code
 
set_description(self, text)
Set the description of the image.
source code
 
get_description(self)
Return the description of the image.
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 datebase.DateBase: get_date_object, set_date_object

Inherited from attrbase.AttributeBase: add_attribute, get_attribute_list, remove_attribute, set_attribute_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, has_media_reference, remove_media_references, replace_media_references, 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, source=None)
(Constructor)

source code 

Initialize a MediaObject.

If source is not None, then object is initialized from values of the source object.

Parameters:
  • source (MediaObject) - 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 an Event structure.

Parameters:
  • data (tuple) - tuple containing the persistent data associated the 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_mime_type(self, mime_type)

source code 

Set the MIME type associated with the MediaObject.

Parameters:
  • mime_type (str) - MIME type to be assigned to the object

get_mime_type(self)

source code 

Return the MIME type associated with the MediaObject.

Returns: str
Returns the associated MIME type