6.143. sibl_gui.ui.caches

caches.py

Platform:
Windows, Linux, Mac Os X.
Description:
Defines the Application caches classes.

Others:

6.143.1. Module Attributes

sibl_gui.ui.caches.LOGGER

6.143.2. Classes

class sibl_gui.ui.caches.CacheMetrics(**kwargs)[source]

Bases: foundations.dataStructures.Structure

Defines a storage object for cache metrics.

Initializes the class.

Parameters:kwargs (dict) – type, content.
class sibl_gui.ui.caches.AbstractResourcesCache(parent=None)[source]

Bases: PyQt4.QtCore.QObject

Defines a QObject subclass used as an abstract resources cache.

Initializes the class.

Parameters:parent (QObject) – Object parent.
contentAdded

This signal is emited by the AsynchronousGraphicsItemsCache class whenever content has been added. ( pyqtSignal )

Returns:Content added to the cache.
Return type:list
contentRemoved

This signal is emited by the AsynchronousGraphicsItemsCache class whenever content has been removed. ( pyqtSignal )

Returns:Content removed from the cache.
Return type:list
mapping[source]

Property for self.__mapping attribute.

Returns:self.__mapping.
Return type:dict
isCached(key)[source]

Returns if given content is cached.

Parameters:key (object) – Content to retrieve.
Returns:Is content cached.
Return type:bool
listContent()[source]

Lists the cache content.

Returns:Cache content.
Return type:list
addContent(**content)[source]

Adds given content to the cache.

Parameters:**content (**) – Content to add.
Returns:Method success.
Return type:bool
removeContent(*keys)[source]

Removes given content from the cache.

Parameters:*keys (*) – Content to remove.
Returns:Method success.
Return type:bool
getContent(key)[source]

Gets given content from the cache.

Parameters:key (object) – Content to retrieve.
Returns:Content.
Return type:object
flushContent()[source]

Flushes the cache content.

Returns:Method success.
Return type:bool
getMetrics()[source]

Returns the cache metrics.

Returns:Cache metrics.
Return type:dict
class sibl_gui.ui.caches.AsynchronousGraphicsItemsCache(parent=None, type=None, placeholder=None)[source]

Bases: sibl_gui.ui.caches.AbstractResourcesCache

Defines an asynchronous graphics items cache.

Initializes the class.

Parameters:
  • parent (QObject) – Object parent.
  • type (QImage or QPixmap or QIcon) – Cache type.
  • placeholder (unicode) – Placeholder image.
type[source]

Property for self.__type attribute.

Returns:self.__type.
Return type:QObject
placeholder[source]

Property for self.__placeholder attribute.

Returns:self.__placeholder.
Return type:unicode
placeholderGraphicsItem[source]

Property for self.__placeholderGraphicsItem attribute.

Returns:self.__placeholderGraphicsItem.
Return type:QObject
worker[source]

Property for self.__worker attribute.

Returns:self.__worker.
Return type:QThread
getContent(key, size=u'Default')[source]

Reimplements the AbstractResourcesCache.getContent() method.

Parameters:
  • key (object) – Content to retrieve.
  • size (unicode) – Size to retrieve.
Returns:

Content.

Return type:

object

flushContent()[source]

Reimplements the AbstractResourcesCache.flushContent() method.

Returns:Method success.
Return type:bool
loadContent(**content)[source]

Loads given content into the cache.

Parameters:**content (**) – Content to add.
Returns:Method success.
Return type:bool
loadAsynchronousContent(**content)[source]

Loads given content asynchronously into the cache.

Parameters:**content (**) – Content to add.
Returns:Method success.
Return type:bool
getMetrics()[source]

Reimplements the AbstractResourcesCache.getMetrics() method.

Returns:Cache metrics.
Return type:dict