Hey, I've just had a similar journey using the TreeView control whose pressCommand command only took a mel procedure name from the python command!
Hamish helped me solve the same problem. If you take a look in the latest zooTools <http://www.macaronikazoo.com/>baseMelUI module, there is the MelTreeView class which is wrapping the pressCommand of the treeView by generating an on the fly procedure and having it call back into the python script. The name of the function you want to look at is setPressCommand. Hopefully its helps out, it certainly has for the tool I am creating right now. I have been hinted to that the next version of my fixes a lot of the mel only callbacks in python commands, not that it helps us now ;( Dave On Mon, Feb 28, 2011 at 11:25 PM, Jakob Welner <[email protected]>wrote: > Hey there, > > I'm doing my best to use Mayas fileBrowser.mel from within Python but it's > causing a bit of a headache. > > I need to make use a linux file browser that allows for picking directories > instead of only files and what I'm trying to do is to catch the fileBrowsers > mel callback and parse on the values to my python class. > Initially I'd thought I'd generate an on-the-fly global mel proc for > initial callback and hardcoding a lambda reference for my class into it and > had hoped to be able to simply evaluate the lambda function reference > through a python call in Mel, but it seems to be a rather optimistic idea? > > I may be missing something obvious as it's been a while since I've been > playing around with Python in Maya. > I'm using lambdas all over for my Maya GUI buttons which works fine however > they are all called through a maya.cmds command which I guess is the layer > I'm missing. > > Does anyone know how to parse on values from a mel script to a python class > method? > > > And as a side note, the reason for me to want to use fileBrowser.mel is to > maintain as much backwards compatibility as possible while supporting > Linux/Windows/MacOS (I'm using fileBrowserDialog when possible) > If anyone's got a better idea for a filebrowser that'll work on all Linux > setups, can be used to select directories and doesn't require a bunch of > bundled files to carry along, feel free tell me :) > It's for a LGPL lincensed Anim Library tool (PAIE) and i'd prefer not to > have too many dependencies. > > > Cheers > JAKOB WELNER > _____________ > Animator | R&D > jakob.welner.dk > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
