common.data#
Interface to interact with the item data cache.
All data loaded by the item models are stored in item_data
.
The module provides methods for the models to access, load and reset the cached data.
Functions:
|
Number of items in the data dictionary. |
|
Get a cached data dict from |
|
Get a data pointer from |
|
Get a weakref pointer from source item model index. |
|
Get cached data from |
|
Checks if the cached is completely loaded. |
|
Delete the requested data from the cache. |
|
Set data to |
|
Sort the given data using sort_by and sort_order. |
- bookmarks.common.data.data_count(key, task, data_type)[source]#
Number of items in the data dictionary.
- Parameters:
key (tuple) – A tuple of path segments.
task (str) – A task folder.
data_type (int) – One of
FileItem
orSequenceItem
.
- Returns:
The number of items in the data dictionary.
- Return type:
int
- bookmarks.common.data.get_data(key, task, data_type)[source]#
Get a cached data dict from
item_data
.- Parameters:
key (tuple) – A tuple of path segments.
task (str) – A task folder.
data_type (int) – One of
FileItem
orSequenceItem
.
- Returns:
The cached data.
- Return type:
common.DataDict
- bookmarks.common.data.get_data_ref(key, task, data_type)[source]#
Get a data pointer from
bookmarks.common.item_data
cache.- Parameters:
key (tuple) – A tuple of path segments.
task (str) – A task folder.
data_type (int) – One of
bookmarks.common.FileItem
orbookmarks.common.SequenceItem
.
- Returns:
Pointer to the requested data set.
- Return type:
weakref.ref
- bookmarks.common.data.get_ref_from_source_index(index)[source]#
Get a weakref pointer from source item model index.
- bookmarks.common.data.get_task_data(key, task)[source]#
Get cached data from
item_data
.- Parameters:
key (tuple) – A tuple of path segments.
task (str) – A task folder.
- Returns:
The cached data.
- Return type:
common.DataDict
- bookmarks.common.data.is_data_loaded(key, task, data_type)[source]#
Checks if the cached is completely loaded.
- Parameters:
key (tuple) – A tuple of path segments.
task (str) – A task folder.
data_type (int) – One of
FileItem
orSequenceItem
.
- Returns:
True if loaded, false otherwise.
- Return type:
bool
- bookmarks.common.data.reset_data(key, task)[source]#
Delete the requested data from the cache.
- Parameters:
key (tuple) – A tuple of path segments.
task (str) – A task folder.
- bookmarks.common.data.set_data(key, task, data_type, data)[source]#
Set data to
bookmarks.common.item_data
.- Parameters:
key (tuple) – A tuple of path segments.
task (str) – A task folder.
data_type (int) – One of
bookmarks.common.FileItem
orbookmarks.common.SequenceItem
.data (common.DataDict) – The data to set in the cache.
- bookmarks.common.data.sort_data(ref, sort_by, sort_order)[source]#
Sort the given data using sort_by and sort_order.
- Parameters:
ref (weakref.ref) – Pointer to a
DataDict
instance.sort_by (int) – The role to use to sort the data.
sort_order (bool) – The sort order.
- Returns:
A sorted copy of the source data.
- Return type:
common.DataDict