Combobox

class ExtendedComboBox(*args: Any, **kwargs: Any)

Bases: QComboBox

Extended combobox to also have a filter

itemSelected

alias of str

checkStateChanged

alias of int

addItem(text, isCheckable=False)
keyPressEvent(event)
onCompleterActivated(text)

On selection of an item from the completer, this method will select the item from the combobox

setModel(model)

Overridden to set the filter and completer models

setModelColumn(column)
handleItemPressed(index)
stateList()
checkedItems()
class ComboItemChangedEvent(prevIndex, currIndex, parent)

Bases: object

property text
property prevText
property data
property prevData
class ComboBox(*args: Any, **kwargs: Any)

Bases: QWidget

itemChanged

alias of object

prevIndex = None
clear()

Clear all items. Method used for autocomplete

addItem(item, sortAlphabetically=False, userData=None)

Adds an item to the combobox with the given text , and containing the specified userData (stored in the UserRole ). The item is appended to the list of existing items.

Parameters:
  • item (str) – the name to add to the combo box

  • sortAlphabetically (bool) – sorts the full combo box alphabetically after adding

  • userData (object) – The userData to set if any.

currentData(role=MockExt.QtCore.Qt.UserRole)
property activated
property currentIndexChanged
setItemText(index, text)
currentIndex()

Returns the int value of the combo box. Method used for autocomplete

Return currentIndex:

the int value of the combo box

Rtype currentIndex:

int

value()

Returns the literal value of the combo box

Return value:

the literal value of the combo box

Rtype value:

str

currentText()

Method used for autocomplete

count()

Method used for autocomplete

addItems(items, sortAlphabetically=False)

Add items to combobox

Parameters:
  • items

  • sortAlphabetically

Returns:

itemData(index, role=MockExt.QtCore.Qt.UserRole)

Method used for autocomplete

iterItemData()
onItemChanged()

when the items changed return the tuple of values

setToText(text, flags=MockExt.QtCore.Qt.MatchFixedString)

Sets the index based on the text

Parameters:

text (str) – Text to search and switch the comboxBox to

removeItemByText(text, flags=MockExt.QtCore.Qt.MatchFixedString)

removes the index based on the text from the combo box (box.removeItem)

Parameters:

text (str) – Text to search and delete it’s entire entry from the combo box (removeItem)

setToTextQuiet(text)

Sets the index based on the text and stops comboBox from emitting signals while being changed

Parameters:

text (str) – Text to search and switch the comboxBox to

setIndex(index, quiet=False)

Sets the combo box to the current index number

Parameters:

index (int) – Sets the combo box to the current index

setIndexQuiet(index)

Sets the combo box to the current index number, stops comboBox from emitting signals while being changed

Parameters:

index (int) – the index item number of the comboBox

setLabelFixedWidth(width)

Set the fixed width of the label

Parameters:

width (int) – the width in pixels, DPI is handled

setBoxFixedWidth(width)

Set the fixed width of the lineEdit

Parameters:

width (int) – the width in pixels, DPI is handled

setItemData(index, value)

Sets the data role for the item on the given index in the combobox to the specified value. Good for metadata assigned to the name

Parameters:
  • index (int) – the index to assign the value

  • value (object) – the value to assign, can be any object or string etc

itemText(index)

Get current text from combobox

Parameters:

index

Returns:

itemTexts()

Get all the items in the combobox

Returns:

Return type:

blockSignals(blocked=False)

Manually block the combobox and label

class ComboBoxRegular(*args: Any, **kwargs: Any)

Bases: ComboBox

Creates a regular “not searchable” combo box (drop down menu) with a label

TODO: this class should be combined with ComboBox, no need to have them apart?

classmethod setupComboBox(parent=None, items=(), itemData=(), toolTip='', setIndex=0, sortAlphabetically=False, supportMiddleMouseScroll=True)

Simple qComboBox with no label

Parameters:
  • items (list) – the item list of the combobox

  • parent (object) – the qt parent

  • toolTip (str) – the tooltip info to display with mouse hover

  • setIndex (int) – set the combo box value as an int - 0 is the first value, 1 is the second

Returns:

the QComboBox Qt widget

Type:

QtWidgets.QComboBox

class HumbleComboBox(*args: Any, **kwargs: Any)

Bases: QComboBox

QComboBox which ignores the wheelEvent

wheelEvent(event)
class ComboBoxSearchable(*args: Any, **kwargs: Any)

Bases: ComboBox

Combo Edit Widget

class ComboMainWidget(*args: Any, **kwargs: Any)

Bases: QFrame

Main combo widget that holds the labels and drop down menu button

doubleClicked

alias of object

clicked

alias of object

mouseDoubleClickEvent(event)
mousePressEvent(event)

Mouse Press event

Parameters:

event

Returns:

Return type:

class ComboEdit(*args: Any, **kwargs: Any)

Bases: StringEdit

clicked

alias of object

mousePressEvent(event)

Mouse Press event

Parameters:

event

Returns:

Return type:

class ComboEditFloat(*args: Any, **kwargs: Any)

Bases: FloatEdit

clicked

alias of object

mousePressEvent(event)

Mouse Press event

Parameters:

event

Returns:

Return type:

class ComboEditInt(*args: Any, **kwargs: Any)

Bases: IntEdit

clicked

alias of object

mousePressEvent(event)

Mouse Press event

Parameters:

event

Returns:

Return type:

class ComboEditWidget(*args: Any, **kwargs: Any)

Bases: QWidget

Create our own combobox

itemChanged

alias of object

itemRenamed

alias of object

editingFinished

alias of object

editModified

alias of object

comboEditChanged

alias of object

itemClickedOrReturned

alias of object

Default = 0
EditWidget = 1
SearchWidget = 2
SeparatorString = '---=---'
property comboEdit

Shorthand for self.comboEdits[0]

Return type:

stringedit.StringEdit

initUi(labelStretch, mainStretch)

Init ui

Parameters:
  • labelStretch

  • mainStretch

Returns:

Return type:

connections()

Set up connections

Returns:

Return type:

aspectLinked(button=None)

Returns True if aspect is linked, false otherwise

Returns:

Return type:

toggleAspectLinkBtn(updateAspect=False)

Toggle Aspect Link button

Returns:

Return type:

setAspectLinked(newLinked, button=None, updateAspect=False)

Set aspect linked to True or False

Parameters:
  • button

  • newLinked

  • updateAspect

Returns:

Return type:

updateAspect(sender=None)

Update aspect ratio of scene

Returns:

Return type:

addItems(items, data=None)

Add items to widget

Parameters:
  • items (list[basestring]) – List of items as string to add

  • data (list[object]) – List of objects

Returns:

Return type:

setText(text, index=0, setItem=False)

Set text of the combo edit

Parameters:
  • setItem (If the text matches the item text then set the item as well)

  • text

Returns:

Return type:

setValue(value, index=0)
setValues(values, setItem=True)

Set the values. Float or int

Parameters:
  • values

  • setItem

Returns:

Return type:

setTexts(texts, setItem=False)

Set text of the combo edit

Parameters:
  • setItem (If the text matches the item text then set the item as well)

  • texts (list(str))

Returns:

Return type:

findMatchingIndex(texts)

Find matching index based on the list of texts

Parameters:

texts (list)

Returns:

the index of the first found match. -1 if not found

Return type:

int

addSeparator()

Add Separator

Returns:

Return type:

model()

Get the model

Returns:

Return type:

items()

Get All items

Returns:

Return type:

addItem(text, data=None)

Add item to menu

Parameters:
  • text

  • data

Returns:

Return type:

setLabelMenu(menu, mouseButton=MockExt.QtCore.Qt.LeftButton)

Set the name label menu

Parameters:
  • menu

  • mouseButton

Returns:

Return type:

currentItem()

Current Item

Returns:

Return type:

Qt.QtGui.QStandardItem

comboEditReturnPressed()

When the return key is pressed for the combo edit

Returns:

Return type:

editFinished()

Edit finished

Returns:

Return type:

itemRenamedEvent(event)

On Item renamed event

Parameters:

event (EditChangedEvent)

wheelEvent(event)

Mouse Wheel event

Parameters:

event

Returns:

Return type:

currentMouseOver()

Gets the widget currently moused over

Returns:

Return type:

QtWidgets.QWidget

scrollPrev()

Scrolls to previous index

Returns:

Return type:

scrollNext()

Scrolls to next index

Returns:

Return type:

scrollIndex(next=True)

Scroll index

Parameters:

next

Returns:

Return type:

blockSignals(b)

Block signals.

Make sure it blocks the signals of the child widgets as well

Parameters:

b

Returns:

Return type:

indexChanged(event)

Item clicked

Parameters:

event (zoo.libs.pyqt.extended.combobox.combomenupopup.ComboCustomEvent)

Returns:

Return type:

itemText(index)

Get item text from an index

Parameters:

index (QtGui.QModelIndex)

Returns:

Return type:

activatePopup()

Activate the popup and place it below the widget

Returns:

Return type:

activateWidget(widgetType, sender=None)

Activate the widget based on the type used

Parameters:
  • widgetType

  • sender (QtWidgets.QWidget or elements.ComboEdit)

Returns:

Return type:

activateMainWidget(event)

Activate Rename Widget

Parameters:

event

Returns:

Return type:

setCurrentIndex(index)

Set the index by int, instead of a QModelIndex

Parameters:

index (int)

Returns:

Return type:

setIndexInt(index)

Set the index by int, instead of a QModelIndex

Parameters:

index (int)

Returns:

Return type:

label()

Returns the label

Returns:

Return type:

setLabel(text)

Returns the label

Returns:

Return type:

currentIndex()

Get the current index as int

Returns:

Return type:

currentIndexInt()

Get the current index as int

Returns:

Return type:

currentData()

Gets the current data

Returns:

Return type:

itemData(index)

Get the item data

Parameters:

index (int)

Returns:

Return type:

Qt.QtGui.QStandardItem

iterItemData()

Iterate through the item data

Returns:

Return type:

collections.Iterable[Qt.QtGui.QStandardItem]

currentText(index=0)

The text of the combo menu

Returns:

Return type:

text(index=0)

Returns value of the text boxes as a list as float or int or string depending on the edit mode

Parameters:

index (int) – Current index of the possible text edits

Return value:

Returns value of the text edit, can be float or int or string depending on the edit mode

Rtype value:

float or int or string

texts()

Returns all values of the text boxes as a list

Same as self.values()

Return valueList:

Returns values of the text edits, can be float or int or string depending on the edit mode

Rtype valueList:

list(float or int or string)

values()

Return the values of the combo edits

Returns:

Return type:

count()

Number of items

Returns:

Return type:

clear()

Clear out the items

Returns:

Return type:

updateList(nameList, dataList=None, setName=None)

Updates the lists and optionally sets the index by the given name.

The name list can contain separators in the format:

self.SeparatorString = “—=—”

Parameters:
  • nameList (list(str)) – A list of names to populate the comboEdit, can be

  • dataList (list) – Optional list of any data type to insert along with the names

  • setName (str) – The name to set as the current index

state(newValue=None)

Get the state of the widget

Returns:

Return type:

setState(state)

Set the state of the widget

Parameters:

state (dict)

Returns:

Return type:

class ComboEditRename(*args: Any, **kwargs: Any)

Bases: ComboEditWidget

Same as Combo Menu Rename Functionality for toolsets

class EditChangedEvent(before, after)

Bases: object

class IndexChangedEvent(items, index, menuButton)

Bases: object

Primary = 'Primary'
Secondary = 'Secondary'
items = None
index = None

Combo Menu Popup

class ComboStandardItem(*args: Any, **kwargs: Any)

Bases: QStandardItem

setData(value, role=0)

Use our own set data as using Qt’s ones crashes Maya 2019

Parameters:
  • value

  • role

Returns:

Return type:

itemData()

Use this one as .data() crashes maya on 2019

Returns:

Return type:

class ComboCustomEvent(index, row, items, sourceMenu)

Bases: object

index = None
row = None
items = None
source = None
class ComboDelegate(*args: Any, **kwargs: Any)

Bases: QStyledItemDelegate

Combo Delegate so we can draw out the separator

paint(painter, option, index)

Paint out normal text or a separator

Parameters:
  • painter (QtGui.QPainter)

  • option (QtWidgets.QStyleOptionViewItem)

  • index (QtCore.QModelIndex)

Returns:

Return type:

sizeHint(option, index)
class ComboCustomListView(*args: Any, **kwargs: Any)

Bases: QListView

filter(text)

Hide anything that doesn’t have text. Used for searches.

Parameters:

text (basestring)

clearFilter()

Clear the search filter

Returns:

Return type:

firstVisibleIndex()

Get the first visible index

Returns:

Return type:

nextIndex(mustBeVisible=True)

Get the next index from the current index

Parameters:

mustBeVisible – Only returns if the next index is visible

Returns:

Return type:

prevIndex(mustBeVisible=True)

Get the previous index relative from the current index

Parameters:

mustBeVisible – Only returns if the next index is visible

Returns:

Return type:

parentWidget()

Parent Widget

Returns:

Return type:

ComboMenuPopup

addItem(text, data=None)

Add standard item with text and data

Parameters:
  • text

  • data

Returns:

ComboStandardItem

Return type:

data(item)
Parameters:

item (ComboStandardItem)

Returns:

Return type:

addSeparator()

Add a separator to the list view

Returns:

Return type:

visibleRowCount()

Number of rows that are visible

Returns:

Return type:

int

class ComboMenuPopup(*args: Any, **kwargs: Any)

Bases: Dialog

itemClicked

alias of ComboCustomEvent

indexChanged

alias of ComboCustomEvent

returnedPressed

alias of ComboCustomEvent

comboRounding = -1
initUi()

Initialize Ui

Returns:

Return type:

connections()

Get the connections

Returns:

Return type:

searchEditChanged(text)

The search edit value changed

Parameters:

text

Returns:

Return type:

keyPressEvent(event)

For key up and key down events

Parameters:

event

Returns:

Return type:

scrollPrev()

Scroll to previous index item

Returns:

Return type:

scrollNext()

Scroll to next index item

Returns:

Return type:

itemFromRow(row)

Get item from row

Parameters:

row

Returns:

Return type:

currentIndex()

Get current index

Returns:

Return type:

QtCore.QModelIndex

searchReturnedPressed()
Returns:

Return type:

currentItem()

Get the current item

Returns:

Return type:

ComboStandardItem

addItem(text, data=None)

Add item

Parameters:
  • text

  • data

Returns:

Return type:

addSeparator()

Add a separator

Returns:

Return type:

model()

Return the model

Returns:

Return type:

QtGui.QStandardItemModel

listViewItemClicked(index)

For when the list view item is clicked

Parameters:

index (QtCore.QModelIndex)

Returns:

Return type:

eventFromIndex(index)

Get a ComboCustomEvent from index

Parameters:

index (QtCore.QModelIndex)

Returns:

Return type:

ComboCustomEvent

rowItems(index)

Gets all the items in the row (From the columns)

Parameters:

index (QtCore.QModelIndex)

Returns:

Return type:

list[ComboStandardItem]

setCurrentIndex(index)

Set the current index of the combo menu

Parameters:

index (QtCore.QModelIndex)

Returns:

Return type:

sizeHint()

Change the size hint to resize based on the buttons in the icon popup

Returns:

initSearchEdit()

Search edit to filter out the button

Returns:

updateSearch(searchString)

Filter buttons by search string

Parameters:

searchString

Returns:

show(sender)

Clear out and set up on popup show

Returns:

Return type:

resizeUpdate()

Resize the popup based on the distance to bottom of monitor

Returns:

Return type: