ShotGrid Search Completers

Global Search Completer

The global search completer is a QCompleter instance for use with widgets that allow input of ShotGrid entities. The completer can be customized to search across a given set of entity types.

Once a user selects an object, a signal fires to indicate that an entity was activated.

class search_completer.GlobalSearchCompleter(parent=None)[source]

A standalone PySide.QtGui.QCompleter class for matching SG entities to typed text.

Signal:entity_selected(str, int) - Provided for backward compatibility. entity_activated is emitted at the same time with an additional name value. Fires when someone selects an entity inside the search results. The returned parameters are entity type and entity id.
Signal:entity_activated(str, int, str) - Fires when someone activates an entity inside the search results. Essentially the same as entity_selected only the parameters returned are type, id and name.
Modes:MODE_LOADING, MODE_NOT_FOUND, MODE_RESULT - Used to identify the mode of an item in the completion list
Model role:MODE_ROLE - Stores the mode of an item in the completion list (see modes above)
Model role:SG_DATA_ROLE - Role for storing shotgun data in the model
Parameters:parent (QWidget) – Parent widget
get_result(model_index)[source]

Return the entity data for the supplied model index or None if there is no data for the supplied index.

Parameters:model_index (QModelIndex) – The index of the model to return the result for.
Returns:The entity dict for the supplied model index.
Return type:dict: or None
set_searchable_entity_types(types_dict)[source]

Specify a dictionary of entity types with optional search filters to limit the breadth of the widget’s search.

Use this method to override the default searchable entity types dictionary which looks like this:

{
  "Asset": [],
  "Shot": [],
  "Task": [],
  "HumanUser": [["sg_status_list", "is", "act"]],    # only active users
  "Group": [],
  "ClientUser": [["sg_status_list", "is", "act"]],   # only active users
  "ApiUser": [],
  "Version": [],
  "PublishedFile": [],
}
Parameters:types_dict – A dictionary of searchable types with optional filters
blockSignals(self, b:bool) → bool
caseSensitivity(self) → PySide2.QtCore.Qt.CaseSensitivity
childEvent(self, event:PySide2.QtCore.QChildEvent) → None
children(self) → typing.List
clear()

Manually clear the contents of the completer’s popup view.

complete(self, rect:PySide2.QtCore.QRect=Default(QRect)) → None
completionColumn(self) → int
completionCount(self) → int
completionMode(self) → PySide2.QtWidgets.QCompleter.CompletionMode
completionModel(self) → PySide2.QtCore.QAbstractItemModel
completionPrefix(self) → str
completionRole(self) → int
static connect(arg__1:PySide2.QtCore.QObject, arg__2:bytes, arg__3:typing.Callable, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) → bool

connect(self, arg__1:bytes, arg__2:typing.Callable, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) -> bool connect(self, arg__1:bytes, arg__2:PySide2.QtCore.QObject, arg__3:bytes, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) -> bool connect(self, sender:PySide2.QtCore.QObject, signal:bytes, member:bytes, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) -> PySide2.QtCore.QMetaObject.Connection connect(sender:PySide2.QtCore.QObject, signal:PySide2.QtCore.QMetaMethod, receiver:PySide2.QtCore.QObject, method:PySide2.QtCore.QMetaMethod, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) -> PySide2.QtCore.QMetaObject.Connection connect(sender:PySide2.QtCore.QObject, signal:bytes, receiver:PySide2.QtCore.QObject, member:bytes, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) -> PySide2.QtCore.QMetaObject.Connection

connectNotify(self, signal:PySide2.QtCore.QMetaMethod) → None
currentCompletion(self) → str
currentIndex(self) → PySide2.QtCore.QModelIndex
currentRow(self) → int
customEvent(self, event:PySide2.QtCore.QEvent) → None
deleteLater(self) → None
destroy()

Should be called before the widget is closed

static disconnect(arg__1:PySide2.QtCore.QMetaObject.Connection) → bool

disconnect(arg__1:PySide2.QtCore.QObject, arg__2:bytes, arg__3:typing.Callable) -> bool disconnect(self, arg__1:bytes, arg__2:typing.Callable) -> bool disconnect(self, receiver:PySide2.QtCore.QObject, member:typing.Union[bytes, NoneType]=None) -> bool disconnect(self, signal:bytes, receiver:PySide2.QtCore.QObject, member:bytes) -> bool disconnect(sender:PySide2.QtCore.QObject, signal:PySide2.QtCore.QMetaMethod, receiver:PySide2.QtCore.QObject, member:PySide2.QtCore.QMetaMethod) -> bool disconnect(sender:PySide2.QtCore.QObject, signal:bytes, receiver:PySide2.QtCore.QObject, member:bytes) -> bool

disconnectNotify(self, signal:PySide2.QtCore.QMetaMethod) → None
dumpObjectInfo(self) → None
dumpObjectTree(self) → None
dynamicPropertyNames(self) → typing.List
emit(self, arg__1:bytes, *args:None) → bool
event(self, arg__1:PySide2.QtCore.QEvent) → bool
eventFilter(self, o:PySide2.QtCore.QObject, e:PySide2.QtCore.QEvent) → bool
filterMode(self) → PySide2.QtCore.Qt.MatchFlags
findChild(self, arg__1:type, arg__2:str='') → object
findChildren(self, arg__1:type, arg__2:PySide2.QtCore.QRegExp) → typing.Iterable

findChildren(self, arg__1:type, arg__2:PySide2.QtCore.QRegularExpression) -> typing.Iterable findChildren(self, arg__1:type, arg__2:str=’’) -> typing.Iterable

get_current_result()

Returns the result from the current item in the completer popup or None if there is no current item.

Returns:The entity dict for the current result
Return type:dict: or None
get_first_result()

Returns the first result from the current item in the completer popup or None if there are no results.

Returns:The entity dict for the first result
Return type:dict: or None
inherits(self, classname:bytes) → bool
installEventFilter(self, filterObj:PySide2.QtCore.QObject) → None
isSignalConnected(self, signal:PySide2.QtCore.QMetaMethod) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
killTimer(self, id:int) → None
maxVisibleItems(self) → int
metaObject(self) → PySide2.QtCore.QMetaObject
model(self) → PySide2.QtCore.QAbstractItemModel
modelSorting(self) → PySide2.QtWidgets.QCompleter.ModelSorting
moveToThread(self, thread:PySide2.QtCore.QThread) → None
objectName(self) → str
parent(self) → PySide2.QtCore.QObject
pathFromIndex(self, index:PySide2.QtCore.QModelIndex) → str
popup(self) → PySide2.QtWidgets.QAbstractItemView
property(self, name:bytes) → typing.Any
receivers(self, signal:bytes) → int
static registerUserData() → int
removeEventFilter(self, obj:PySide2.QtCore.QObject) → None
search(text)

Triggers the popup to display results based on the supplied text.

Parameters:text – current contents of editor
sender(self) → PySide2.QtCore.QObject
senderSignalIndex(self) → int
setCaseSensitivity(self, caseSensitivity:PySide2.QtCore.Qt.CaseSensitivity) → None
setCompletionColumn(self, column:int) → None
setCompletionMode(self, mode:PySide2.QtWidgets.QCompleter.CompletionMode) → None
setCompletionPrefix(self, prefix:str) → None
setCompletionRole(self, role:int) → None
setCurrentRow(self, row:int) → bool
setFilterMode(self, filterMode:PySide2.QtCore.Qt.MatchFlags) → None
setMaxVisibleItems(self, maxItems:int) → None
setModel(self, c:PySide2.QtCore.QAbstractItemModel) → None
setModelSorting(self, sorting:PySide2.QtWidgets.QCompleter.ModelSorting) → None
setObjectName(self, name:str) → None
setParent(self, parent:PySide2.QtCore.QObject) → None
setPopup(self, popup:PySide2.QtWidgets.QAbstractItemView) → None
setProperty(self, name:bytes, value:typing.Any) → bool
setWidget(self, widget:PySide2.QtWidgets.QWidget) → None
setWrapAround(self, wrap:bool) → None
set_bg_task_manager(task_manager)

Specify the background task manager to use to pull data in the background. Data calls to Shotgun will be dispatched via this object.

Parameters:task_manager (BackgroundTaskManager) – Background task manager to use
signalsBlocked(self) → bool
splitPath(self, path:str) → typing.List
startTimer(self, interval:int, timerType:PySide2.QtCore.Qt.TimerType=PySide2.QtCore.Qt.TimerType.CoarseTimer) → int
thread(self) → PySide2.QtCore.QThread
timerEvent(self, event:PySide2.QtCore.QTimerEvent) → None
tr(self, arg__1:bytes, arg__2:bytes=b'', arg__3:int=-1) → str
widget(self) → PySide2.QtWidgets.QWidget
wrapAround(self) → bool

Hierarchical Search Completer

The hierarchical search completer is a QCompleter instance for use with widgets that allow input of ShotGrid entities. The completer can be customized to search in a site’s complete hierarchy or in a single project.

Once a user selects an object, a signal fires to indicate that a node from the hierarchy was selected.

class search_completer.HierarchicalSearchCompleter(parent=None)[source]

A standalone PySide.QtGui.QCompleter class for matching SG entities to typed text.

If defaults to searching inside the current context’s project and to only show entities.

Signal:node_activated(str, int, str, str, list) - Fires when someone activates a node inside the search results. The parameters are type, id, name, label_path and incremental_path. If the node activated is not an entity, type and id will be None.
Modes:MODE_LOADING, MODE_NOT_FOUND, MODE_RESULT - Used to identify the mode of an item in the completion list
Model role:MODE_ROLE - Stores the mode of an item in the completion list (see modes above)
Model role:SG_DATA_ROLE - Role for storing shotgun data in the model
Parameters:parent (QWidget) – Parent widget
search_root

The entity under which the search will be done. If None, the search will be done for the whole site.

The entity is a dict with keys id and type. Note that only Project entities are supported at the moment.

show_entities_only

Indicates if only entities will be shown in the search results.

If set to True, only entities will be shown.

seed_entity_field

The seed entity to use when searching for entity.

Can be PublishedFile.entity or Version.entity.

blockSignals(self, b:bool) → bool
caseSensitivity(self) → PySide2.QtCore.Qt.CaseSensitivity
childEvent(self, event:PySide2.QtCore.QChildEvent) → None
children(self) → typing.List
clear()

Manually clear the contents of the completer’s popup view.

complete(self, rect:PySide2.QtCore.QRect=Default(QRect)) → None
completionColumn(self) → int
completionCount(self) → int
completionMode(self) → PySide2.QtWidgets.QCompleter.CompletionMode
completionModel(self) → PySide2.QtCore.QAbstractItemModel
completionPrefix(self) → str
completionRole(self) → int
static connect(arg__1:PySide2.QtCore.QObject, arg__2:bytes, arg__3:typing.Callable, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) → bool

connect(self, arg__1:bytes, arg__2:typing.Callable, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) -> bool connect(self, arg__1:bytes, arg__2:PySide2.QtCore.QObject, arg__3:bytes, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) -> bool connect(self, sender:PySide2.QtCore.QObject, signal:bytes, member:bytes, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) -> PySide2.QtCore.QMetaObject.Connection connect(sender:PySide2.QtCore.QObject, signal:PySide2.QtCore.QMetaMethod, receiver:PySide2.QtCore.QObject, method:PySide2.QtCore.QMetaMethod, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) -> PySide2.QtCore.QMetaObject.Connection connect(sender:PySide2.QtCore.QObject, signal:bytes, receiver:PySide2.QtCore.QObject, member:bytes, type:PySide2.QtCore.Qt.ConnectionType=PySide2.QtCore.Qt.ConnectionType.AutoConnection) -> PySide2.QtCore.QMetaObject.Connection

connectNotify(self, signal:PySide2.QtCore.QMetaMethod) → None
currentCompletion(self) → str
currentIndex(self) → PySide2.QtCore.QModelIndex
currentRow(self) → int
customEvent(self, event:PySide2.QtCore.QEvent) → None
deleteLater(self) → None
destroy()

Should be called before the widget is closed

static disconnect(arg__1:PySide2.QtCore.QMetaObject.Connection) → bool

disconnect(arg__1:PySide2.QtCore.QObject, arg__2:bytes, arg__3:typing.Callable) -> bool disconnect(self, arg__1:bytes, arg__2:typing.Callable) -> bool disconnect(self, receiver:PySide2.QtCore.QObject, member:typing.Union[bytes, NoneType]=None) -> bool disconnect(self, signal:bytes, receiver:PySide2.QtCore.QObject, member:bytes) -> bool disconnect(sender:PySide2.QtCore.QObject, signal:PySide2.QtCore.QMetaMethod, receiver:PySide2.QtCore.QObject, member:PySide2.QtCore.QMetaMethod) -> bool disconnect(sender:PySide2.QtCore.QObject, signal:bytes, receiver:PySide2.QtCore.QObject, member:bytes) -> bool

disconnectNotify(self, signal:PySide2.QtCore.QMetaMethod) → None
dumpObjectInfo(self) → None
dumpObjectTree(self) → None
dynamicPropertyNames(self) → typing.List
emit(self, arg__1:bytes, *args:None) → bool
event(self, arg__1:PySide2.QtCore.QEvent) → bool
eventFilter(self, o:PySide2.QtCore.QObject, e:PySide2.QtCore.QEvent) → bool
filterMode(self) → PySide2.QtCore.Qt.MatchFlags
findChild(self, arg__1:type, arg__2:str='') → object
findChildren(self, arg__1:type, arg__2:PySide2.QtCore.QRegExp) → typing.Iterable

findChildren(self, arg__1:type, arg__2:PySide2.QtCore.QRegularExpression) -> typing.Iterable findChildren(self, arg__1:type, arg__2:str=’’) -> typing.Iterable

get_current_result()

Returns the result from the current item in the completer popup or None if there is no current item.

Returns:The entity dict for the current result
Return type:dict: or None
get_first_result()

Returns the first result from the current item in the completer popup or None if there are no results.

Returns:The entity dict for the first result
Return type:dict: or None
inherits(self, classname:bytes) → bool
installEventFilter(self, filterObj:PySide2.QtCore.QObject) → None
isSignalConnected(self, signal:PySide2.QtCore.QMetaMethod) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
killTimer(self, id:int) → None
maxVisibleItems(self) → int
metaObject(self) → PySide2.QtCore.QMetaObject
model(self) → PySide2.QtCore.QAbstractItemModel
modelSorting(self) → PySide2.QtWidgets.QCompleter.ModelSorting
moveToThread(self, thread:PySide2.QtCore.QThread) → None
objectName(self) → str
parent(self) → PySide2.QtCore.QObject
pathFromIndex(self, index:PySide2.QtCore.QModelIndex) → str
popup(self) → PySide2.QtWidgets.QAbstractItemView
property(self, name:bytes) → typing.Any
receivers(self, signal:bytes) → int
static registerUserData() → int
removeEventFilter(self, obj:PySide2.QtCore.QObject) → None
search(text)

Triggers the popup to display results based on the supplied text.

Parameters:text – current contents of editor
sender(self) → PySide2.QtCore.QObject
senderSignalIndex(self) → int
setCaseSensitivity(self, caseSensitivity:PySide2.QtCore.Qt.CaseSensitivity) → None
setCompletionColumn(self, column:int) → None
setCompletionMode(self, mode:PySide2.QtWidgets.QCompleter.CompletionMode) → None
setCompletionPrefix(self, prefix:str) → None
setCompletionRole(self, role:int) → None
setCurrentRow(self, row:int) → bool
setFilterMode(self, filterMode:PySide2.QtCore.Qt.MatchFlags) → None
setMaxVisibleItems(self, maxItems:int) → None
setModel(self, c:PySide2.QtCore.QAbstractItemModel) → None
setModelSorting(self, sorting:PySide2.QtWidgets.QCompleter.ModelSorting) → None
setObjectName(self, name:str) → None
setParent(self, parent:PySide2.QtCore.QObject) → None
setPopup(self, popup:PySide2.QtWidgets.QAbstractItemView) → None
setProperty(self, name:bytes, value:typing.Any) → bool
setWidget(self, widget:PySide2.QtWidgets.QWidget) → None
setWrapAround(self, wrap:bool) → None
set_bg_task_manager(task_manager)

Specify the background task manager to use to pull data in the background. Data calls to Shotgun will be dispatched via this object.

Parameters:task_manager (BackgroundTaskManager) – Background task manager to use
signalsBlocked(self) → bool
splitPath(self, path:str) → typing.List
startTimer(self, interval:int, timerType:PySide2.QtCore.Qt.TimerType=PySide2.QtCore.Qt.TimerType.CoarseTimer) → int
thread(self) → PySide2.QtCore.QThread
timerEvent(self, event:PySide2.QtCore.QTimerEvent) → None
tr(self, arg__1:bytes, arg__2:bytes=b'', arg__3:int=-1) → str
widget(self) → PySide2.QtWidgets.QWidget
wrapAround(self) → bool
get_result(model_index)[source]

Returns an item from the result list.

Here’s an example:

{
    "label": "bunny_020",
    "incremental_path": [
        "/Project/65",
        "/Project/65/Shot",
        "/Project/65/Shot/sg_sequence/Sequence/5"
    ],
    "path_label": "Shots",
    "ref": {
        "id": 5,
        "type": "Sequence"
    },
    "project_id": 65
}
Parameters:model_index (QModelIndex) – The index of the model to return the result for.
Returns:The dict for the supplied model index.
Return type:dict or None