mmSolver.ui.uiutils#

User interface utilities for Qt and Qt based applications.

mmSolver.ui.uiutils.getHostApplication()#

Get the name of the application we are currently running inside of.

Supported hosts to check for are:

- 'standalone' (outside any host application)

- 'maya' (Autodesk Maya)

- 'nuke' (The Foundry Nuke)

- 'houdini' (SideFX Houdini)
Returns:

The application name, or None if the application could not be recognised.

Return type:

str or None

mmSolver.ui.uiutils.getMayaMainWindow()#

Get the Maya application QWidget window.

Note

For Maya only.

Returns:

The Maya main window, as a Qt Widget object.

Return type:

QWidget

mmSolver.ui.uiutils.findControlMayaWidget(name, clsTyp)#
mmSolver.ui.uiutils.isValidQtObject(obj)#

Does the Python object given contain a valid Qt reference pointer?

Only supports host ‘maya’.

Parameters:

obj – Qt class object.

Returns:

Is the given object valid in C++?

Return type:

bool

mmSolver.ui.uiutils.getParent()#

Get the parent Qt QApplication object.

Only supports hosts ‘standalone’ and ‘maya’.

Returns:

Qt object for the top level parent object.

mmSolver.ui.uiutils.getBaseWindow()#

Get pre-defined preset “Base Window” for the currently running host.

This function allows dynamic look-up of the intended window for all custom UIs to be built around.

Only supports hosts ‘standalone’ and ‘maya’.

Returns:

The module and class to be used.

Return type:

(module, class)

mmSolver.ui.uiutils.getFont(name=None)#

Create a Qt font, using a name containing hints/keywords.

Parameters:

name (str) – Font name to create. Can contain multiple sub-strings. Supported sub-strings are ‘normal’, ‘small’, ‘mediumlarge’, ‘large’, ‘monospace’, ‘bold’, ‘italic’.

Returns:

Qt QFont object, with names used to set the font.

Return type:

QFont

mmSolver.ui.uiutils.getIcon(path)#

Creates an Qt Icon from a resource path.

Parameters:

path (str) – Resource file path.

Returns:

Qt Icon object.

Return type:

QIcon

mmSolver.ui.uiutils.setWindowWidthHeight(ui, width_height)#

Set a window’s width and height.

Parameters:
  • ui (QWidget) – Qt Window UI to set.

  • width_height ((int, int)) – Width and height to set.

class mmSolver.ui.uiutils.QtInfoMixin#

Mix-in class to provide simple functions for checking Qt versions.

qtInitVersion()#
qtAboveVersion(major, minor, patch)#
qtEqualOrAbove_4_6_X()#
qtEqualOrAbove_4_7_X()#
qtEqualOrAbove_4_8_X()#
qtEqual_4_X_X()#
qtEqual_5_X_X()#