I found a good gist online for what I am after in case anyone needs it:
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]
On Friday, 27 January 2017 14:02:25 UTC+1, Benjam901 wrote:
>
> Qt.py seems to be the best option and looks to be an absolute life saver
> except for one minor detail:
>
> 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}")
>
>
> Cheers,
>
> Ben
>
> On Thursday, 26 January 2017 15:54:38 UTC+1, Benjam901 wrote:
>>
>> Cool thanks man, I am looking at the Qt stuff now it could be a real nice
>> solution to my problem :)
>>
>> On Thursday, 26 January 2017 15:27:57 UTC+1, Benjam901 wrote:
>>>
>>> Hello all, long time no post!
>>>
>>> I am migrating our studio over to Maya2017 and am having some trouble
>>> with the first hurdle of transferring from PyQt4 over to PyQt5.
>>>
>>> Firstly our studio bootstrap for Maya2015 overrides the Maya built in
>>> PySide and uses standard PyQt4 across the whole setup.
>>> I have been trying to run pip install pyqt or qt5 etc. and nothing is
>>> happening, I read on stack overflow that PyQt5 does not support python 2.7
>>> for windows?
>>>
>>> If I could replicate the PyQt4 override for Maya2017 with Qt5 that would
>>> be great although I have a feeling it won't be that easy, another problem
>>> is the entire codebase which included generic python tools use the same
>>> methods for adding items, clearing lists, creating widgets etc. If I went
>>> over to PySide2 for Maya then I would have to replicate all common methods
>>> and include PySide2 only methods which I would rather avoid.
>>>
>>> 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.
>>>
>>> Cheers,
>>>
>>> Ben
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/90e89176-e490-4f90-b658-c976220e5cc5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.