parameters: (self, *args)
docstring: Create context menu.
docstring_summary: Create context menu.
docstring_tokens: Create context menu .
function: def createContextMenu(self, *args):
          """Create context menu."""
          existedAttrs = cmds.listAttr(self.nodeName)
  
          menu = ComplexMenu()
  
          group = None
          for attr in filterAttributesByVersion(ATTRIBUTES):
              name = attr['name']
              if name in existedAttrs:
                  continue
  
              currentGroup = attr.get('group')
  
              # Add a separator if necessary.
              # TODO: in Qt5 it's possible to add a separator with a text
              if currentGroup != group:
                  if not menu.isEmpty():
                      menu.addSeparator()
                  group = currentGroup
  
              action = menu.addAction(attr['label'])
              action.triggered.connect(lambda a=name: self.addAttr(attrName=a))
  
          if not menu.isEmpty():
              menu.addSeparator()
  
          action = menu.addAction('Custom Int')
          action.triggered.connect(lambda: self.addAttr(attrType='long'))
          action = menu.addAction('Custom Float')
          action.triggered.connect(lambda: self.addAttr(attrType='double'))
          action = menu.addAction('Custom Color')
          action.triggered.connect(lambda: self.addAttr(attrType='color'))
          action = menu.addAction('Custom String')
          action.triggered.connect(lambda: self.addAttr(attrType='string'))
  
          # popup() is asynchronous, exec_() is synchronous.
          menu.exec_(QtGui.QCursor.pos())
function_tokens: def createContextMenu ( self , * args ) : existedAttrs = cmds . listAttr ( self . nodeName ) menu = ComplexMenu ( ) group = None for attr in filterAttributesByVersion ( ATTRIBUTES ) : name = attr [ 'name' ] if name in existedAttrs : continue currentGroup = attr . get ( 'group' ) # Add a separator if necessary. # TODO: in Qt5 it's possible to add a separator with a text if currentGroup != group : if not menu . isEmpty ( ) : menu . addSeparator ( ) group = currentGroup action = menu . addAction ( attr [ 'label' ] ) action . triggered . connect ( lambda a = name : self . addAttr ( attrName = a ) ) if not menu . isEmpty ( ) : menu . addSeparator ( ) action = menu . addAction ( 'Custom Int' ) action . triggered . connect ( lambda : self . addAttr ( attrType = 'long' ) ) action = menu . addAction ( 'Custom Float' ) action . triggered . connect ( lambda : self . addAttr ( attrType = 'double' ) ) action = menu . addAction ( 'Custom Color' ) action . triggered . connect ( lambda : self . addAttr ( attrType = 'color' ) ) action = menu . addAction ( 'Custom String' ) action . triggered . connect ( lambda : self . addAttr ( attrType = 'string' ) ) # popup() is asynchronous, exec_() is synchronous. menu . exec_ ( QtGui . QCursor . pos ( ) )