python.shotgun_model.shotgun_entity_model module

class ShotgunEntityModel(entity_type, filters, hierarchy, fields, parent, download_thumbs=False, schema_generation=0, bg_load_thumbs=True, bg_task_manager=None)[source]

Bases: python.shotgun_model.shotgun_model.ShotgunModel

A model that contains a hierarchy of Shotgun entity data and sets the icon for each item to the icon for the entity type if available.

For Step entities, the icon will be a colour swatch based on the Step color field

async_refresh()[source]

Trigger an asynchronous refresh of the model

destroy()[source]

Call to clean-up the model when it is finished with

get_entities(item)[source]

Get entities for the current item by traversing up the tree and pulling entity information from each item if possible

Parameters:item (QStandardItem) – The item to find entities for.
Returns:A list of Shotgun entity dictionaries in the order they were found starting from the specified item. Each dictionary will contain all the entity information stored by the model which is usually determined by the list of fields passed during construction plus name/code, type and id.

For non-leaf items that represent Shotgun entities, the dictionary will typically just contain name, type and id.

get_entity(item)[source]

Get the Shotgun entity details for the specified model item.

Parameters:item (QStandardItem) – The item to retrieve the entity details for.
Returns:A Shotgun entity dictionary for the item if it represents an entity, otherwise None. The dictionary will contain all the entity information stored by the model which is usually determined by the list of fields passed during construction plus name/code, type and id.
get_entity_icon(entity_type)[source]

Convenience method. Retrieve the icon for the specified entity type if available.

Parameters:entity_type – The entity type to retrieve the icon for
Returns:A QIcon if an icon was found for the specified entity type, otherwise None.