the docs list all commands (command/changeCommand/etc) as valid on creation and edit, but not query. And sure enough they return None when queried.
Could I get it after casting it to a QT widget?
Anyone been down this path?
the docs list all commands (command/changeCommand/etc) as valid on creation and edit, but not query. And sure enough they return None when queried.
Could I get it after casting it to a QT widget?
Anyone been down this path?
So I can’t find a way to query signal->slot connections, but I can at least add additional connections.
def stateChanged(*args):
print args
qtObj = toQtObject('window|columnLayout370|checkBox65')
qtObj.stateChanged.connect(stateChanged)
toQtObject is from nathan horne (http://nathanhorne.com/?p=451)
Is this the best I can get?
pymel has the getCommand() method on many of it’s UI elements, with a little testing, i was able to use that to return the same function object that was set in the UI elements command arg.
pymel.core.uitypes.Button.getCommand()
import pymel.core as pm
class UI(object):
def __init__(self):
if pm.window('testWin', exists=True):
pm.deleteUI('testWin')
with pm.window('testWin') as window:
with pm.columnLayout():
btn = pm.button(l='egweg', c=self.cmd)
window.show()
newFun = btn.getCommand()
newFun()
def cmd(self, *args):
print 'cmd fired'
UI()
Interesting. It looks like there a few UI controls that allow querying the command. The checkBox doesn’t allow that unfortunately.
According to a pymel search for getCommand, they are:
Button
CommandMenuItem
IconTextButton
MenuEditor
NodeIconButton
ShelfButton
SymbolButton
Visor