Interface Utilities

artv2.utilities.interface_utilities

author:Jeremy Ernst
description:This module provides utilities for general QT functions and classes to be used as widgets or templates.
class ARTv2Dialog(width, height, window_title, parent=None)[source]

Abstract class that adds some extra default functionality for things like grabbing settings, dealing with different screen resolutions, styling the UI, and saving screen position. This class is not meant to be instantiated on its own.

class ARTv2Message(width, height, title, critical=False, warning=False, info=False, question=False, parent=None)[source]

Abstract class that adds extra functionality onto QMessageBox. Depending on the message type (warning, error, etc), different buttons and icons will be shown. This class is not meant to be instantiated on its own.

class ARTv2Window(width, height, window_title, parent=None)[source]

Abstract class that adds some extra default functionality for things like grabbing settings, dealing with different screen resolutions, styling the UI, and saving screen position. This class is not meant to be instantiated on its own.

closeEvent(event)[source]

Override QMainWindow’s close event to remember window position.

static launch_help_doc(path)[source]

Launches a html page from the artv2 help documents.

Parameters:path – The path of the html file to launch.
class ConfirmWidget(message, details, title, parent=None)[source]

Simple class that displays a QMessageBox widget with a question, a question icon, and Yes or Cancel buttons. Takes in a string message to display, a string for any detailed text to display, and a string for the title.

class ErrorWidget(message, parent=None)[source]

Simple class that displays a QMessageBox widget with an error message, and error icon, and a simple “OK” button. Takes in a string message to display.

../../../_images/errorWidget.png
class InfoWidget(message, details, parent=None)[source]

Simple class that displays a QMessageBox widget with an error message, and error icon, and a simple “OK” button. This class takes in required arguments: A string message, and a string for details. The details string could be empty if not required.

message = ui_utils.InfoWidget("this is an info widget", "these are some details\nas are these")
../../../_images/infoWidget.png
clear_layout(layout)[source]

Clears the given layout of all child widgets.

create_style_sheet(data)[source]

Take in a read stylesheet, and replace any urls with actual file paths, then return the altered data.

filter_list(list_widget, search_widget)[source]

Filters the list widget by the search term in the given search widget.

Parameters:
  • list_widget – QListWidget widget to filter items in.
  • search_widget – QLineEdit widget to grab text from for search term.
get_items(list_widget)[source]

Given a list widget, get and return the text and pointer to the list widget item in a dict.

Parameters:list_widget – List widget to query items from.
Returns:Returns a dict of the listWidgetItems’ text and pointer to the items.
get_maya_dpi()[source]

Gets the DPI setting value in Maya and returns the multiplier.

get_maya_window()[source]

Return Maya’s main window as a QWidget

get_style_sheet(file_path)[source]

Read the style sheet data, and then replace any urls with proper file paths on the user’s drive.

scale_by_dpi(value)[source]

Scales the given value by the dpi multiplier.

search_list_widget(search_field, list_widget, *args)[source]

Searches the given list_widget for items with the search term in the given search_field. Items that do not match are hidden in the list.

Parameters:
  • search_field – The QLineEdit to grab the search term from
  • list_widget – the QListWidget to manipulate
toggle_group(ctrl, args)[source]

Sets the given ctrl (groupbox) height based on the check state.