def get_maya_window(): winptr = mui.MQtUtil.mainWindow() if winptr is None: raise RuntimeError("No maya window found.") window = wrapinstance(winptr) assert isinstance(window, QtWidgets.QMainWindow) return window
def getMayaWindow(): ptr = mui.MQtUtil.mainWindow() if ptr is None: raise RuntimeError('No Maya window found.') window = wrapinstance(ptr) assert isinstance(window, QtGui.QMainWindow) return window
def get_maya_window(): """Return the QMainWindow for the main Maya window.""" winptr = OpenMayaUI.MQtUtil.mainWindow() if winptr is None: raise RuntimeError('No Maya window found.') window = wrapinstance(winptr) assert isinstance(window, QtGui.QMainWindow) return window
def uipath_to_qtobject(pathstr): """Return the QtObject for a Maya UI path to a control, layout, or menu item. Return None if no item is found. """ ptr = OpenMayaUI.MQtUtil.findControl(pathstr) if ptr is None: ptr = OpenMayaUI.MQtUtil.findLayout(pathstr) if ptr is None: ptr = OpenMayaUI.MQtUtil.findMenuItem(pathstr) if ptr is not None: return wrapinstance(ptr) return None