Can anyone tell me if it is possible to get PyQt5 for windows python 2.7 and any other advice for making this switch would be gratefully recieved.
We get the statusline in Maya to place our tool icons so they are easily accessible for users to press:
def getMayaStatusLine():
""" Get status line for adding toolbar icons """
gStatusLine = mel.eval('$temp=$gStatusLine')
ptr = apiUI.MQtUtil.findControl(gStatusLine)
if ptr is not None:
return sip.wrapinstance(long(ptr), QtWidgets.QWidget).setText("")
btn.setIcon(icon)
btn.setMinimumSize(btnSize)
btn.setMaximumSize(btnSize)
btn.setIconSize (iconSize)
btn.released.connect(callback)
statusLine.layout().addWidget(btn)
This thread: https://github.com/mottosso/Qt.py/issues/53 points me in the right direction in getting the main Maya window which is cool but not the status line.
Any tips on how to get the status line using Qt.py, I have tried the below solution as provided by Marcus replacing "MayaWindow" with "StatusLine" but it appears there are a number of QWidgets and QMenus without object names and I think Statusline is one of them
from Qt import QtWidgets app = QtWidgets.QApplication.instance() window = {o.objectName(): o for o in app.topLevelWidgets()}["MayaWindow"] channel_box = window.findChild(QtWidgets.QTableView, "mainChannelBox") channel_box.setStyleSheet("QWidget {background: green}")
def getMayaStatusLine():
gStatusLine = mel.eval('$temp=$gStatusLineForm')
ptr = apiUI.MQtUtil.findControl(gStatusLine)
print ptr
if ptr is not None:
statusLine = shiboken2.wrapInstance(long(ptr), QtWidgets.QWidget)
return statusLine.children()[1].children()[1]