Just pass it any callable:
win = CustomDialog()
# has a win.customMethod()
dock = mc.dockControl(
dockName, a="right", aa=["left", "right"],
con=str(WINDOW.objectName()), l=name, w=350,
vcc=win.customMethod )
Because Maya's callbacks tend to send along pointless empty arguments, and
it might affect your ability to connect directly to PyQt methods that don't
expect those args, you could use a lambda to swallow them up:
dock = mc.dockControl(
dockName, a="right", aa=["left", "right"],
con=str(WINDOW.objectName()), l=name, w=350,
vcc=lambda *x: win.close() )
On Thu, Aug 23, 2012 at 6:10 PM, Geoff Harvey <[email protected]> wrote:
> Hiya!
>
> Long time listener, first time caller!
>
> I've managed to create a PyQt window that I can dock (using
> maya.cmds.dockControl) in the Maya main window.
>
> The PyQt window has a "close" button that does the appropriate cleanup,
> but I can't seem to connect the little "x" on the corner of the dockControl
> with the same cleanup methods.
>
> I figured I'd be able to do something with the vcc (visibleChangeCommand)
> when creating the dockControl:
>
> import maya.cmds as mc
>
> ## WINDOW contains the PyQt GUI object ...
> dock = mc.dockControl(
> dockName, a="right", aa=["left", "right"],
> con=str(WINDOW.objectName()), l=name, w=350,
> vcc=SOME_COMMAND_HERE)
>
> However ... I can't get that to work.
>
> If I put something like "print 'wowsers' into the vcc it works, but that's
> about as far as I can get.
>
> Ideas?
>
> Also, if this is too obscure I'll try paring down my code to a more
> reasonable example.
>
> Thanks in advance,
>
> geoff
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe