This is not a solution but maybe help
http://www.djx.com.au/blog/2008/03/13/user-marking-menu-hot-keys/


from PyQt4.QtCore import *
from PyQt4.QtGui import *
from sip import wrapinstance
import maya.OpenMayaUI as omui
import maya.mel as mel
import maya.cmds as cmds

qMayaWindow = wrapinstance(long(omui.MQtUtil.mainWindow()), QObject)
for bb in qMayaWindow.findChildren(QPushButton, 'my_mmButton'):
    bb.setParent(None)


class mmButton(QPushButton):
    def __init__(self, parent = None):
        QPushButton.__init__(self)
        self.setObjectName('my_mmButton')
        self.setText('MENU')
        
    def mousePressEvent(self, event):
        panel = cmds.getPanel(up=1)
        if cmds.popupMenu('tempMM', exists=1):
            cmds.deleteUI('tempMM')
        if not cmds.control(panel , ex=1):
            panel = "viewPanes"
        cmds.popupMenu('tempMM', button=1, ctl=0, alt=1, sh=0, 
allowOptionBoxes=1, parent=panel, mm=1) 
        cmds.menuItem('menuEditorMenuItem1',
        label="Graph Editor",
        divider=0,
        subMenu=0,
        tearOff=0,
        command='mel.eval("GraphEditor")',
        altModifier=0,
        optionModifier=0,
        commandModifier=0,
        ctrlModifier=0,
        shiftModifier=0,
        optionBox=0,
        enable=1,
        data=0,
        radialPosition="NW",
        allowOptionBoxes=1,
        postMenuCommandOnce=0,
        enableCommandRepeat=1,
        image="menuIconWindow.png",
        echoCommand=0,
        annotation="Graph Editor",
        italicized=0,
        boldFont=1)
        
        cmds.menuItem('menuEditorMenuItem3',
        label="Hypershade" ,
        divider=0,
        subMenu=0,
        tearOff=0,
        command='mel.eval("HypershadeWindow")' ,
        altModifier=0,
        optionModifier=0,
        commandModifier=0,
        ctrlModifier=0,
        shiftModifier=0,
        optionBox=0,
        enable=1,
        data=0,
        radialPosition="NE" ,
        allowOptionBoxes=1,
        postMenuCommandOnce=0,
        enableCommandRepeat=1,
        image="menuIconWindow.png" ,
        echoCommand=0,
        annotation="Hypershade" ,
        italicized=0,
        boldFont=1)

        QPushButton.mousePressEvent(self, event)

    def mouseReleaseEvent(self, event):
        if cmds.popupMenu('tempMM', exists=1):
            cmds.deleteUI('tempMM')
        QPushButton.mouseReleaseEvent(self, event)

b = mmButton(qMayaWindow)
b.show()

-- 
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 post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to