Widgets

Action

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

Bases: QWidgetAction

OptionBox style QAction, mirrors as close as possible to autodesk maya’s QAction

setOptionBoxIcon(iconPath)
setIcon(iconPath)
createWidget(parent)
class ColorAction(*args: Any, **kwargs: Any)

Bases: QWidgetAction

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

Bases: QWidgetAction

createWidget(menu)

This method is called by the QWidgetAction base class.

Breadcrumb

Breadcrumb Widget

from zoo.libs.pyqt.widgets.breadcrumb import Breadcrumb
parentWidget = QtWidgets.QWidget()
parentLayout = elements.hBoxLayout(parent=parentWidget)
bread = Breadcrumb(parent=parentWidget)
parentLayout.addWidget(bread)
bread.setWidgetList([
    {"text": "home", "icon": "redshift"},
    {"text": "bob", "icon": "renderman"},
    {"text": "bob2", "icon": "transfer"}
])

parentWidget.show()
class Breadcrumb(*args: Any, **kwargs: Any)

Bases: QWidget

Breadcrumb creates an interactive path like widget where each item is a button

setWidgetList(widgetList)

Set the breadcrumb items.

addWidget(widgetData, index=None)

Add an item the path.

Parameters:
  • widgetData (list[dict]) – A list of dict with the same arguments elements.styledButton(), “leftClickCallback” will connect the left-click signal to the specified function.

  • index (int) – The position in the layout to add the widget

Buttonlist

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

Bases: QWidget

A nice vertical button list with an optional header and with a searchable feature.

initUi()
connections()

Test connection

onSearchChanged()
class ButtonListTable(*args: Any, **kwargs: Any)

Bases: QTableWidget

initUi()
filter(text)

Filter table based on text. Hides the row if doesn’t match the text :param text: Text to match

Buttons

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

Bases: QWidget

connections()
buttonRound(**kwargs)

Create a rounded button usually just an icon only button with icon in a round circle

This function is usually called via buttonStyled() Uses stylesheet colors, and icon color via the stylesheet from buttonStyled()

Note

WIP, Will fill out more options with time

:keyword parent (QtWidgets.QWidget): The parent widget. :keyword text (str): The button text. :keyword icon (str): the icon name from the zoo tools iconlib. :keyword toolTip (str): The button tooltip :keyword iconSize (int): the icon size before dpi scaling. :keyword iconColor (tuple[int, int, int, int]): The icon color which will fill the masked area of the icon. :keyword btnWidth (int): The fixed width for the button. :keyword btnHeight (int): The fixed height for the button. :return: returns a qt button widget :rtype: RoundButton

styledButton(text=None, icon=None, parent=None, toolTip='', textCaps=False, iconColor=None, iconHoverColor=None, minWidth=None, maxWidth=None, iconSize=16, overlayIconName=None, overlayIconColor=None, minHeight=None, maxHeight=None, style=0, btnWidth=None, btnHeight=None, iconColorTheme=None, themeUpdates=True)

Create a button with text or an icon in various styles and options.:

Style - 0 - uic.BTN_DEFAULT - Default zoo extended button with optional text or an icon.
Style - 1 - uic.BTN_TRANSPARENT_BG - Default zoo extended button w transparent bg.
Style - 2 - uic.BTN_ICON_SHADOW - Main zoo IconPushButton button (icon in a colored box) with shadow underline
Style - 3 - uic.BTN_DEFAULT_QT - Default style uses vanilla QPushButton and not zoo's extended button
Style - 4 - uic.BTN_ROUNDED - # Rounded button stylesheeted bg color and stylesheeted icon color
Style - 5 - uic.BTN_LABEL_SML - A regular Qt label with a small button beside
Parameters:
  • text – The button text

  • icon (str) – The icon image name, icon is automatically sized.

  • parent (object) – The parent widget.

  • toolTip (str) – The tooltip as seen with mouse over extra information.

  • style (int) – The style of the button, 0 default, 1 no bg. See pyside.uiconstants BTN_DEFAULT, BTN_TRANSPARENT_BG.

  • textCaps (bool) – Bool to make the button text all caps.

  • iconColor (tuple) – The color of the icon in 255 color eg (255, 134, 23)

  • minWidth (int) – minimum width of the button in pixels, DPI handled.

  • maxWidth (int) – maximum width of the button in pixels, DPI handled.

  • iconSize (int) – The size of the icon in pixels, always square, DPI handled.

  • overlayIconName – The name of the icon image that will be overlayed on top of the original icon.

  • overlayIconName – tuple

  • overlayIconColor (tuple) – The color of the overlay image icon (255, 134, 23) :note: Not implemented yet.

  • minHeight (int) – minimum height of the button in pixels, DPI handled. Overrides min and max settings

  • maxHeight (int) – maximum height of the button in pixels, DPI handled.

  • btnWidth (int) – the fixed width of the button is there is one, DPI handled. Overrides min and max settings

  • btnHeight (int) – the fixed height of the button is there is one, DPI handled.

Returns:

returns a qt button widget.

Return type:

ShadowedButton or QtWidgets.QPushButton or roundbutton.RoundButton or LabelSmlButton

buttonExtended(**kwargs)

Create an extended either transparent bg or regular style. Features all the extended button functionality

Default Icon colour (None) is light grey and turns white (lighter in color) with mouse over. :Note: WIP, Will fill out more options with time

Parameters:
  • (QtWidgets.QWidget) (parent) – The parent widget.

  • (str) (overlayIconName) – The button text.

  • (str) – the icon name from the zoo tools iconlib.

  • (str) – The button tooltip

  • (int) (style) – the icon size before dpi scaling.

  • int]) (overlayIconColor (tuple[int, int, int,) – The icon color which will fill the masked area of the icon.

  • (str) – the icon to overlay on top of the icon.

  • int]) – The icon color which will fill the masked area of the overlay icon.

  • (int) – The minimum button width.

  • (int) – The minimum button height.

  • (int) – The maximum button width.

  • (int) – The maximum button height.

  • (int) – The style constant ie. uiconstants.BTN_DEFAULT

  • (bool) (themeUpdates) – Whether the button will react with a theme change from the preferences.

Return qtBtn:

returns a qt button widget

Rtype qtBtn:

object

regularButton(**kwargs)

Creates regular pyside button with text or an icon.

Note:

Will fill out more options with time.

Note:

Should probably override ExtendedButton and not QtWidgets.QPushButton for full options.

Parameters:
  • (QtWidgets.QWidget) (parent) – The parent widget.

  • (str) (overlayIconName) – The button text.

  • (str) – the icon name from the zoo tools iconlib.

  • (str) – The button tooltip

  • (int) (maxHeight) – the icon size before dpi scaling.

  • int]) (overlayIconColor (tuple[int, int, int,) – The icon color which will fill the masked area of the icon.

  • (str) – the icon to overlay on top of the icon.

  • int]) – The icon color which will fill the masked area of the overlay icon.

  • (int) – The minimum button width.

  • (int) – The minimum button height.

  • (int) – The maximum button width.

  • (int) – The maximum button height.

Returns:

returns a QPushButton button widget.

Return type:

class:QtWidgets.QPushButton

iconShadowButton(**kwargs)

Create a button (ShadowedButton) with the icon in a coloured box and a button shadow at the bottom of the button.

This function is usually called via buttonStyled() Uses stylesheet colors, and icon color via the stylesheet from buttonStyled()

Note:

WIP, Will fill out more options with time

:keyword parent (QtWidgets.QWidget): The parent widget. :keyword text (str): The button text. :keyword icon (str): the icon name from the zoo tools iconlib. :keyword toolTip (str): The button tooltip :keyword iconSize (int): the icon size before dpi scaling. :keyword iconColor (tuple[int, int, int, int]): The icon color which will fill the masked area of the icon. :keyword overlayIconName (str): the icon to overlay on top of the icon. :keyword overlayIconColor (tuple[int, int, int, int]): The icon color which will fill the masked area of the overlay icon. :keyword minWidth (int): The minimum button width. :keyword maxWidth (int): The minimum button height. :keyword minHeight (int): The maximum button width. :keyword maxHeight (int): The maximum button height.

Returns:

returns a ShadowedButton widget instance

Return type:

ShadowedButton

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

Bases: QWidget

setDisabled(state)

Disable the text (make it grey)

connections()
class AlignedButton(*args: Any, **kwargs: Any)

Bases: ExtendedButton, DPIScaling

updateTheme(event)

Update the theme

Returns:

Return type:

setIcon(icon)
Parameters:

icon (zoovendor.Qt.QtGui.QIcon) –

Returns:

setText(text)
setIconSize(size)

Set the icon size

Parameters:

size

Returns:

mouseDoubleClickEvent(event)

Detects Double click event.

Parameters:

event

Returns:

setFixedHeight(height)

Set Fixed Height

Parameters:

height (int) – Height in pixels of the button

Returns:

setFixedSize(size)

Set the fixed size

Parameters:

size (QtCore.QSize) – New fixed size of the widget

Returns:

updateImageWidget(newHeight)

Make sure the image widget is always square

Parameters:

newHeight (int) – The new height of the widget to update to

Returns:

setIconByName(iconNames, colors, size=None, hoverColor=None, pressedColor=None, iconScaling=None)

Set Icon Size by name

todo: needs additional features similar to the ButtonIcons.setIconByName() method

Parameters:
  • size (int) – Size of the icon in pixels

  • iconNames (list or basestring) – Names of the icons

  • colors (list of tuple or tuple) – Colors of the icons

Returns:

enterEvent(event)

Button Hover on mouse enter

Parameters:

event

Returns:

leaveEvent(event)

Button Hover on mouse leave

Parameters:

event

Returns:

mousePressEvent(event)

Mouse set down button visuals

Parameters:

event

Returns:

mouseReleaseEvent(event)

Mouse release event plays the menus

Parameters:

event

Returns:

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

Bases: QLabel, DPIScaling

CSS Purposes

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

Bases: QPushButton

Simple button that is left aligned with text and icon.

menu(button=MockExt.QtCore.Qt.LeftButton)

Returns the menu for the given button.

Parameters:

button (QtCore.Qt.MouseButton) – The button to get the menu for.

Returns:

The menu for the given button.

Return type:

QtWidgets.QMenu

setMenu(menu, mouseButton)
createMenuItem(text='', icon=None, connection=None, mouseClick=MockExt.QtCore.Qt.RightButton)

Helper function to easily create a menu item, automatically creates the menu if it doesn’t exist.

Parameters:
  • text (str) – The menu item text label

  • icon (QtGui.QIcon) – The menu item icon.

  • connection (function) – The menu item connection

  • mouseClick (QtCore.Qt.RightButton or QtCore.Qt.LeftButton or QtCore.Qt.MiddleButton) – The mouse button to create the menu item for

Returns:

The menu item as an action object

Return type:

QtWidgets.QMenu.action

leftAlignedButton(text, icon=None, toolTip='', parent=None, transparentBg=False, padding=(), alignment='left', showLeftClickMenuIndicator=False)

Creates a left aligned button, passes in the icon name and text, and sets the stylesheet.

Can take two icons as strings, resource buttons ie Software Default Icons are specified with a colon in the name.

icon = “:polyRemesh”

Zoo icons are specified without a colon in the name.

icon = “save”

Parameters:
  • text (str) – The button label text

  • icon (QtGui.QIcon) – The icon name, “:iconName” is resource icon, “save” is from Zoo icon library

  • toolTip (str) – The tooltip text

  • parent (object) – The parent widget

  • transparentBg (bool) – True if the background is transparent

  • padding (tuple(int, int, int, int)) – The padding of the button (left, top, right, bottom), empty tuple if no override

  • alignment (str) – the alignment of the icon and text, default is “left”, can use “right” or “center”

  • showLeftClickMenuIndicator (bool) – If True allow the left-click menu indicator to show, default is False

Returns:

The button as a Qt widget

Return type:

LeftAlignedButtonBase

Dialog

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

Bases: QDialog

updateTheme(event)

Update the theme

Returns:

Return type:

center()
fillToParent(margins=(0, 0, 0, 0))

Fill size to parent

Returns:

Return type:

toggleMaximized()

Toggles the maximized window state

Dialogs

getDirectoriesDialog(startingDir)

Create a file dialog with zoo themes and multifile selection

Returns a list of paths

Parameters:

startingDir

Returns:

eg [“c:/path/to/folder1”, “c:/path/to/second/folder”]

Dockwidget

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

Bases: QDockWidget

Dpiscaling

class DPIScaling

Bases: object

Used with any QtWidget to add dpiScaling to their methods

setFixedSize(size)

Sets fixed size

Parameters:

size – Dpiscaling is automatically applied here

Returns:

setFixedHeight(height)

DpiScaling version of set fixed height

Parameters:

height

Returns:

setFixedWidth(width)

DpiScaling version of set fixed width

Parameters:

width

Returns:

setMaximumWidth(width)

Sets the maximum button size in pixels

Parameters:

size (QtCore.QSize) – New fixed size of the widget

setMinimumWidth(width)

Sets the minimum button size in pixels

Parameters:

size (QtCore.QSize) – New fixed size of the widget

setMaximumHeight(height)

Sets the maximum button size in pixels

Parameters:

size (QtCore.QSize) – New fixed size of the widget

setMinimumHeight(height)

Sets the minimum button size in pixels

Parameters:

size (QtCore.QSize) – New fixed size of the widget

Elements

Expandedtooltip

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

Bases: Dialog

Expanded tooltips for when we press control (or the key as defined by popupKey). Features richtext labels and animated gifs in a transparent window. ::examples:

To install the tooltip on a PyQt widget:

btn = QtWidgets.QPushButton()
toolTip = componentWidgetExpand =             {
        "title": "Expand / Collapse Widget",
        "icon": "magic",
        "tooltip": "Expand / Collapse Widget",
        "expanded": "Expand / Collapse Widget <p><b><i>Everything here can be customized using HTML tags.</i></b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis et cursus libero. </p><p>Etiam viverra quam sit amet eros volutpat, ac <span class="highlight"><i>aliquam ligula fringilla</i></span>. In semper volutpat nunc, ac placerat nisi mollis a. Donec condimentum urna eu elementum hendrerit. Sed pellentesque.</p><p> <a href="http://create3dcharacters.com">Click for full documentation</a>"
    }
installTooltips(btn, tooltipDict=toolTip)

The “expanded” attribute allows for rich text:

{"expanded":
    ''' Expand / Collapse Widget
        <p><b><i>Everything here can be customized using HTML tags.</i></b></p>
        <p><span class="highlight">Highlighted text with custom highlight color </span>
        <p>Gifs can be used as well. <zoo gif="selectAllAnimCurvesInTheScene" /></p>
        <p> <a href="http://create3dcharacters.com">Click for full documentation</a>"'''}

Gifs folders are set up in the package.json: “HIVE_UI_GIFS”: “{self}/zoo/apps/hiveartistui/gifs”

ExpandedTooltipPopup is just a dialogue box, so instantiate it then move it like a normal window:

# On holding down control the popup (this class) will be displayed. ON Key release it will be closed
def keyPressEvent(self, event):
    if event.key() == QtCore.Qt.Key_Control:
        pos = QtGui.QCursor.pos()
        widgetAt = QtWidgets.QApplication.widgetAt(pos)
        if expandedtooltip.hasExpandedTooltips(widgetAt):
            self._popuptooltip = expandedtooltip.ExpandedTooltipPopup(widgetAt, keyRelease=QtCore.Qt.Key_Control)
            self._popuptooltip.move(QtGui.QCursor.pos())
    self.ctrlEvent = True
def keyReleaseEvent(self, event):
    if event.key() == QtCore.Qt.Key_Control:
        self.ctrlEvent = False

Example Stylesheet:

style = '''
   ExpandedTooltipPopup .QFrame {{
       border-width: 1px;
       border-style: solid;
       border-radius: 3px;
       border-color: rgba(255,255,255,0.5);
       background-color: rgba(20,20,20,0.8);
   }}
   ExpandedTooltipPopup QLabel {{
       border-width: 0px; background: transparent;
       font-size: 11pt;
   }}
   ExpandedTooltipPopup QLabel#title {{
       padding: 5px 0px 0px 0px;
       font-size: 14pt;
   }}
   ExpandedTooltipPopup GifWidget {{
       border-width: 0px; background: transparent;
   }}
'''
defaultIcon = 'magic'
ETT_ICONCOLOUR = (82, 133, 166)
ETT_LINKCOLOUR = (255, 255, 255)
ETT_THEMECOLOUR = (82, 133, 166)
initUi()
center()

Override the center from parent class and ignore everything.

setText(text, applyStyle=True)

Sets the text for the ExpandedTooltip. It will parse through the text and split it up into Labels and GifWidgets and add it to the layout if need be.

Parameters:
  • text

  • applyStyle

Returns:

applyStyle(text)

Apply our own custom style to the text. A bit hacky but it replaces the text to what we want. Until we figure a way to apply custom classes to the rich text inside labels

class=”link” ====> style=”color:rgb()” class=”highlight” ====> style=”color: rgb{}; font-weight: bold” etc..

Parameters:

text (str) –

Returns:

Return type:

str

addWidgets(wlist)

Adds the list of widgets into our layout

Parameters:

wlist (list(QtWidgets.QWidget)) –

clear()

Clear all the widgets in the frameLayout

setIcon(icon)

Sets the large icon of this tooltip dialogue window

Parameters:

icon

setTitle(title, applyStyle=True)

Set the title text and apply our style by replacing text if we need to.

Parameters:
  • title

  • applyStyle

keyReleaseEvent(event)

Close the dialogue on expanded tooltip key release

Parameters:

event

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

Bases: QLabel

A QLabel which plays our gif out

gifEnv = 'HIVE_UI_GIFS'
class WidgetsFromTextParser(text)

Bases: HTMLParser

Parses an string (with html tags) and splits it up into a list of widgets. This is so we can inject the GifWidgets into the main layout.

The documentation here describes how to use HTMLParser quite well: https://docs.python.org/2/library/htmlparser.html

Pretty much we feed the string into HTMLParser, and we reconstruct it with self.constructed. Once it reaches a <zoo> tag, it creates a new widget for each zoo tag.

feed(data)

Goes through the string and throws out handle events as it comes across tags.

Parameters:

data

widgets()

Return the widgets generated from the string that is fed in.

Returns:

list

handle_starttag(tag, attrs)

Every time it finds a start tag eg. <a>, <img>, <span> this function is run along with the data.

Here we add our own tags eg. <zoo gif=”example” />. Create a label from all the previous text, and create a new GifWidget for this gif

Parameters:
  • tag

  • attrs

handle_endtag(tag)

Close tags eg. </span> </b> </div>

Parameters:

tag (str) –

handle_data(data)

Data in between tags eg. <span>data in between tags</span>

Parameters:

data

addGifWidget(file)

Add a GifWidget when gif tag is found

Parameters:

file

addLabelFromConstructed()

Add a label with the current text in constructed.

installTooltips(widget, tooltipDict)

Installs the expanded tooltip onto a widget. Works in conjunction with artistui.keyPressEvent() to display a popup (zoo.apps.hiveartistui.views.expandedtooltip.ExpandedTooltipPopup)

Parameters:
  • widget (QtWidgets.QWidget or QtWidgets.QAction) –

  • tooltipDict

hasExpandedTooltips(widget)

Returns whether the widget has the injected _expandedTooltips_ object present in the widget

Parameters:

widget

copyExpandedTooltips(source, dest)

Copy the _expandedTooltips_ from source widget to destination

Parameters:
  • source

  • dest

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

Bases: QObject

Acts as a Data storage for the Expanded tooltips.

Works in conjunction with artistui.keyPressEvent() to display a popup

title = ''
text = ''
icon = ''

Extendedbutton

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

Bases: QAbstractButton

Set up the icons that change on mouse over, press and release. Inherit from this class to have icons

class ExtendedButton(QtWidgets.QPushButton, ButtonIcons):
class ExtendedButton(QtWidgets.QToolButton, ButtonIcons):

Must be placed after the button.

highlightOffset = 40
iconNames = None
iconColors = (128, 128, 128)
iconScaling = []
buttonIcon = None
buttonIconPressed = None
buttonIconHover = None
setHighlight(highlight)
setIconByName(iconNames, colors=None, size=None, colorOffset=None, tint=None, tintComposition=MockExt.QtGui.QPainter.CompositionMode_Plus, iconScaling=None, grayscale=False)

Set up both icons in a simple function

Parameters:
  • iconNames (basestring or list) – name of the icon

  • colors (tuple or list or None) – the icon regular color

  • size (int) – Size is dpiScaled automatically here, but can be passed in

  • colorOffset (int) – the amount of tint white highlight that’s added when mouse over hover 0-255

  • iconScaling (list of int or int) – the icon’s scale

setIconColor(colors, update=True)
updateIcons()
setIconSize(size)

Set icon size

Parameters:

size (QtCore.Size) –

Returns:

setIconIdle(icon)

Set the button Icon when idle or default.

Parameters:

icon

Returns:

setIconHover(iconHover)

Set the button icon for when mouse hovers over

Parameters:

iconHover

Returns:

enterEvent(event)

Button Hover on mouse enter

Parameters:

event

Returns:

leaveEvent(event)

Button Hover on mouse leave

Parameters:

event

Returns:

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

Bases: QPushButton, ButtonIcons

Push Button that allows you to have the left click, middle click, and right click.

Each click allows for a menu

# You can use it in a similar fashion to QPushbutton
ExtendedButton(icon=iconlib.iconColorized("magic", size=32, color=(128,128,128)),
               iconHover=iconlib.iconColorized("magic", size=32, color=(255,255,255)))

# Set the hover through the constructor like above or simply set the iconName and offset
SINGLE_CLICK = 1
DOUBLE_CLICK = 2
highlightOffset = 40
actionTriggered

alias of object

updateTheme(event)

Update the theme

Returns:

Return type:

themeUpdatesColor(use)

Use the theme colour on theme change and update

Parameters:

use (bool) –

Returns:

Return type:

actions(mouseMenu=MockExt.QtCore.Qt.LeftButton)

Get the actions of a mouse menu

Parameters:

mouseMenu

Returns:

Return type:

list of QtWidgets.QAction

setDoubleClickInterval(interval=150)

Sets the interval of the double click, defaults to 150

Parameters:

interval

Returns:

setDoubleClickEnabled(enabled)

Enables double click signals for this widget

Parameters:

enabled

Returns:

setWindowTitle(windowTitle, mouseMenu=MockExt.QtCore.Qt.LeftButton)

Set the window title of the menu, if it gets teared off

Parameters:
  • windowTitle

  • mouseMenu

Returns:

setTearOffEnabled(mouseMenu=MockExt.QtCore.Qt.LeftButton, tearoff=True)

Set the tear off enabled

Parameters:
  • mouseMenu

  • tearoff

Returns:

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

Sets the menu based on mouse button

Parameters:
  • menu (QtWidgets.QMenu) –

  • mouseButton

Returns:

setFixedHeight(height)

DpiScaling version of set fixed height

Parameters:

height

Returns:

setFixedWidth(width)

DpiScaling version of set fixed width

Parameters:

width

Returns:

setFixedSize(size)

Set the fixed size

Parameters:

size (QtCore.QSize) – New fixed size of the widget

Returns:

setMinimumHeight(minh)

Set min height. Automatically does the dpi scaling

Parameters:

minh

Returns:

setMinimumWidth(minw)

Set min width. Automatically does the dpi scaling

Parameters:

minw

Returns:

setMaximumHeight(maxh)

Set max height. Automatically does the dpi scaling

Parameters:

maxh

Returns:

setMaximumWidth(maxw)

Set max width. Automatically does the dpi scaling

Parameters:

maxw

Returns:

setSearchable(mouseMenu=MockExt.QtCore.Qt.LeftButton, searchable=True)
isSearchable(mouseMenu=MockExt.QtCore.Qt.LeftButton)

Checks if the button menu is searchable or not.

Parameters:

mouseMenu

Returns:

setMenuAlign(align=MockExt.QtCore.Qt.AlignLeft)
clearMenu(mouseMenu=MockExt.QtCore.Qt.LeftButton)

Clears specified menu

Parameters:

mouseMenu – QtCore.Qt.LeftButton, QtCore.Qt.MidButton, QtCore.Qt.RightButton

Returns:

mousePressEvent(event)

Mouse set down button visuals

Parameters:

event

Returns:

mouseReleaseEvent(event)

Mouse release event plays the menus

Parameters:

event

Returns:

mouseSingleClickAction(button)

The actual single click action

Parameters:

button

Returns:

mouseDoubleClickAction(button)

The actual double click Action

Parameters:

button

Returns:

mouseDoubleClickEvent(event)

Detects Double click event.

Parameters:

event

Returns:

contextMenu(mouseButton)

Run context menu depending on mouse button

Parameters:

mouseButton

Returns:

menuPos(align=MockExt.QtCore.Qt.AlignLeft, widget=None)

Get menu position based on the current widget position and perimeter

Parameters:
  • align (QtCore.Qt.AlignLeft or QtCore.Qt.AlignRight) – Align the menu left or right

  • widget (QtWidgets.QWidget) – The widget to calculate the width based off. Normally it is the menu

Returns:

menu(mouseMenu=MockExt.QtCore.Qt.LeftButton, searchable=False, autoCreate=True)

Get menu depending on the mouse button pressed

Parameters:

mouseMenu

Returns:

The requested menu

Return type:

ExtendedButtonMenu

index(name, mouseMenu=MockExt.QtCore.Qt.LeftButton)

Gets the index of the menu item or action name

Parameters:
  • name

  • mouseMenu

Returns:

Return type:

addAction(name, mouseMenu=MockExt.QtCore.Qt.LeftButton, connect=None, checkable=False, checked=True, action=None, icon=None, data=None, iconText=None, iconColor=None, iconSize=16, toolTip=None)

Add a new menu item through an action

Parameters:
  • mouseMenu – Expects QtCore.Qt.LeftButton, QtCore.Qt.MidButton, or QtCore.Qt.RightButton

  • name – The text for the new menu item

  • connect – The function to connect when the menu item is pressed

  • checkable – If the menu item is checkable

  • icon (QtGui.QIcon or basestring) –

Returns:

Return type:

taggedAction.TaggedAction

insertActionIndex(index, name, mouseMenu=MockExt.QtCore.Qt.LeftButton, connect=None, checkable=False, checked=True, action=None, icon=None, data=None, iconText=None, iconColor=None, iconSize=16, toolTip=None, afterIndex=False)

Insert action at index

Parameters:
  • index

  • name

  • mouseMenu

  • connect

  • checkable

  • checked

  • action

  • icon

  • data

  • iconText

  • iconColor

  • iconSize

  • toolTip

Returns:

insertSeparatorIndex(index, mouseMenu=MockExt.QtCore.Qt.LeftButton, afterIndex=False)

Insert separator by index

Parameters:
  • index

  • mouseMenu

  • afterIndex

Returns:

newAction(name, mouseMenu=MockExt.QtCore.Qt.LeftButton, connect=None, checkable=False, checked=True, icon=None, data=None, iconText=None, iconColor=None, iconSize=16, toolTip=None, afterIndex=False)

Generates a new action for the menu

Parameters:
  • name

  • mouseMenu

  • connect

  • checkable

  • checked

  • action

  • icon

  • data

  • iconText

  • iconColor

  • iconSize

  • toolTip

  • afterIndex

Returns:

addSeparator(mouseMenu=MockExt.QtCore.Qt.LeftButton)

Add a separator in the menu

Parameters:

mouseMenu

Returns:

stringToTags(string)

Break down string to tags so it is easily searchable

Parameters:

string

Returns:

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

Bases: ExtendedButton

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

Bases: SearchableMenu

keyPressEvent(event)

Key press event

Parameters:

event

Returns:

keyReleaseEvent(event)
index(name, excludeSearch=True)
class ExtendedButtonSimpleMenu(*args: Any, **kwargs: Any)

Bases: QPushButton, MenuCreateClickMethods

mousePressEvent(event)

mouseClick emit, only uses clicks as assigned by the menus

Checks to see if a menu exists on the current clicked mouse button, if not, use the original Qt behaviour

Parameters:

event (QEvent) – the mouse pressed event from the QLineEdit

setMenu(menu, modeList=None, mouseButton=MockExt.QtCore.Qt.RightButton)

Add the left/middle/right click menu by passing in a QMenu and assign it to the appropriate mouse click key

Note**: this method is in the elements.MenuCreateClickMethods class, for buttons we need to override here too

If a modeList is passed in then auto create/reset the menu to the modeList:

[(“icon1”, “menuName1”), (“icon2”, “menuName2”)]

If no modelist the menu won’t change

Parameters:
  • menu (QtWidgets.QMenu) – the Qt menu to show on middle click

  • modeList (list(tuple(str))) – a list of menu modes (tuples) eg [(“icon1”, “menuName1”), (“icon2”, “menuName2”)]

  • mouseButton (QtCore.Qt.ButtonClick) – the mouse button clicked QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MiddleButton

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

Bases: ExtendedButton, DPIScaling

initUi()

Initialize Ui

Returns:

setFixedHeight(height)

Set Fixed Height

Parameters:

height (int) – Height in pixels of the button

Returns:

setFixedSize(size)

Set the fixed size

Parameters:

size (QtCore.QSize) – New fixed size of the widget

Returns:

updateTheme(event)

Update the theme

Returns:

Return type:

updateImageWidget(newHeight)

Make sure the image widget is always square

Parameters:

newHeight (int) – The new height of the widget to update to

Returns:

setText(text)

Set the text

Parameters:

text (basestring) – Text to set the button to

Returns:

setForceUpper(force)

Force upper case

Parameters:

force (bool) – Force upper case

Returns:

setShadowHeight(height)

Set the shadow height in pixels

Parameters:

height (int) – Height in pixels

Returns:

mouseDoubleClickEvent(event)

Detects Double click event.

Parameters:

event

Returns:

setIconSize(size)

Set the icon size

Parameters:

size

Returns:

setIconByName(iconNames, colors, size=None, hoverColor=None, pressedColor=None, iconScaling=None)

Set Icon Size by name

todo: needs additional features similar to the ButtonIcons.setIconByName() method

Parameters:
  • size (int) – Size of the icon in pixels

  • iconNames (list or basestring) – Names of the icons

  • colors (list of tuple) – Colors of the icons

Returns:

enterEvent(event)

Button Hover on mouse enter

Parameters:

event

Returns:

leaveEvent(event)

Button Hover on mouse leave

Parameters:

event

Returns:

mousePressEvent(event)

Mouse set down button visuals

Parameters:

event

Returns:

mouseReleaseEvent(event)

Mouse release event plays the menus

Parameters:

event

Returns:

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

Bases: QLabel, DPIScaling

CSS Purposes

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

Bases: QFrame, DPIScaling

CSS Purposes

Extendedmenu

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

Bases: SearchableMenu

currentMenuItem()

Returns the current selected menu name (current menu name related to the main icon)

Return self.currentMenuIndexInt:

The current menu name (of the current icon)

Rtype self.currentMenuIndexInt:

str

currentMenuIndex()

Returns the current selected menu index (current menu number related to the main icon)

Return self.currentMenuIndexInt:

The current index menu item (of the current icon)

Rtype self.currentMenuIndexInt:

int

setCurrentMenuItem(currentMenuItem)

Sets both menu states by the menu item name, does not trigger a menu action.

Sets the following variables:

self.currentMenuItemStr: the current menu name as a string self.currentMenuIndexInt: the current menu item as a int

Parameters:

currentMenuItem (str) – The name of a single menu name (one item in the menu)

setCurrentMenuIndex(currentMenuIndexInt)

Sets both menu states by the menu item index, does not trigger a menu action.

Sets the following variables:

self.currentMenuItemStr: the current menu name as a string self.currentMenuIndexInt: the current menu item as a int

Parameters:

currentMenuIndexInt (int) – The current index menu item (of the current icon)

stringToTags(string)

Break down string to tags so it is easily searchable

Parameters:

string

Returns:

iconAndMenuNameLists(modeList)

from the modeList set the self.menuItemStrList and self.menuIconList:

modeList: [(“icon1”, “menuName1”), (“icon2”, “menuName2”), (“icon3”, “menuName3”)]

resets the lists:

self.menuIconList: [“icon1”, “icon2”, “icon3”] self.menuIconList: [“menuName1”, “menuName2”, “menuName3”]

Parameters:

modeList (list(tuple(str))) – a list of menu modes (tuples) eg [(“icon1”, “menuName1”), (“icon2”, “menuName2”)]

addActionExtended(name, connect=None, checkable=False, checked=True, action=None, icon=None)

Builds a new single menu item through an action, will add icon, menu item name, connection function etc.

Parameters:
  • name (str) – The text for the new menu item

  • connect (callable) – The function to connect when the menu item is pressed

  • checkable (bool) – If the menu item is checkable

  • checkable – If the menu item is checkable

  • action (taggedAction.TaggedAction) – set the action directly, will ignore other kwargs

  • icon (QtGui.QIcon) – set the icon for the menu item.

Return newAction:

The new action if one was created

Rtype newAction:

taggedAction.TaggedAction

actionConnectList(modeList, defaultMenuItem=None)

Creates the entire menu with optional icons from the modeList:

modeList: [(“icon1”, “menuName1”), (“icon2”, “menuName2”), (“icon3”, “menuName3”)] or modeList: [(None, “menuName1”), (None, “menuName2”), (None, “menuName3”)]

Separators should be passed in as (None, “separator”)

Automatically creates the actions and menu states so they can be queried later Creates/recreates/resets self.menuItemStrList and self.menuIconList lists

Parameters:

modeList (list(tuple(str))) – a list of menu modes (tuples) eg [(“icon1”, “menuName1”), (“icon2”, “menuName2”)]

actionConnect(iconName, currentMenuItem, currentMenuIndex)

Creates a default for a single IconMenuButton menu item ie one menu entry not the whole menu

Sets the icon to switch when a menu item is clicked, also sets the menuState as an int and str:

iconName: the icon that will be changed to when the menu is clicked currentMenuItem: usually the current menu name, ie “Arnold” if that renderer is set as the main icon currentMenuIndex: the current state of the menu as an int, 0 being the first menu item

Parameters:
  • currentMenuItem (str) – the current state of the menu, ie “Arnold” renderer, used querying the button state

  • currentMenuIndex (int) – the current state of the menu as an int used while querying the button state

Return self.currentMenuItemStr:

the current state of the menu, used querying the button state

Rtype self.currentMenuItemStr:

str

Return self.currentMenuIndexInt:

the current state of the menu as an int used while querying the button

Rtype self.currentMenuIndexInt:

int

Floatingbutton

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

Bases: Dialog

setAlignment(align)

Set alignment of the button. Use .move() to update the position

Parameters:

align

Returns:

initUi()

Init Ui

Returns:

move(x, y)

Move the FloatingButton based on alignment.

Parameters:
  • x

  • y

Returns:

Flowlayout

FlowLayout Custom layout that mimics the behaviour of a flow layout (not supported in PyQt by default) @source https://qt.gitorious.org/pyside/pyside-examples/source/060dca8e4b82f301dfb33a7182767eaf8ad3d024:examples/layouts/flowlayout.py Comments added by Jos Balcaen(http://josbalcaen.com/) @date 1/1/2015

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

Bases: QLayout

Custom layout that mimics the behaviour of a flow layout

orientation()
setOrientation(orientation)

Set out how the widgets will be laid out. Horizontally or vertically

Parameters:

orientation (QtCore.Qt.Horizontal or QtCore.Qt.Horizontal) – Orientation of the widgets

Returns:

clear()

Clear all widgets :return:

addItem(item)

Add an item at the end of the layout. This is automatically called when you do addWidget()

Parameters:

item (QWidgetItem) –

addSpacing(spacing)
count()

Get the number of items in the this layout

:return (int)

itemAt(index)

Get the item at the given index

:param index (int) :return (QWidgetItem)

takeAt(index)

Remove an item at the given index

:param index (int) :return (None)

insertWidget(index, widget)

Insert a widget at a given index

:param index (int) :param widget (QWidget)

items()
expandingDirections()

This layout grows only in the horizontal dimension or vertical direction depending on current orientation

hasHeightForWidth()

If this layout’s preferred height depends on its width

:return (boolean) Always True

heightForWidth(width)

Get the preferred height a layout item with the given width

:param width (int)

setGeometry(rect)

Set the geometry of this layout

:param rect (QRect)

allowOverflow(allow)

Allows the flow layouts to overflow, rather than go onto the next line

Parameters:

allow (bool) – True to allow, False to not allow

Returns:

sizeHint()

Get the preferred size of this layout

:return (QSize) The minimum size

minimumSize()

Get the minimum size of this layout

:return (QSize)

setSpacingX(spacing)

X Spacing for each item

Parameters:

spacing

Returns:

setSpacingY(spacing)

Y Spacing for each item

Parameters:

spacing

Returns:

doLayout(rect, testOnly)

Layout all the items

:param rect (QRect) Rect where in the items have to be laid out :param testOnly (boolean) Do the actual layout

Flowtoolbar

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

Bases: QFrame

A tool bar based off the FlowLayout. The buttons will flow from left to right and wrap to the next row if there is no space

flowToolbar = FlowToolBar()
flowToolbar.addTool("stream2", name="Tool Button Name", iconColor=(255,255,255))
flowToolbar.addToolMenu("stream2", name="Tool Button Name", actions=[('Menu Item 1', func1),('Menu Item 2',
                        func2)])

def func1():
    pass
def func2():
    pass
overflowIcon = 'sortDown'
initUi()

Initialise flow toolbar ui

setDebugColors(debug)

Set debug colors

Parameters:

debug

Returns:

setIconSize(size)

Set the size of the icons of the tools and toolmenus

Parameters:

size – DPI scale is automatically calculated here so size does not need it here.

setIconPadding(padding)

Sets the padding for the icons of the tools and the tool menus

Parameters:

padding

overflowMenuActive(active)
setOverflowButtonColor(col)

Sets the color for the overflow button

Parameters:

col

Returns:

setupOverflowMenu(btn=None)

Setup the overflow menu and connect it to btn. If there’s no button yet create one.

Parameters:

btn

Returns:

addToolButton(iconName, name='', iconColor=(255, 255, 255), doubleClickEnabled=False)

Creates a new tool button based on the icon name, and the name.

Parameters:
  • iconName – Name of the icon to retrieve

  • name – Name of the tool

  • iconColor – Color of the icon for the tool

  • doubleClickEnabled – Enable doubleclick for button

Returns:

Return type:

iconmenu.IconMenuButton

getIconSize()

Returns the icon generated QSize

Return type:

QtCore.QSize

addToolMenu(iconName, name, actions, iconColor=(255, 255, 255), showIndicator=True)

Adds a new tool menu.

Parameters:
  • iconName – Name of the icon to retrieve

  • name – Name of the tool

  • actions – Actions is a list of tuples with the name and function to run eg (‘Name’, self.menuItemPressed)

  • iconColor – The icon color

  • showIndicator – Show the menu indicator (the arrow in the corner)

clear()

Clear all widgets

toolsClicked()

All buttons will run through here. It will then run a separate function telling which button was pressed, along with some other details

resizeEvent(event)

Resize event for the toolbar

Parameters:

event

Returns:

sizeHint()

Size hint for the flow toolbar

Returns:

updateWidgetsOverflow(size=None)

Hide or show widgets based on the size of the flow toolbar.

If the flow toolbar is too small it will move widgets it to the overflow menu.

If there are widgets in the overflow menu, place it back into the flow toolbar if there is space.

Parameters:

size (QtCore.QSize) – new size

Returns:

setMenuItemsVisible(texts)

Set the texts visible in the menu.

Parameters:

texts

Returns:

itemList()

Itemlist without the overflow menu button

Returns:

items()

Flow layout items

Returns:

buttonClicked(wgt, name)

O verridden by the subclass

Parameters:
  • wgt – The widget that was pressed, typically a button

  • name – The name of the tool

setHeight(height)

Set Fixed Height

Parameters:

height

Returns:

setSpacingX(x)

Set spacing of items in layout

Parameters:

x

Returns:

setSpacingY(y)

Set spacing of items in layout

Parameters:

y

Returns:

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

Bases: Dialog

initUi()
layout()
sizeHint()
show(*args, **kwargs)

Frame

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

Bases: QFrame

mouseReleased

alias of object

mouseReleaseEvent(event)
class CollapsableFrame(*args: Any, **kwargs: Any)

Bases: QWidget

initUi()

Builds the UI, the title and the collapsable widget that’ the container for self.hiderLayout

buildTitleFrame()

Builds the title part of the layout with a QFrame widget

addWidget(widget)
addLayout(layout)
buildHiderWidget()

Builds widget that is collapsable Widget can be toggled so it’s a container for the layout

onCollapsed()
onExpand()
showHideWidget(*args)

Shows and hides the widget self.widgetHider this contains the layout self.hiderLayout which will hold the custom contents that the user specifies

connections()

Toggle widgetHider vis

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

Bases: CollapsableFrame

buildTitleFrame()

Add custom behaviour to the title frame

Returns:

Groupbox

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

Bases: QGroupBox

Collapsible Group box using arrow icons to indicate current state.

The size of the expansion is determined by the size of the contents.

Note:

All standard groupbox features are supported

resizeGroupBox(fullSize)

handles the sizing on toggle

paintEvent(e)

Groupedtreewidget

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

Bases: QTreeWidgetItem

class ItemInfo

Bases: object

The description of a TreeWidgetItem so it can be pickled into a mime data and dragged into another tree

data = None
text = ''
children = None
toolTip = ''
itemHash = 0
itemType = ''
classmethod fromItems(items)
  • If a child is selected after parent, the child is not included in the reconstruction

  • If a child is selected first, then the parent after, the child excluded in the reconstruction

Parameters:

items

Returns:

classmethod fromItem(item)

Constructs a tree from item

Parameters:

item

Returns:

classmethod removeFromDescendents(itemInfo, removeInfo)

Remove removeInfo from itemInfos descendents

Parameters:
  • itemInfo

  • removeInfo

Returns:

classmethod removeRedundant(infos)

Remove redundant children from list of infos.

When dragging we don’t want the children to be in the list, only the upper most parent. This is to stop it from creating the child already when the parent creates the children when reconstructing the TreeWidgetItem sub tree.

Parameters:

infos

Returns:

classmethod inDescendents(sourceInfo, targetInfo)

If target is in source’s descendants

Parameters:

sourceInfo (ItemInfo) –

Returns:

descendents()

Descendants of info

Returns:

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

Bases: QTreeWidget

ITEMTYPE_WIDGET = 'WIDGET'
ITEMTYPE_GROUP = 'GROUP'
ITEMWIDGETINFO_COL = 1
DATA_COL = 2
INSERT_AFTERSELECTION = 0
INSERT_END = 1
INSERT_ATINDEX = 2
defaultGroupName = 'Group'
itemsDropped

alias of object

itemsDragged

alias of object

itemsDragCancelled

alias of object

initUi()

Init Ui Setup

Returns:

dragging()
setDragDropEnabled(state)

Enables or disables drag and drop for the tree widget.

setLocked(locked)

Sets the lock for drag and drop.

Parameters:

locked (bool) –

connections()
treeSelectionChanged()
initDragDrop()

Set up Drag drop Settings for this widget

setDragWidget(widget, hotspotAlign=MockExt.QtCore.Qt.AlignVCenter)

The widget that will be shown in the drag

Returns:

startDrag(supportedActions, widget=None)

Override this to set the widget thats gets shown when dragged

Example:

def startDrag(self, supportedActions):
    itemPos = self.mapFromGlobal(QtGui.QCursor.pos())
    item = self.itemAt(itemPos)
    self.setDragWidget(self.itemWidget(item, groupedtreewidget.WIDGET_COL).titleFrame, hotspotAlign=QtCore.Qt.AlignVCenter)

    super(ToolsetTreeWidget, self).startDrag(supportedActions)
Parameters:
  • supportedActions

  • widget – Widget to use to drag. If widget is none, then just use the whole ItemWidget. Usually set by the overriding class

Returns:

dragTargetChanged(widget)

Drag target changed

Parameters:

widget

Returns:

Return type:

dropCancelledCheck(target)

Check to see if the drop was cancelled

Parameters:

target (QtWidgets.QWidget) – The target widget that has been dropped into

Returns:

Return type:

dropEvent(event)

Drop event

Handle all the QT weirdness of drag dropping to separate trees here.

Parameters:

event (QtGui.QDropEvent) –

Returns:

removeItems(items)

Remove items from tree

Parameters:

items (list) –

Returns:

Return type:

mimeData(items)

The data that will be dragged between tree nodes

Parameters:

items (list of QtWidgets.TreeWidgetItem) – List of selected TreeWidgetItems

Returns:

dropMimeData(parent, index, mimedata, action)

Drop Mime Data

This is usually run first before dropEvent

Parameters:
  • parent

  • index

  • mimedata

  • action

Returns:

reconstructItems(item, widgetInfo)

Reconstruct items from widgetInfo.

Includes the children

Parameters:
Returns:

updateItemWidgets(items)

Update TreeWidgetItems to their respective itemWidgets children.

Usually used when drag and dropped, since drag drop deletes their itemWidget.

Parameters:

items (list of QtWidgets.QTreeWidgetItem) –

Returns:

updateAllWidgets()

Update all the TreeWidgetItems to their respective itemWidgets in the tree.

Usually used when drag and dropped, since drag drop deletes their itemWidget.

Returns:

dragEnterEvent(event)

Only accept if it is the same GroupedTreeWidget type.

Override if you need it to accept drag events even if the tree class is different

Parameters:

event

Returns:

updateWidget(item)

Update the TreeWidgetItem to its itemWidget.

Should be overridden by its subclass

Usually used when drag and dropped, since drag drop deletes their itemWidget. This is to reconstruct the itemWidget.

model = self.itemWidgetInfo(item)
self.setItemWidget(item, 0, QtWidgets.QLabel(item.text(1), parent=self))

or

self.setItemWidget(item, WIDGET_COL, componentwidget.ComponentWidget(componentModel=model, parent=self))
Parameters:

item (QtWidgets.QTreeWidgetItem) –

Returns:

updateGroupWidget(item)

Update the TreeWidgetItem to use a GroupWidget.

This should be overridden if you have your own GroupWidget

Parameters:

item (QtWidgets.QTreeWidgetItem) – TreeWidgetItem to attach a GroupWidget to

Returns:

hashesFromItemInfo(itemInfos, str=False)

Get all the itemHashes from itemInfos and their children

Parameters:
  • itemInfos – list of

  • str

Returns:

itemFromHash(hash, rootItem=None)

Get the hash which is saved in the items tooltip

Parameters:
  • hash

  • rootItem

Returns:

descendants(item)

Descendants of QTreeWidgetItem

Parameters:

item (QtWidgets.QTreeWidgetItem) –

Returns:

setCurrentItems(items)

Selects the items in the TreeWidget

Parameters:

items

insertNewItem(name, widget=None, index=0, treeParent=None, itemType='WIDGET', widgetInfo=None, icon=None)

Inserts a new item at a location, and sets the widget as the itemWidget

ItemType can be Widget or Group. Groups wont have user customized widgets, but can have children. ITEMTYPE_WIDGETS wont have children.

May merge with self.addNewItem()

Parameters:
  • name – Name of the new Item, generally put into the text field of the TreeWidgetItem. This is the text that is used for the search bar if it is active.

  • widget – Expects ItemWidget or any subclass of QtWidgets.QWidget.

  • index – Index to insert into

  • treeParent (TreeWidgetItem or None) – The parent that it will insert into. If treeParent is None, it will assume the parent to be Root

  • itemType – The type of widget being set for the new Item.

  • icon – Icon to set for the TreeWidgetItem

Returns:

The new item created

Return type:

TreeWidgetItem

addNewItem(name, widget=None, itemType='WIDGET', widgetInfo=None, icon=None)

Add a new item type. Should be a group or an itemWidget. If you’d like to add a TreeWidgetItem instead, use addNewTreeWidgetItem()

ItemType can be Widget or Group. Groups wont have user customized widgets, but can have children. ITEMTYPE_WIDGETS wont have children.

May merge with self.insertNewItem()

Parameters:
  • widgetInfo

  • name – Name of the new Item, generally put into the text field of the TreeWidgetItem. This is the text that is used for the search bar if it is active.

  • widget – Expects ItemWidget or any subclass of QtWidgets.QWidget.

  • itemType – The type of widget being set for the new Item.

  • icon – Icon to set for the TreeWidgetItem

Returns:

The new item created

Return type:

TreeWidgetItem

itemWidgetInfo(item)

Retrieve the information to build the widget from the item.

The info to build the itemWidget from the data that is stored in the data column eg. The ComponentModel for a ComponentWidget, or simply Text for QLabel

It would return the ComponentModel or the Text.

Parameters:

item

Returns:

itemWidgets(itemType=None, treeItem=None)

Gets all widgets in the tree.

includeNones is for when QTreeWidgetItems doesn’t have a itemWidget attached, but for any reason or another we still want to know

Returns:

List of itemWidgets

Return type:

list[]

treeWidgetItemByHash(treeItemHash)

Return TreeWidgetItem by hash. If this is slow maybe we should put all the treeWidgetItems in a hash map as well.

Parameters:

treeItemHash

Returns:

Return type:

TreeWidgetItem or None

itemWidget(treeItem, col=None)

Short hand to get the item widget from the default column (as defined by WIDGET_COL)

Parameters:
  • treeItem

  • col

Returns:

QtWidgets.QWidget

updateTreeWidget(delay=False)

Updates the tree widget so the row heights of the TreeWidgetItems matches what the ComponentWidgets ask for in terms of the sizeHint() asks for

itemType(treeItem)

Get the item type (“COMPONENT” or “GROUP”)

Parameters:

treeItem (TreeWidgetItem) – The TreeWidgetItem to get the type of

Returns:

getItemName(treeItem)
filter(text)

Hide anything that that doesnt have text. Used for searches.

Parameters:

text

addGroup(name='', expanded=True, groupSelected=True, groupWgt=None)

Adds a group to the ComponentTreeWidget. If no name is given, it will generate a unique one in the form of “Group 1”, “Group 2”, “Group 3” etc

Parameters:
  • groupSelected

  • expanded

  • name

  • groupWgt – Use this as the widget, if its none we’ll just use the text background as the display

Returns:

Todo:

This area still needs a bit of work. Update with addNewItem code

insertGroup(name='', index=0, treeParent=None, expanded=True, groupWgt=None, icon=None)

Inserts a group into index, underneath treeParent.

Parameters:
  • name

  • index

  • treeParent

  • expanded

  • groupWgt (zoo.apps.hiveartistui.views.componentwidget.ComponentGroupWidget) –

  • icon

Returns:

addToGroup(item, group)
getUniqueGroupName()

Returns a unique group name: “Group 1”, “Group 2”, “Group 3” etc.

Returns:

Return type:

str

applyFlags()

Apply flags as set by self.groupFlags and self.itemWidgetFlags.

ITEMTYPE_WIDGET gets applied a different set of drag drop flags to ITEMWIDGET_GROUP

iterator()

Iterator to iterate through the treeItems

for it in treeItemIterator:
    treeItem = it.value()
Returns:

Return type:

collections.Iterator[QtWidgets.QTreeWidgetItem]

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

Bases: StackTitleFrame

initUi()

Builds the title part of the layout with a QFrame widget

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

Bases: QWidget

The Widget used for groups in TreeWidget

initUi()
setTreeItem(treeItem)
connections()
updateTreeItemData()
text()

Returns the text of the text edit :return:

buildTitleFrame()

Builds the title part of the layout with a QFrame widget

expandToggle()
onCollapsed()

Collapse and hide the item contents :return:

onExpand()
expand()

Extra Code for convenience

collapse()

Extra Code for convenience

mousePressEvent(event)
passThroughMouseEvent(event)
class ItemWidgetLabel(*args: Any, **kwargs: Any)

Bases: QLabel

initUi()
connectEvent(func)
copy()
mouseDoubleClickEvent(event)
mousePressEvent(event)
mouseReleaseEvent(event)
text()

Headertoolbar

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

Bases: QToolBar

Header tool bar for a window, comes prebuilt with a label, minimize,maximize and close buttons, parent must implement showMinimized, toggleMaximized, close

Icon

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

Bases: QIcon

setColor(color, size=None)

Iconmenu

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

Bases: ExtendedButton

IconMenuButton is a button that only takes an icon. Clicking it will pop up a context menu. Left click, middle click and right click can be customized and added with addAction

from zoo.libs import iconlib
logoButton = IconMenuButton(iconlib.icon("magic", size=32))
logoButton.setIconSize(QtCore.QSize(24, 24))

# Add to menu. The menu is automatically created if there is none and placed into
# self.leftMenu, self.middleMenu or self.rightMenu
logoButton.addAction("Create 3D Characters")
logoButton.addSeparator()
logoButton.addAction("Toggle Toolbars", connect=self.toggleContents)

# Middle Click and right click menu
logoButton.addAction("Middle Click Menu", mouseMenu=QtCore.Qt.MidButton)
logoButton.addAction("Right Click Menu", mouseMenu=QtCore.Qt.RightButton)

# to query the menu state, the method actionConnect() can be used to create the menu, if so then use
stateAsAString = logoButton.currentMenuItemStr  # the current menu item name "First Menu Item"
# or
stateAsAnInt = logoButton.currentMenuIndexInt  # the current menu as an int ie 0

Use the function iconMenuButtonCombo() for more convenient usage and documentation

from zoo.libs.pyqt.widgets import iconmenu
iMBtn = iconmenu.iconMenuButtonCombo(modes, defaultMenuItem)

See the function and documentation for iconMenuButtonCombo() for more information

Parameters:
  • icon (QtGui.QIcon) – the default icon

  • iconHover (str) – the hover icon name

  • parent (QtWidgets.QWidget) – the parent widget

  • doubleClickEnabled (bool) – does the button have a double click state?

  • color (tuple) – The color of the main icon on the button

  • menuName (str) – the current state of the menu as a string ie. “Arnold” if it were the renderer set.

initUi()

Initialise the ui

Returns:

Return type:

currentText()

Returns the current selected menu name (current menu name related to the main icon)

Return type:

basestring

text()

Same as currentText() to avoid confusion

Returns:

Return type:

currentAction(mouseMenu=MockExt.QtCore.Qt.LeftButton)
Parameters:

mouseMenu

Returns:

Return type:

QtWidgets.QAction

currentMenuIndex(mouseMenu=MockExt.QtCore.Qt.LeftButton)

Returns the current selected menu index (current menu number related to the main icon)

Return self.currentMenuIndexInt:

The current index menu item (of the current icon)

Rtype self.currentMenuIndexInt:

int

menuItemClicked(action, mouseMenu)

Switch the icon when clicking a menu item

Parameters:
  • action

  • mouseMenu

Returns:

Return type:

setMenuName(name, mouseMenu=MockExt.QtCore.Qt.LeftButton)

Sets the main icon and menu states by the menuItem name

Menu items must already be created.

Parameters:
  • name (str) – the name of the menu item to set

  • mouseMenu

actionConnectList(modeList, mouseMenu=MockExt.QtCore.Qt.LeftButton)

Creates the entire menu with icons from the modeList:

modeList: [(“icon1”, “menuName1”), (“icon2”, “menuName2”), (“icon3”, “menuName3”)]

Automatically creates the actions and menu states so they can be queried later Also changes the main icon auto with the menu actions Creates/recreates/resets self.menuItemStrList and self.menuIconList lists

Parameters:

modeList (list(tuple(str))) – a list of menu modes (tuples) eg [(“icon1”, “menuName1”), (“icon2”, “menuName2”)]

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

Bases: IconMenuButton

Simple dots menu

initUi()

Initialise the ui

Returns:

Return type:

iconMenuButtonCombo(menuItems, defaultMenuItem, color=None, parent=None, width=30, height=24, toolTip='', switchIconOnClick=True, setDefaultIconByName='')

Creates an IconMenuButton in a combo box style, like a combo box with an icon instead, works with left click and a regular menu.

The following creates a menu with icons, the defaultMenuItem is the item set by default and should match the menu.

modes = [("arnoldIcon", "Arnold"),
        ("redshiftIcon", "Redshift"),
        ("rendermanIcon", "Renderman")]
defaultMenuItem = "Redshift"

To create an icon menu button.

from zoo.libs.pyqt.widgets import iconmenu
iMBtn = iconmenu.iconMenuButtonCombo(modes, defaultMenuItem)

Menu changes are emitted with itemChanged.

iMBtn.itemChanged.connect(runFunctionMethod)

To query the current menu selection use.

menuSelection = iMBtn.currentMenuItem()  # is the current menu item name ie "Arnold"
# or
menuSelectionNumber = iMBtn.logoButton.currentMenuIndex()  # is the current menu as an int ie 0

To set the icon and related menu states, set with it’s Menu item name (not icon name).

iMBtn.setMenuName("Arnold")

setMenuName() will not trigger a menu change (itemChanged).

Parameters:
  • menuItems (list(tuples)) – A list of tuples, tuples are (iconName, menuItemName)

  • defaultMenuItem (str) – the name of the icon to set as the default state

  • color (tuple) – Color of the main icon in 255 rgb color (255, 0, 0). Defaults to the theme prefs primary icon color

  • parent (QWidget) – the parent widget

  • width (int) – the size of the icon

  • toolTip (str) – the toolTip on mouse hover

Return iconCBtn:

the iconCBtn widget

Rtype iconCBtn:

IconMenuButton

Imagebutton

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

Bases: QPushButton

DEFAULT = 0
HOVER = 1
PRESSED = 2
initUi()

Initialize Ui

Returns:

Return type:

updateZooStyle()

Update the zoo style

Returns:

Return type:

setIconSize(size)

Set Icon Size

Parameters:

size

Returns:

Return type:

resizeEvent(event)

Resize Event

Parameters:

event

Returns:

Return type:

sizeHint()

Size Hint

Returns:

Return type:

enterEvent(event)

Enter Event

Parameters:

event

Returns:

Return type:

leaveEvent(event)

Leave Event

Parameters:

event

Returns:

Return type:

mousePressEvent(event)

Mouse Press event

Parameters:

event

Returns:

Return type:

mouseReleaseEvent(event)

Mouse Release Event

Parameters:

event

Returns:

Return type:

updatePixmap(pixType=0)

Update Pixmap

Parameters:

pixType

Returns:

Return type:

Joinedradio

class JoinedRadioButtonEvent(button, text, index)

Bases: tuple

button

Alias for field number 0

index

Alias for field number 2

text

Alias for field number 1

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

Bases: QFrame

buttonClicked

alias of object

buttonReleased(button)

Button Released

Parameters:

button

Returns:

setChecked(index)
buttons()

Label

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

Bases: QLabel, MenuCreateClickMethods

This class adds the capacity for a left/middle/right click menu to be added to a QLabel

Inherits from zoo’s QtWidgets.QLabel and MenuCreateClickMethods

Menus are not added by default they must be set in the ui code. QMenu’s can be passed in via setMenu():

zooQtWidget.setMenu(myQMenu, mouseButton=QtCore.Qt.RightButton)

Recommended to use zoocore_pro’s extendedmenu.ExtendedMenu(). Pass that in instead of a QMenu for extra functionality

See the class docs for MenuCreateClickMethods() for more information

Parameters:
  • parent (QWidget) – the parent widget

  • menuVOffset (int) – The vertical offset (down) menu drawn from widget top corner. DPI is handled

mousePressEvent(event)

mouseClick emit

Checks to see if a menu exists on the current clicked mouse button, if not, use the original Qt behaviour

Parameters:

event (QEvent) – the mouse pressed event from the QLineEdit

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

Bases: Label

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

Bases: QWidget

Builds a label and a divider with options for Bold and Uppercase

Parameters:
  • text (str) – The label text

  • parent (QWidget) – The parent widget

  • margins (tuple(int)) – Margins of the layout in pixels DPI handled, (right, top, left, bottom)

  • spacing (int) – The spacing in pixels between widgets DPI handled

  • bold (bool) – Make the label bold if True

  • upper (bool) – Make the label all uppercase if True

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

Bases: LabelDivider

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

Bases: QWidget

Widget which contains a horizontal layout with an icon and a label

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

Bases: QLabel

For CSS Purposes

Layouts

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

Bases: QGridLayout

hBoxLayout(parent=None, margins=(0, 0, 0, 0), spacing=6)

One liner for QtWidgets.QHBoxLayout() to make it easier to create an easy Horizontal Box layout DPI (4k) is handled here Defaults use regular spacing and no margins

Parameters:
  • parent (QtWidgets.QVBoxLayout) – The parent widget for the layout

  • margins (tuple) – override the margins with this value (left, top, right, bottom)

  • spacing (int) – override the spacing with this pixel value

Return type:

QtWidgets.QHBoxLayout

vBoxLayout(parent=None, margins=(0, 0, 0, 0), spacing=6)

One liner for QtWidgets.QVBoxLayout() to make it easier to create an easy Vertical Box layout DPI (4k) is handled here Defaults use regular spacing and no margins

Parameters:
  • parent (QtWidgets.QVBoxLayout) – The parent widget for the layout

  • margins (tuple) – override the margins with this value (left, top, right, bottom)

  • spacing (int) – override the spacing with this pixel value

Return type:

QtWidgets.QVBoxLayout

vGraphicsLinearLayout(parent=None, margins=(0, 0, 0, 0), spacing=0, orientation=MockExt.QtCore.Qt.Vertical)
hGraphicsLinearLayout(parent=None, margins=(0, 0, 0, 0), spacing=0, orientation=MockExt.QtCore.Qt.Horizontal)
formLayout(parent=None, margins=(0, 0, 0, 0), spacing=6)

Listview

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

Bases: QListView

contextMenuRequested

alias of list

setSupportsRightClick(state)

Sets whether this list view should support a right click context menu.

Parameters:

state (bool) – If True then A right click menu will be created and contextMenuRequested signal will be emitted.

closestIndex(pos)

Get the closest index based on pos

Parameters:

pos (QtCore.QPoint) –

Returns:

Return type:

QtCore.QModelIndex

visibleIndices(pre=0, post=0)

Gets visible items

Set extra to 1 or more if you want extra indices at the beginning and at the end. It will only return valid indices.

Parameters:
  • pre (int) – Add extra items behind the currently visible items

  • post (int) – Add extra items after the currently visible items

Returns:

List of indices that are visible plus the pre and post. It only returns valid indices

Return type:

list of QtCore.QModelIndex

Logoutput

shiftColor(c1, c1Strength, c2, c2Strength)
class OutputLogDialog(*args: Any, **kwargs: Any)

Bases: QPlainTextEdit

Output text edit

::example:

wid = OutputLogDialog(“MyLogWindow”) wid.show() wid.logInfo(“helloworld”) wid.logDebug(“helloworld”) wid.logWarning(“helloworld”) wid.logError(“helloworld”) wid.logCritical(“helloworld”)

debugColor = '#f4f4f4'
warningColor = '#ffe700'
errorColor = '#CC0000'
criticalColor = '#CC0000'
createLayout()

Sets up the layout for the dialog.

logInfo(msg)
logDebug(msg)
logWarning(msg)
logError(msg)
logCritical(msg)
keyEvent(event)
write(msg, color=MockExt.QtGui.QColor)
factoryLog(msg, level)
wheelEvent(event)

Handles zoom in/out of the text.

zoom(direction)

Zoom in on the text.

class QWidgetHandler

Bases: Handler

Custom Qt Logging Handler for Sending Messages to child Widgets

addWidget(widget)
removeWidget(widget)
clearWidgets()
emit(record)

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

Mainwindow

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

Bases: QMainWindow

restoreWindowSize = False
center()

Centers to center of desktop

Returns:

window()
Returns:

Return type:

MainWindow

addCustomStatusBar()
setupMenuBar()
setCustomCentralWidget(widget)
createDock(mainWidget, area=MockExt.QtCore.Qt.LeftDockWidgetArea, tabify=True)
addDockWidget(area, dockWidget, orientation=MockExt.QtCore.Qt.Horizontal, tabify=True)

Adds a dock widget to the current window at the specified location, if the location already has a

Parameters:
  • area – QtCore.Qt.DockWidgetArea

  • dockWidget – QtWidgets.QDockWidget

  • orientation – QtCore.Qt.Orientation

findDock(dockName)

Returns the dock widget based on the object name passed in as the argument

Parameters:

dockName – str, the objectName to find, docks must be

Returns:

QDockWidget

toggleMaximized()

Toggles the maximized window state

Returns:

closeEvent(ev)

Saves the window state on the close event

Parameters:

ev

Returns:

reapplySettings()

Read window attributes from settings,

using current attributes as defaults (if settings not exist.)

Called at QMainWindow initialization, before show().

Returns:

helpAbout(copyrightDate, about, version=1.0)

This is a helper method for easily adding a generic help messageBox to self Creates an about MessageBox :param copyrightDate : string , the copyright date for the tool :param about : string, the about information

Messagebox

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

Bases: QMessageBox

applyStyleSheet()

Overlay

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

Bases: Dialog

widgetMousePress

alias of object

widgetMouseMove

alias of object

widgetMouseRelease

alias of object

pressed = False
initUi()
setDebugMode(debug)

Debug mode to show where the dialog window is. Turns the window a transparent red

Parameters:

debug (bool) –

Returns:

Return type:

update()

Update geometry to match the parents geometry

Returns:

mousePressEvent(event)

Send events back down to parent

Parameters:

event

Returns:

enterEvent(event)

On mouse enter, check if it is pressed

Parameters:

event

Returns:

mouseMoveEvent(event)

Send events back down to parent

Parameters:

event

Returns:

keyReleaseEvent(event)
mouseReleaseEvent(event)

Send events back down to parent

Parameters:

event

Returns:

show(*args, **kwargs)

Pathwidget

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

Bases: QWidget

pathAdded

alias of object

pathRemoved

alias of str

pathChanged

alias of object

aliasChanged

alias of object

addPathClicked(path=None)

Add path clicked button

Parameters:

path

Returns:

addPath(path=None, alias=None)

Add path widget

Parameters:
  • path (str) –

  • alias

Returns:

paths()

Return all the paths from the widgets

Returns:

clear(emit=True)

Clear out the widgets and paths

Returns:

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

Bases: QWidget

pathChanged

alias of str

aliasChanged

alias of str

setSearchFilter(searchFilter)
path()
Returns:

alias()
Returns:

openPathFolder()

Opens an os window for browsing files on disk in the users operating system

onPathBrowseClicked()

Browse button clicked

Returns:

setPathText(path)

Set the path text. Also generate an edit if need be

Parameters:

path

Returns:

setAliasText(alias)
class PathOpenWidget(*args: Any, **kwargs: Any)

Bases: PathWidget

onPathBrowseClicked()

Browse button clicked

Returns:

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

Bases: PathWidget

onPathBrowseClicked()

Browse button clicked

Returns:

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

Bases: DirectoryPathWidget

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

Bases: DirectoryPathListWidget

data()
Returns:

Return type:

list[DirectoryPath]

factoryResetClicked()
addByDirectoryPath(directoryPath)
Parameters:

directoryPath (zoo.core.tooldata.tooldata.DirectoryPath) –

Returns:

addPath(path=None, alias=None)
Parameters:
  • path

  • alias

Returns:

Return type:

BrowserPathWidget

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

Bases: DirectoryPathRemoveWidget

setData(directoryPath)
Parameters:

directoryPath (zoo.core.tooldata.tooldata.DirectoryPath) –

Returns:

data()
Returns:

Return type:

zoo.core.tooldata.tooldata.DirectoryPath

Popups

FileDialog_directory(windowName='', parent=None, defaultPath='')

simple function for QFileDialog.getExistingDirectory, a window popup that searches for a directory

Browses for a directory with a fileDialog window and returns the selected directory

Parameters:
  • windowName (str) – The name of the fileDialog window

  • parent (QtWidgets.QWidget) – The parent widget

  • defaultPath (str) – The default directory path, where to open the fileDialog window

Return directoryPath:

The selected full directory path

Rtype directoryPath:

str

generateName(name)

Generate name

Parameters:

name

Returns:

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

Bases: ZooWindowThin

Warning = 'Warning'
Question = 'Question'
Info = 'Info'
Critical = 'Critical'
NoIcon = 'NoIcon'
okIcon = 'checkMark'
cancelIcon = 'xCircleMark'
keyPressEvent(event)

keyPress event

Parameters:

event

Returns:

classmethod calcLabelHeight(text, label)
Parameters:
  • text

  • label (QtWidgets.QLabel) –

Returns:

Return type:

classmethod horizontalAdvance(fm, c)

Horizontal advance doesn’t exist in 2018. eg older versions of PySide2

Parameters:
  • fm

  • c

Returns:

close(result=None)

Close window

Returns:

Return type:

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

Bases: MessageBoxBase

classmethod showQuestion(parent=None, title='', message='', buttonA='Continue', buttonB='Cancel', buttonC=None, buttonIconA='checkMark', buttonIconB='xCircleMark', buttonIconC=None, icon='Question', default=0)
classmethod showWarning(parent=None, title='', message='', buttonA='OK', buttonB='Cancel', buttonC=None, icon='Warning', default=0)
classmethod showCritical(parent=None, title='', message='', buttonA='OK', buttonB='Cancel', buttonC=None, icon='Critical', default=0)
classmethod showOK(title='Confirm', parent=None, message='Proceed', icon='Question', default=0, buttonA='OK', buttonB='Cancel', buttonC=None)

Simple function for ok/cancel QMessageBox.question, a window popup that with ok/cancel buttons

Parameters:
  • title (str) – The name of the ok/cancel window

  • parent (Qt.widget) – The parent widget

  • message (str) – The message to ask the user

Return okPressed:

True if the Ok button was pressed, False if cancelled

Rtype okPressed:

bool

classmethod showSave(title='Confirm', parent=None, message='Proceed?', showDiscard=True, default=0)

Simple function for save/don’t save/cancel QMessageBox.question, a window popup with buttons

Can have two or three buttons:

showDiscard True: Save, Discard, Cancel showDiscard False: Save, Cancel

Parameters:
  • title (str) – The name of the ok/cancel window

  • parent (Qt.widget) – The parent widget

  • message (str) – The message to ask the user

Return buttonClicked:

“cancel”, “save”, or “discard”

Rtype buttonClicked:

str

classmethod showMultiChoice(title='Confirm', parent=None, message='Proceed?', choices=None, showDiscard=False, default=0, buttonB='Discard', buttonC='Cancel')

A message box with multiple choice. Also has ok, cancel buttons.

MessageBox.showMultiChoice( title=”Existing shader found”,

message=”Shader with the name name ‘{}’ found.”.format(shader), choices=[“Replace Shader”,”Assign Existing”, “Create New Shader”], buttonB=”Cancel”)

Can have the following return results:

# (0, “Replace Shader”) # (1, “Assign Existing”) # (2, “Create New Shader”) # (-1, “cancel”)

Can have two or three buttons:

showDiscard True: Save, Discard, Cancel showDiscard False: Save, Cancel

classmethod showCombo(title='Confirm', parent=None, message='Proceed?', items=None, data=None, icon=None, defaultItem=None, showDiscard=False, default=0, buttonA='OK', buttonB='Discard', buttonC='Cancel', buttonIconA='checkMark', buttonIconB='xCircleMark', buttonIconC=None)

A message box with multiple choice. Also has ok, cancel buttons.

MessageBox.showCombo( title=”Existing shader found”,

message=”Shader with the name name ‘{}’ found.”.format(shader), items=[“Replace Shader”,”Assign Existing”, “Create New Shader”], buttonB=”Cancel”)

Can have the following return results:

# (0, “Replace Shader”, <object>) # (1, “Assign Existing”, <object>) # (2, “Create New Shader”, <object>) # (-1, “cancel”, <object>)

Where object is an element from data

Can have two or three buttons:

showDiscard True: Save, Discard, Cancel showDiscard False: Save, Cancel

classmethod showCustom(customWidget, title='Confirm', parent=None, message='Proceed', icon='Question', default=0, buttonA='OK', buttonB='Cancel', buttonC=None)

Simple function for ok/cancel QMessageBox.question, a window popup that with ok/cancel buttons

Parameters:
  • title (str) – The name of the ok/cancel window

  • parent (Qt.widget) – The parent widget

  • message (str) – The message to ask the user

Return okPressed:

True if the Ok button was pressed, False if cancelled

Rtype okPressed:

bool

classmethod inputDialog(parent=None, title='Input', message='Input:', text='', buttonA='OK', buttonB='Cancel', buttonC=None, buttonIconC=None, icon=None)

Show the input dialog

Parameters:
  • parent

  • title

  • message

  • buttonA

  • buttonB

  • text

  • icon

Returns:

Returns None if cancelled.

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

Bases: MessageBoxBase

inputText()

Get the input text

Returns:

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

Bases: MessageBoxBase

selectedItem()

Get the choice

Returns:

selectedData()
class CustomDialog(*args: Any, **kwargs: Any)

Bases: MessageBoxBase

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

Bases: MessageBoxBase

choice()

Get the choice

Returns:

class MessageBoxQt

Bases: object

classmethod showQuestion(parent, windowName, message, buttonA='Continue', buttonB='Cancel', buttonC=None, icon='Question')

Simple function for a dialog window with two or three buttons with changeable button names.

buttonC=None will not show the third button.

Icons are “NoIcon”, “Warning”, “Question”, “Information” or “Critical”

Returns strings “A”, “B” or “C” depending on the button pressed.

Parameters:
  • parent (object) – The parent widget, can leave as None and will parent to Maya

  • windowName (str) – The name title of the window

  • message (str) – The message/question as presented to the user inside the window

  • buttonA (str) – The string name of the first button

  • buttonB (str) – The string name of the second button

  • buttonC (str) – The string name of the third (optional) button, if None is ignored

Return buttonPressed:

The button pressed, either “A”, “B” or “C”

Rtype buttonPressed:

str

classmethod showOK(windowName='Confirm', parent=None, message='Proceed?', okButton=MockExt.QtWidgets.QMessageBox.Ok)

Simple function for ok/cancel QMessageBox.question, a window popup that with ok/cancel buttons

Parameters:
  • windowName (str) – The name of the ok/cancel window

  • parent (Qt.widget) – The parent widget

  • message (str) – The message to ask the user

Return okPressed:

True if the Ok button was pressed, False if cancelled

Rtype okPressed:

bool

classmethod showSave(windowName='Confirm', parent=None, message='Proceed?', showDiscard=True)

Simple function for save/don’t save/cancel QMessageBox.question, a window popup with buttons

Can have two or three buttons:

showDiscard True: Save, Discard, Cancel showDiscard False: Save, Cancel

Parameters:
  • windowName (str) – The name of the ok/cancel window

  • parent (Qt.widget) – The parent widget

  • message (str) – The message to ask the user

Return buttonClicked:

“cancel”, “save”, or “discard”

Rtype buttonClicked:

str

InputDialogQt(windowName='Add Name', textValue='', parent=None, message='Rename?', windowWidth=270, windowHeight=100)

Opens a simple QT window that locks the program asking the user to input a string into a text box

Useful for renaming etc.

Parameters:
  • windowName (str) – The name of the ok/cancel window

  • textValue (str) – The initial text in the textbox, eg. The name to be renamed

  • parent (Qt.widget) – The parent widget

  • message (str) – The message to ask the user

Return newTextValue:

The new text name entered

Rtype newTextValue:

str

SaveDialog(directory, fileExtension='', nameFilters='', parent=None)

Opens a Qt save window with options for saving a file.

Returns the path of the file to be created, or “” if the cancel button was clicked.

Also see MessageBox.showSave() which has the option for saving the current scene. With save, cancel or discard.

Parameters:
  • directory (str) – The path of the directory to default when the dialog window appears.

  • fileExtension (str) – Optional fileExtension eg “.zooScene”.

  • nameFilters (list[str]) – Optional list of filters, example [“ZOOSCENE (*.zooScene)”].

Returns:

The fullPath of the file to be saved, else “” if cancelled.

Return type:

str

Pushbutton

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

Bases: QPushButton

contextMenuRequested

alias of object

contextMenu(position)

Radiobuttongroup

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

Bases: QWidget

Creates a horizontal group of radio buttons

Build widget example:
self.radioWidget = elements.RadioButtonGroup(radioList=radioNameList, toolTipList=radioToolTipList,

default=0, parent=parent)

Query the checked selection example:

nameChecked = radioWidget.getChecked().text() # returns the text name of the checked item numberChecked = radioWidget.getCheckedIndex() # returns the list number of the checked item

Return Selection Changed example:

radioWidget.toggled.connect(self.doSomething)

toggled

alias of int

checked()

Returns the widget that is checked.

Returns:

The widget that is checked

Return type:

QtWidgets.QRadioButton()

checkedIndex()

Returns the widget number that is checked

Returns:

the widget list number that is checked

Return type:

int

setChecked(index)

Checks the radio button at index.

Parameters:

index (int) – The radio button index within the group.

Resizerwidget

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

Bases: QFrame, DPIScaling

A Layout widget which allows you to flexibly hide widgets.

LeftToRight = 1
RightToLeft = -1
TopToBottom = 2
BottomToTop = -2
Parallel = 1
Reverse = -1
Inwards = 0
Outwards = 1
RightPad = 1
Open = 0
Closed = 1
setLayoutDirection(direction)

Layout Direction of the added widgets

Parameters:

direction (ResizerWidget.LeftToRight or ResizerWidget.RightToLeft or ResizerWidget.TopToBottom or ResizerWidget.BottomToTop) – The direction of the widgets

Returns:

addWidget(wgt, target=True, external=False, defaultHidden=False, initialSize=None)

Add a widget to the ResizerWidget layout.

Parameters:
  • wgt (QtWidgets.QWidget) – The widget to add

  • target – Set the wgt as a target for the button to attach itself to. True on default

  • external (bool) – If the widget is an external widget or not. This allows for behaviours that may require a widget that is outside of the ResizerWidget (in a separate QSplitter for instance)

  • defaultHidden (bool) – If the widget starts off hidden,

  • initialSize – Initial size, if none it will use the objects sizeHint

Returns:

setTarget(target)

Set the target widget that the arrow button will attach itself to

Parameters:

target (QtWidgets.QWidget) –

Returns:

setButtonAlign(align)
Parameters:

align

Returns:

setButtonOffset(offset)

The button offset from the aligned position

Parameters:

offset (QtCore.QPoint) – The button offset

Returns:

setFixedWidth(width)

DpiScaling version of set fixed width

Parameters:

width

Returns:

setCollapseDirection(collapseDirection)

Set the collapse direction of how the widgets will be hidden when toggled.

The way the widgets collapse on ResizerButton clicked can be set with init() param collapseDirection or setCollapseDirection(). It takes ResizerWidget.Parallel or Reverse. Reverse means widgets will hide from the last widget first. Parallel means the widget will hide in the order they are added.

Parameters:

collapseDirection (ResizerWidget.Parallel or ResizerWidget.Reverse) – Collapse direction

Returns:

target()

The resizer button target. The target is what the button is attached to.

Returns:

Return type:

QtWidgets.QWidget

setWidgetVisible(wgt, visible, resize=True, force=False)

Set the widget visibility. Also set any settings plus resize the window if need be.

Parameters:
  • wgt (QtWidgets.QWidget) – Wgt to resize

  • visible (bool) – Widget visibility

  • resize (bool) – Resize the window

  • force (bool) – Force visibility set. It will usually just pass through if you try to set the visibility off and it is already invisible. But there are cases where you need it to set the settings or resize.

Returns:

toggleWidget(widget=None)

Toggles the widget and resizes the window

Parameters:

widget – List of widgets to toggle

Returns:

hideAllWidgets()
showAllWidgets(ignoreDefaultHidden=False)

Show all the widgets in the ResizerWidget

Parameters:

ignoreDefaultHidden (bool) – Ignore default hidden widgets and show everything

Returns:

widgets()

Returns the widgets reversed depending on direction

Returns:

Return type:

setArrowDirectionFromLayout(flip=False)

Set Arrow direction based on layout direction and if the window opens outwards or inwards

Returns:

edgeToCollapse()

Get the edge to collapse based on the collapseDirection and the layout direction

todo: maybe we should have a function for each condition? def isLeftToRightLayout(self): *

Returns:

widgetsHidden()

Return true if ALL widgets are hidden, false otherwise

Returns:

setWindowGeometry(geo, wgt=None)

Set the window Geometry

Plus any other resizes that we need to do after

Parameters:
  • geo – New window geo

  • wgt – handle to the widget that might need updating

  • initial

Returns:

restoreSplitterPositions(splitter, positions, exclude=-1)

Restore splitter positions based on a list of positions

Parameters:
  • splitter (QtWidgets.QSplitter) – Splitter

  • positions (list of int) –

  • exclude (int) – Exclude any indices

Returns:

updateButtonPosition()

Update button position

Returns:

resizeEvent(*args, **kwargs)

Update the ResizerButton position on resize

Parameters:
  • args

  • kwargs

Returns:

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

Bases: FloatingButton

arrowColor = (0, 0, 0)
setOffsetPos(offsets)
setTarget(target)

Set target to attach itself to

Parameters:

target (QtWidgets.QWidget) – Target widget

Returns:

initUi()

Init Ui

Returns:

initIcons()

Initialize icons by setting icon size

Returns:

setAlignmentPosition(align)

Sets the positional alignment of the resizer button.

eg QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop

Parameters:

align – The positional alignment the resizer button in comparison to the parent.

Returns:

setArrowDirection(direction)

Set the icon arrow direction

Parameters:

direction (QtCore.Qt.LeftArrow | QtCore.Qt.RightArrow | QtCore.Qt.UpArrow | QtCore.Qt.DownArrow) – Direction to set the arrow to

Returns:

setIconSize(iconSize)

Set Icon size of the arrow

Parameters:

iconSize

Returns:

flipArrowDirection()

Flip the visual arrow direction

Returns:

setRoundedEdge(edge)

Set edge that will be rounded

Parameters:

edge (QtCore.Qt.LeftEdge | QtCore.Qt.TopEdge | QtCore.Qt.RightEdge | QtCore.Qt.BottomEdge) – QtCore.Qt.LeftEdge, QtCore.Qt.TopEdge, QtCore.Qt.RightEdge,QtCore.Qt.BottomEdge

Returns:

resize(width, height)
setStyle()

Round the edges with Stylesheets

Returns:

updateTheme(event)

Update the theme

Returns:

Return type:

updatePosition()

Update position of button based on target and alignment

Returns:

Roundbutton

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

Bases: QPushButton, DPIScaling

A nice rounded button. Two methods to rendering it out currently. You can use this like a QPushButton

Mask: Mask will cut the button into a circle. It also allows for custom stylesheets. The downside though is that it is pixelated when drawing it out.

roundBtn = RoundButton(self, "Hello World", method=Method.Mask)
roundBtn.setMethod(Method.Mask)  # Use this if you want to set it after

Stylesheet: Style sheet creates a smooth circle button, no pixelation. However for rectangle buttons, it wont be round and the user wont be able to use their own stylesheet.

roundBtn = RoundButton(self, "Hello World", method=Method.StyleSheet)
roundBtn.setMethod(Method.StyleSheet)  # Use this if you want to set it after
roundBtn.setFixedSize(QtCore.QSize(24,24))  # Square dimensions recommended
setMethod(method=0)

Set the method of rendering, Method.Mask or Method.StyleSheet

StyleSheet:
  • Can’t have own stylesheet

  • Smooth Rendering

Mask:
  • Pixelated edges

  • Can set custom stylesheet

Parameters:

method (int) – Method.Mask or Method.StyleSheet

Returns:

resizeEvent(event)

Resize and update based on the method

Returns:

updateButton()
roundStyle()

Style for round button

Returns:

setStyleSheet(text)

Set stylesheet for button

Parameters:

text

Returns:

Screengrabber

qt based screen grab transparent dialog, main mission here to allow the client to select a section of their screen using a rectangle which can be saved to a image file of their choosing.

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

Bases: QDialog

property cropColor
getOpacity()
setOpacity(value)
opacity

alias of int

fitScreenGeometry()
paintEvent(event)
mousePressEvent(event)
mouseReleaseEvent(event)
mouseMoveEvent(event)
showEvent(event)

Searchwidget

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

Bases: QToolButton

For css purposes only

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

Bases: QToolButton

For css purposes only

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

Bases: QLineEdit, DPIScaling

Search Widget with two icons one on either side, inherits from QLineEdit

Parameters:
  • searchPixmap

  • clearPixmap

  • parent

  • iconsEnabled

initUi()

Init UI

Returns:

Return type:

focusInEvent(event)
Parameters:

event (Qt.QtGui.QFocusEvent) –

Returns:

Return type:

setBackgroundColor(col)
setIconsEnabled(enabled)
updateTheme(event)

Update the theme

Returns:

Return type:

updateStyleSheet()
resizeEvent(event)
updateCloseButton(text)

Slider

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

Bases: QSlider

initUi()

Init ui

Returns:

Return type:

updateSliderAccuracy()

Set the slider accuracy if int

Returns:

Return type:

enterEvent(event)
styleLeaveCheck()

Hide the sub-page when value is 0 since it doesn’t get hidden

sliderActive()
leaveEvent(event)
value()

Sliders are in ints so do the math to figure the correct user value and return the expected float

Internally the slider is an int in the range of 0 - self.sliderAccuracy (int) Convert this to a float value within the correct self.floatMax - self.floatMin

Overridden method

Return floatValue:

The value of the slider as a float the user expects, not slider raw value which is an int

Rtype floatValue:

float

setValue(floatValue)

Sets the value of a slider as a float in a user friendly value. Value range self.floatMax - self.floatMin

Overridden method

Parameters:

floatValue (float) – The value the user will user, in range of self.floatMin - self.floatMax

setSliderPosition(floatValue)

Pass in a float value within the range self.floatMax - self.floatMin

Convert it to the int which the Qt slider expects within 0 - self.sliderAccuracy (int)

Overridden method

setMinimum(minValue)

Sets the minimum value of the slider as a float that the user expects Overridden method

Parameters:

minValue (float) – The minimum value of the slider as the user expects in float range

setMaximum(maxValue)

Sets the maximum value of the slider as a float that the user expects Overridden method

Parameters:

maxValue (float) – The maximum value of the slider as the user expects in float range

setRange(minValue, maxValue)

Sets the minimum and maximum range of the slider with float values that the user expects Qt sliders use integers and so this needs to be converted.

Overridden method

Parameters:
  • minValue (float) – The minimum value of the slider as the user expects in float range

  • maxValue (float) – The maximum value of the slider as the user expects in float range

setSuperRange(minValue, maxValue)
class HSlider(*args: Any, **kwargs: Any)

Bases: Slider

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

Bases: Slider

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

Bases: QWidget

textChanged

alias of str

textModified

alias of str

initUi()

To be overridden

Returns:

Return type:

updateRanges(value)

Update ranges based on the value, if dynamicMax or dynamicMin is True

Parameters:

value

Returns:

Return type:

blockSignals(state)

Blocks the widget

Parameters:

state (bool) – True will block signals to the widget

setDisabled(state)

Disables or enables the widget/s

Parameters:

state (bool) – If True will disable, if False will enable

value()

Gets the current value of the slider as a float

setValue(value)

Sets the current slider and text box value with a float, quiet no emits

Parameters:

value (float) – The value to set the slider and lineEdit to

text()

Gets the current value of the slider as a float

setText(text)

Gets the current value of the slider as a float

setLabel(labelName)

Changes the label text

label()

Gets the label text (name)

Return labelText:

The name of the label

Rtype labelText:

str

uiConnections()
class FloatSlider(*args: Any, **kwargs: Any)

Bases: NumSlider

initUi()

To be overridden

Returns:

Return type:

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

Bases: NumSlider

value()

Return value as int

Returns:

Return type:

int

Sliderspinbox

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

Bases: QWidget

docstring for SpinboxSlider

valueChanged

alias of int

onUpdate(widget, value)
setRange(min_, max_)

Slidingwidget

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

Bases: QWidget

setSlidingActive(state)
clearedFocus()
setTimeoutActive(active)
setSlideDirection(direction=MockExt.QtCore.Qt.RightToLeft)
Parameters:

direction (QtCore.Qt.RightToLeft or QtCore.Qt.LeftToRight) –

Returns:

setDuration(duration)

Duration of animation

Parameters:

duration (int) – Time in milliseconds

Returns:

setWidgets(primary, secondary)

Set the widgets of the primary and secondary widget

Parameters:
  • primary (QtWidgets.QWidget) – Primary widget is the one that will expand when clicked.

  • secondary (QtWidgets.QWidget) – Secondary will be be hidden when primary widget is focused

Returns:

widgetKeyPressEvent(event)
updateInitial()

Set up the initial stretch

Returns:

setSlideStretch(value)

Set the stretch for the mainlayout widgets.

Usually used in the QPropertyAnimation

Parameters:

value

Returns:

getSlideStretch()

The current slide stretch

Returns:

slideStretch

alias of int

widgetFocusIn(event)

Expand the primary widget event

Parameters:

event (Qt.QtGui.QFocusEvent) –

Returns:

widgetFocusOut(event=None)

Collapse the primary widget event

Parameters:

event

Returns:

animate(expand=True)

Animate the sliding of the widget

Parameters:

expand

Returns:

Spacer

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

Bases: QLabel

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

Bases: QFrame

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

Bases: QFrame

Spacer(width, height, hMin=MockExt.QtWidgets.QSizePolicy.Minimum, vMin=MockExt.QtWidgets.QSizePolicy.Minimum)

creates an expanding spacer (empty area) with easy options. DPI auto handled

Size Policies are https://srinikom.github.io/pyside-docs/PySide/QtGui/QSizePolicy.html#PySide.QtGui.PySide.QtGui.QSizePolicy.Policy #. QtWidgets.QSizePolicy.Fixed - never grows or shrinks #. QtWidgets.QSizePolicy.Minimum - no advantage being larger #. QtWidgets.QSizePolicy.Maximum - no advantage being smaller #. QtWidgets.QSizePolicy.Preferred - The sizeHint() is best, but the widget can be shrunk/expanded #. QtWidgets.QSizePolicy.Expanding - but the widget can be shrunk or make use of extra space #. QtWidgets.QSizePolicy.MinimumExpanding - The sizeHint() is minimal, and sufficient #. QtWidgets.QSizePolicy.Ignored - The sizeHint() is ignored. Will get as much space as possible

Parameters:
  • width (int) – width of the spacer in pixels, DPI is auto handled

  • height (int) – height of the spacer in pixels, DPI is auto handled

  • hMin (PySide.QtGui.QSizePolicy.Policy) – height of the spacer in pixels, DPI is auto handled

  • vMin (PySide.QtGui.QSizePolicy.Policy) – vertical minimum

Return spacerItem:

item returned, ie the spacerItem

Rtype spacerItem:

object

Spinner

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

Bases: QWidget

Classic widget which spins in a circle, useful for when loading operations happen

paintEvent(event)
showEvent(event)

Called when the widget is being shown

hideEvent(event)

Called when the widget is being hidden

closeEvent(event)

Called when the widget is being closed - ensures the timer is stopped to avoid unnecessary painting

onTimerOut()

Triggered when the timer times out and used to trigger a repaint of the widget.

Stackwidget

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

Bases: QWidget

The overall layout widget. The table underneath (self.stackTableWgt) holds all the stack items.

StackWidget is the overall view, StackTableWidget is the actual widget that holds the StackItems themselves.

initUi()
connections()

Connections for the buttons and the search edit :return:

collapseClicked()

Collapse all the StackItems in the Table

expandClicked()

Expand all the StackItems in the Table

onStackSearchChanged()

Filter the results based on the text inputted into the search bar

clearStack()

Clear all the items in the stack

addStackItem(item)

Add item to the StackTableWidget

Parameters:

item – StackItem to add to the table

replaceStackItems(items)

Clear all items and replace it with the items

Parameters:

items – List of items to add to the stack table

clearSearchEdit()

Clear the search bar

shiftItem(wgt, dir)

Shift the item up or down in the table

Parameters:
  • wgt – The StackItem to shift

  • dir – The direction to shift -1 is upwards, 1 is downwards

deleteItem(wgt)

Delete the stack item from the table

Parameters:

wgt

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

Bases: QFrame

Css Reasons

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

Bases: QTableWidget

The Table with the actual stack and items. Maybe should merge with StackWidget

initUi()
shiftTableItem(wgt, dir)
collapseAll()
expandAll()
deleteTableItem(wgt)
addStackItem(item)
addRow(stackItem)
getRow(stackItem)
filter(text)
getStackItems()
updateSize(widget=None)

Updates the size based on the widget who sent the request. Can be forced by setting the widget parameter

Parameters:

widget – None or QtWidgets.QWidget

clearStack()
sceneRefresh()
class StackItem(*args: Any, **kwargs: Any)

Bases: QFrame

toggleExpandRequested

alias of bool

setArrowsVisible(visible)

Set the shift arrows to be visible or not. These arrows allow the StackItem to be shifted upwards or downwards.

Parameters:

visible – bool

property contentsLayout
titleTextWidget()
showExpandIndicator(vis)
setTitleTextMouseTransparent(trans)
initUi()
setItemIconColor(col)
setItemIcon(name)
shiftUp()
shiftDown()
addWidget(widget)
addLayout(layout)
buildHiderWidget()

Builds widget that is collapsable Widget can be toggled so it’s a container for the layout

onCollapsed(emit=True)

Collapse and hide the item contents

onExpand(emit=True)

Expand the contents and show all the widget data

expand(emit=True)

Extra Code for convenience

collapse(emit=True)

Extra Code for convenience

toggleContents(emit=True)

Shows and hides the widget self.widgetHider this contains the layout self.hiderLayout which will hold the custom contents that the user specifies

setComboToText(combobox, text)

Find the text in the combobox and sets it to active.

Parameters:
  • combobox

  • text (str) –

updateSize()

Update the size of the widget. Usually called by collapse or expand for when the widget contents are hidden or shown.

getTitle()

Get method for the title text

setTitle(text)

Set method to get the title text

Parameters:

text

setFrameColor(color)
connections()
class StackTitleFrame(*args: Any, **kwargs: Any)

Bases: QFrame, DPIScaling

toggleExpandRequested

alias of bool

mouseDoubleClickEvent(event)
shiftUp()
shiftDown()
initUi()

Builds the title part of the layout with a QFrame widget

setDeleteButtonIcon(name)
collapse()
expand()
connections()

Connections for stack items

selectCheck()

Stops any selection from happening if title is not editable

Returns:

Return type:

titleValidate()

Removes invalid characters and replaces spaces with underscores

setItemIconColor(col)
setItemIcon(name)
class LineClickEdit(*args: Any, **kwargs: Any)

Bases: QLineEdit

editFinished()
editEvent(event)
setText(text)
focusOutEvent(e)
mouseClickPassThrough(event)
mousePressEvent(event)
mouseReleaseEvent(event)

Stringedit

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

Bases: QWidget

property textModified

Maya style update, on return and switching out of the text box use for GUIs

Returns:

property editingFinished
property textChanged
property returnPressed
property mousePressed
property mouseMoved
property mouseReleased
connections()

Connects the buttons and text changed emit

Returns:

Return type:

text()

Get the text from the edit

Returns:

selectAll()

Select all in the edit

Returns:

Return type:

setPlaceHolderText(text)

Set the placeholder text

Parameters:

text (str) –

Returns:

Return type:

setValue(value)

Set the value

Parameters:

value

Returns:

Return type:

value()

Get the edit value

Returns:

Return type:

setDisabled(state)

Disable the text (make it grey)

setText(value)

Change the text at any time

setLabel(label)

Set the text for the label widget

setFocus()

Set the focus of the edit

Returns:

Return type:

setLabelFixedWidth(width)

Set the fixed width of the label

setTxtFixedWidth(width)

Set the fixed width of the lineEdit

clearFocus()

Clear the focus of the edit

Returns:

Return type:

blockSignals(b)

Block signals properly

Parameters:

b

Returns:

Return type:

setValidator(v)

Set validator

Parameters:

v (Qt.QtGui.QValidator) –

Returns:

Return type:

update(*args, **kwargs)
setMenu(menu, modeList=None, mouseButton=MockExt.QtCore.Qt.RightButton)

Add the left/middle/right click menu by passing in a QMenu

If a modeList is passed in then create/reset the menu to the modeList:

[(“icon1”, “menuName1”), (“icon2”, “menuName2”)]

If no modelist the menu won’t change

Parameters:
  • menu (QtWidgets.QMenu) – the Qt menu to show on middle click

  • modeList (list(tuple(str))) – a list of menu modes (tuples) eg [(“icon1”, “menuName1”), (“icon2”, “menuName2”)]

  • mouseButton (QtCore.Qt.ButtonClick) – the mouse button clicked QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MiddleButton

addActionList(modes, mouseButton=MockExt.QtCore.Qt.RightButton)

resets the appropriate mouse click menu with the incoming modes

modeList: [(“icon1”, “menuName1”), (“icon2”, “menuName2”), (“icon3”, “menuName3”)]

resets the lists and menus:

self.menuiconstantsonList: [“icon1”, “icon2”, “icon3”] self.menuiconstantsonList: [“menuName1”, “menuName2”, “menuName3”]

Parameters:
  • modes (list(tuple(str))) – a list of menu modes (tuples) eg [(“icon1”, “menuName1”), (“icon2”, “menuName2”)]

  • mouseButton (QtCore.Qt.ButtonClick) – the mouse button clicked QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MiddleButton

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

Bases: StringEdit

setMinValue(val)

Set Min Value

Parameters:

val

Returns:

Return type:

setMaxValue(val)

Set Max Value

Parameters:

val

Returns:

Return type:

property sliderStarted

Signal that gets fired when the slider is started

Returns:

property sliderFinished

Signal that gets fired when the slider is finished

Returns:

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

Bases: StringEdit

connections()

Connects the buttons and text changed emit

Returns:

Return type:

setMinValue(val)

Set Min Value

Parameters:

val

Returns:

Return type:

setMaxValue(val)

Set Max Value

Parameters:

val

Returns:

Return type:

property sliderStarted
property sliderFinished
property sliderChanged

Tableview

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

Bases: QTableView

Textedit

heightForWidth(textEdit, width)
lineCountToWidgetHeight(textEdit, num_lines)

Returns the number of pixels corresponding to the height of specified number of lines in the default font.

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

Bases: QTextEdit

documentMargins()
setDocumentMargins(top, right, bottom, left)
heightForWidth(width)
lineCountToWidgetHeight(num_lines)

Returns the number of pixels corresponding to the height of specified number of lines in the default font.

Thumbnailwidget

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

Bases: QFrame

property thumbnail
onCameraButtonClicked()
updateImage()

Togglewidgets

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

Bases: ButtonIcons

RadioButton and CheckBox inherits from this this class to set up the icons that change on mouse over, press and release. Also the icons change when the button is checked or unchecked.

class ImageRadioButton(QtWidgets.QRadioButton, Checkable):
    def __init__():
        self.initCheckables(uncheckedIconName="circle",
                checkedIconName="circleFilled",
                pressedIconName="circleFilled")

Must use initCheckables() when inherited in a subclass

toggleClicked()
initCheckables(uncheckedIconName, checkedIconName, pressedIconName)
buttonPressed()
buttonReleased()
paintEvent(e)
class RadioButton(*args: Any, **kwargs: Any)

Bases: QRadioButton, CheckableIcons

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

Bases: QCheckBox, CheckableIcons

Toolbutton

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

Bases: QToolButton

contextMenuRequested

alias of object

contextMenu(position)

Treeview

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

Bases: QTreeView

itemDoubleClicked

alias of object

mouseDoubleClickEvent(event)
expandFrom(index, expand=True)

Typehinting

Videoplayer

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

Bases: VideoPlayer

mousePressEvent(event)
class QPlayer(*args: Any, **kwargs: Any)

Bases: QWidget

initUi()
setSource(filepath)
play(filePath='')
pause()
stop()