bgdev.ui.utils

Utility fonctions for UI.

created

8/02/2018

author

Benoit GIELLY <benoit.gielly@gmail.com>

check_image(icon, normalized=True, as_icon=False)[source]

Convert the given image path to full path name.

Parameters
  • icon (str) – Name of the icon to check

  • normalized (bool) – Normalize the path to slash forward (works on all OS)

  • as_icon (bool) – Return a QIcon of the found image file.

Returns

Updated icon path so it’s ready to be used.

Return type

str

generate_qrc(path, name='resources', prefix='icons')[source]

Generate .qrc file based on given folder.

Parameters
  • path (str) – Path to icons folder.

  • name (str) – Name of the qrc file to generate. Default is “resources”.

  • prefix (str) – Name of the icon prefix. Default is “icons”.

Returns

Path to the generated [qrc].py file.

Return type

str

in_maya()[source]

Check if we are in Maya or not.

Returns

True if in maya else False

Return type

bool

main_window()[source]

Return the QMainWindow for the current application.

maya_window()[source]

Get Maya MainWindow as Qt.

Returns

Maya main window as QtObject

Return type

QtWidgets.QWidget

to_qwidget(ctrl)[source]

Convert a Maya widget to a PySide2 QWidget.

Parameters

ctrl (str) – Name of the maya widget as a string.

Returns

QWidget instance object of the given widget.

Return type

QtWidgets.QWidget