seriesmarker.gui.model.decorated_node module

class DecoratedNode(scale=None, cache=True)[source]

Bases: object

Class to handle the decoration of nodes with banners.

__init__(scale=None, cache=True)[source]

Initializes a new instance.

Also defines if and to which size a banner should be scaled to and if the banner should be cached for further usage.

Parameters:
  • scale (PySide.QtCore.QSize) – Defines the size to scale a banner to if given.
  • cache (bool) – Defines whether or not a loaded banner should be cached on disk.
banner_loaded(pixmap)[source]

Adds a banner, loaded by BannerLoader, to the cache.

If a scale size was given while initialization, also scales the banner before adding it to the cache.

Parameters:pixmap (PySide.QtGui.Pixmap) – The pixmap containing the banner to cache.
banner_url()[source]

Describes a unique string for banner identification.

Returns:The URL of the node’s banner.
decoration(index)[source]

Defines the decoration of the node.

Tries to load a banner from the URL, defined by banner_url(), sets a default image while loading and in case the attempt to obtain a banner was unsuccesful. If a banner has been cached for the given URL, the cached image will be used instead.

Parameters:index (QModelIndex) – The index referring to the node to get decoration for.
Returns:The PySide.QtGui.Pixmap to use as the node’s decoration.