Flow Production Tracking Widgets

Widgets to display Flow Production Tracking specific data using a Qt view and delegate, in customizable way.

class shotgun_widget.ShotgunWidget(parent=None)[source]

Bases: QWidget

Shotgun widget base class.

Construction

Parameters:

parent – The parent widget

set_thumbnail(thumbnail)[source]

Set the widget thumbnail. If the widget has been configured to display a thumbnail but no image has been supplied, a default picture will be displayed instead.

Parameters:

thumbnail – The thumbnail as a QtGui.QIcon

set_selected(selected)[source]

Adjust the style sheet to indicate selection or not

Parameters:

selected – True if selected, false if not

set_actions(actions)[source]

Adds a list of QActions to the actions menu for this widget.

Parameters:

actions – List of QActions to add

resizeEvent(event)[source]

Override the base method.

Rescale the pixmap when the label resizes.

Parameters:

event (QResizeEvent) – The resize event payload.

set_scaled_thumbnail(pixmap=None)[source]

Set the thumbnail label pixmap.

Scale the pixmap to the label’s size and center it within the label. Keep the aspect ratio of the pixmap when scaling.

Parameters:

pixmap (QtGui.QPixmap) – The pixmap to set on the label.

class shotgun_widget.ShotgunListWidget(parent=None)[source]

Bases: ShotgunWidget

This Shotgun Widget is typically used in a list view mode.

Class constructor

Parameters:

parent – The parent widget

set_formatting(top_left=None, top_right=None, body=None, thumbnail=True)[source]

Set the rendering of the widget items.

Parameters:
  • top_left – Content to display in the top left area of the item

  • top_right – Content to display in the top right area of the item

  • body – Content to display in the main area of the item

  • thumbnail – If True, the widget will display a thumbnail. If False, no thumbnail will be displayed.

set_text(sg_data)[source]

Fill the widget items by replacing the tokens with the right values.

Parameters:

sg_data – Dictionary of Shotgun data we want to use to replace the tokens with.

replace_extra_key(key_name, key_value)[source]

Replace a non-Shotgun token by its value.

Parameters:
  • key_name – Name of the token to replace. It must be declared using <> character (eg <NODE>)

  • key_value – Replacement value to use

clear(thumbnail=None)[source]

Clear the widget values.

Parameters:

thumbnail – If a thumbnail is supplied, it will be used as the “empty” thumbnail view

static calculate_size()[source]

Calculates and returns a suitable size for this widget.

Returns:

Size of the widget

class shotgun_widget.ShotgunFolderWidget(parent=None)[source]

Bases: ShotgunWidget

This Shotgun Widget is typically used in an icon view mode.

Class constructor

Parameters:

parent – The parent widget

set_formatting(header=None, body=None, thumbnail=True)[source]

Set the rendering of the widget items.

Parameters:
  • header – Content to display in the header area of the item

  • body – Content to display in the main area of the item

  • thumbnail – If True, the widget will display a thumbnail. If False, no thumbnail will be displayed.

set_text(sg_data)[source]

Fill the widget items by replacing the tokens with the right values.

Parameters:

sg_data – Dictionary of Shotgun data we want to use to replace the tokens with.

replace_extra_key(key_name, key_value)[source]

Replace a non-Shotgun token by its value.

Parameters:
  • key_name – Name of the token to replace. It must be declared using <> character (eg <NODE>)

  • key_value – Replacement value to use

clear(thumbnail=None)[source]

Clear the widget values.

Parameters:

thumbnail – If a thumbnail is supplied, it will be used as the “empty” thumbnail view

static calculate_size()[source]

Calculates and returns a suitable size for this widget.

Returns:

Size of the widget