items.asset_items#

Asset items in their simplest sense are file paths made up of server, job, root and asset components.

1server, job, root, asset = common.active('asset', args=True)
2asset = f'{server}/{job}/{root}/{asset}'

The app considers folders found in the root of a bookmark item assets. We don’t have any notion of asset types (like how some pipelines make a distinction between shots and assets), nor do we understand nested assets by default (like a SEQ010/SH010 structure).

Hint

It is possible to use nested assets with a little workaround. If an asset folder contains a special .link file, any relative path defined inside it will be read and added to the asset items. See get_links() for details.

Asset data is queried by AssetItemModel, and displayed by AssetItemView. Any custom logic of how assets are queried should be implemented in AssetItemModel.item_generator().

Asset items have their own bespoke list of attributes, stored in the bookmark item’s database. See bookmarks.database for more details.

Classes:

AssetItemModel([parent])

The model containing all item information needed to represent assets.

AssetItemView([parent])

The view used to display AssetItemModel item.

AssetItemViewContextMenu(index[, parent])

The context menu associated with AssetItemView.

Functions:

get_display_name(s)

Manipulate the given file name to a display friendly name.

class bookmarks.items.asset_items.AssetItemModel(parent=None)[source]#

Bases: ItemModel

The model containing all item information needed to represent assets. Used in conjunction with AssetItemView.

Methods:

columnCount(index)

Number of columns the model has.

data(index[, role])

Returns and item data associated with the given index.

data_type()

Model data type.

default_row_size()

Returns the default item size.

filter_setting_dict_key()

The custom dictionary key used to save filter settings to the user settings file.

flags(index)

Overrides the flag behaviour to disable drag if the alt modifier is not pressed.

headerData(self, section, orientation[, role])

init_data(**kwargs)

Function wrapper.

item_generator(path)

Yields the asset items to be processed by init_data().

save_active()

Saves the active item.

source_path()

The model's parent folder path.

columnCount(index)[source]#

Number of columns the model has.

data(index, role=QtCore.Qt.DisplayRole)[source]#

Returns and item data associated with the given index.

data_type()[source]#

Model data type.

default_row_size()[source]#

Returns the default item size.

filter_setting_dict_key()[source]#

The custom dictionary key used to save filter settings to the user settings file.

flags(index)[source]#

Overrides the flag behaviour to disable drag if the alt modifier is not pressed.

headerData(self, section: int, orientation: PySide2.QtCore.Qt.Orientation, role: int = PySide2.QtCore.Qt.ItemDataRole.DisplayRole) Any[source]#
init_data(**kwargs)#

Function wrapper.

item_generator(path)[source]#

Yields the asset items to be processed by init_data().

Yields

DirEntry – Entry instances of valid asset folders.

save_active()[source]#

Saves the active item.

source_path()[source]#

The model’s parent folder path.

Returns

A tuple of path segments.

Return type

tuple

class bookmarks.items.asset_items.AssetItemView(parent=None)[source]#

Bases: ThreadedItemView

The view used to display AssetItemModel item.

Classes:

Methods:

adapt_horizontal_header(*args, **kwargs)

Slot connected to the resized signal is used to hide the progress columns when the window size is small.

add_item_action(index)

Action to execute when the add item icon is clicked.

edit_item_action(index)

Action to execute when the edit item icon is clicked.

get_hint_string()

Returns an informative hint text.

get_source_model()

Returns the model class associated with this view.

init_model(*args, **kwargs)

The methods responsible for connecting the associated item model with the view.

init_progress_columns()

Tweaks the horizontal header.

init_progress_hidden()

Restore the previous state of the inline icon buttons.

inline_icons_count()

Inline buttons count.

mouseReleaseEvent(event)

Concludes InlineIconView's multi-item toggle operation, and resets the associated variables.

set_progress_hidden(val)

Sets the visibility of the progress tracker columns.

showEvent(event)

Show event handler.

ContextMenu#

alias of AssetItemViewContextMenu Methods:

setup()

Creates the context menu.

Delegate#

alias of AssetItemViewDelegate Methods:

paint(painter, option, index)

Paints a bookmarks.items.asset_items.AssetItemView item.

sizeHint(option, index)

Returns the item's size hint.

Attributes:

fallback_thumb

The item's default thumbnail image

adapt_horizontal_header(*args, **kwargs)[source]#

Slot connected to the resized signal is used to hide the progress columns when the window size is small.

add_item_action(index)[source]#

Action to execute when the add item icon is clicked.

edit_item_action(index)[source]#

Action to execute when the edit item icon is clicked.

get_hint_string()[source]#

Returns an informative hint text.

get_source_model()[source]#

Returns the model class associated with this view.

init_model(*args, **kwargs)[source]#

The methods responsible for connecting the associated item model with the view.

init_progress_columns()[source]#

Tweaks the horizontal header.

init_progress_hidden()[source]#

Restore the previous state of the inline icon buttons.

inline_icons_count()[source]#

Inline buttons count.

mouseReleaseEvent(event)[source]#

Concludes InlineIconView’s multi-item toggle operation, and resets the associated variables.

The inline icon buttons are also triggered here. We’re using the delegate’s get_rectangles function to determine which icon was clicked.

set_progress_hidden(val)[source]#

Sets the visibility of the progress tracker columns.

showEvent(event)[source]#

Show event handler.

class bookmarks.items.asset_items.AssetItemViewContextMenu(index, parent=None)[source]#

Bases: BaseContextMenu

The context menu associated with AssetItemView.

Methods:

setup()

Creates the context menu.

setup()[source]#

Creates the context menu.

bookmarks.items.asset_items.get_display_name(s)[source]#

Manipulate the given file name to a display friendly name.

Parameters

s (str) – Source asset item file name.

Returns

A modified asset item display name.

Return type

str