Seems like pymel's eval functionality isn't converting your bool True -> 1

Maybe try this:
    p.mel.generateChannelMenu(self.popup, 1)

Or just use the standard mel module:

import cmds.mel as mm
mm.eval('generateChannelMenu("%s", 1)' % self.popup)


On Tue, Apr 17, 2012 at 2:27 PM, Richard Kazuo <richard...@gmail.com> wrote:

> Thanks for this nice piece of code!
>
> Strangely right-mouse clicks aren't working here... (Maya 2011 x64)
>
> # MelError: Error during execution of MEL script:
> generateChannelMenu("MayaWindow|MainAttributeEditorLayout|formLayout37|AEmenuBarLayout|myHappyBox|popupMenu79",True);
>
>
> # Line 1.116: Invalid use of Maya object "True".
>
> Anyone can confirm if you can right-click the new channelbox and open the
> popup-menu?
>
>
>
>
> 2012/4/11 Jo Jürgens <jojurg...@gmail.com>
>
>> Nathan Horne has several very useful posts about PyQt and Maya. You
>> should read this:  http://nathanhorne.com/?p=381
>>
>> Using the code in that post, here's how to achieve what you want:
>>
>> import pymel.all as p
>>
>> class MayaSubWindow(QtGui.QMainWindow):
>>     def __init__(self, parent=getMayaWindow()):
>>         super(MayaSubWindow, self).__init__(parent)
>>         self.centralwidget = QtGui.QWidget(self)
>>         self.layout = QtGui.QVBoxLayout(self.centralwidget)
>>
>>         self.box = p.channelBox('myHappyBox')
>>
>>         # add the standard right click menu. Doesnt work too well -
>>         # most operations use the default channelBox no matter what
>>         self.popup = p.popupMenu()
>>         p.popupMenu(self.popup, e=True, postMenuCommand=lambda *x:
>> p.mel.generateChannelMenu(self.popup, True))
>>         qtObj = toQtObject(self.box)
>>         self.layout.addWidget(qtObj)
>>         self.setCentralWidget(self.centralwidget)
>>
>>
>> myWindow = MayaSubWindow()
>> myWindow.show()
>>
>> Use this if the code is garbled in this mail:
>> http://pastebin.com/HhPcd23h
>>
>>
>>
>> On Thu, Apr 5, 2012 at 2:32 AM, dgovil <dhruvago...@gmail.com> wrote:
>>
>>> Hey guys,
>>> I want to create a few PyQt UI's to keep all my animation tools in a
>>> particular area and cut down on clutter.
>>> I know this must be possible because I've seen a few GUI's pull it off
>>> like this: http://www.martintomoya.com/Site/tools_info.html
>>>
>>> Specifically I would like to embed the channel box into a PyQt UI, and
>>> I've read the way to do it is with scriptedPanels but I can't figure
>>> out how to implement this in PyQT.
>>>
>>> http://download.autodesk.com/global/docs/maya2012/en_us/CommandsPython/scriptedPanel.html
>>>
>>> THe first problem is that according to the docs, this is pretty much a
>>> MEL only function as far as I can tell.
>>> The other is, I'd rather stick to Python if possible than MEL.
>>>
>>> I'm wide open to ideas. Much appreciated.
>>>
>>> -Dhruv
>>>
>>> --
>>> 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
>>
>
>  --
> 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

Reply via email to