parameters: (self, data, action, row, column, parentIndex)
return_statement: return True
docstring: Handle the data supplied by a drag and drop operation that ended with
          the given action.
docstring_summary: Handle the data supplied by a drag and drop operation that ended with
          the given action.
docstring_tokens: Handle the data supplied by a drag and drop operation that ended with the given action .
function: def dropMimeData(self, data, action, row, column, parentIndex):
          """
          Handle the data supplied by a drag and drop operation that ended with
          the given action.
          """
          if action == QtCore.Qt.IgnoreAction:
              return True
  
          if not data.hasFormat("application/walter.layer.item"):
              # Probably it's a file. We need to add a new layer.
              if not data.hasText():
                  return False
  
              # It's a file. We need to insert it to the list.
              text = str(data.text())
  
              # Remove prefix if necessary
              filePrefix = 'file://'
              if text.startswith(filePrefix):
                  text = text[len(filePrefix):]
  
              # Use only the first line
              text = text.split('\n')[0].strip(chr(13))
  
              if row < 0:
                  self.add(text)
              else:
                  self.insert(row, text)
  
              return True
  
          if parentIndex.isValid():
              parent = parentIndex.internalPointer()
          else:
              parent = self.rootItem
  
          # -1 means user droped the item to the viewport. We need to put it to
          # the end of the list
          if row < 0:
              row = parent.childCount()
  
          # It's moving ot the items. We need to remove the old one and insert it
          # to the new position.
          encodedData = data.data("application/walter.layer.item")
          stream = QtCore.QDataStream(encodedData, QtCore.QIODevice.ReadOnly)
  
          while not stream.atEnd():
              srcRow = stream.readInt32()
  
              if srcRow == row or srcRow == row - 1:
                  # Position has not been changed.
                  continue
  
              self.beginMoveRows(
                  QtCore.QModelIndex(),
                  srcRow,
                  srcRow,
                  QtCore.QModelIndex(),
                  row)
  
              parent.insertChild(
                  parent.childItems.pop(srcRow),
                  row - (0 if row < srcRow else 1))
  
              self.endMoveRows()
  
              # Update the Maya object.
              self.updateCurrentNode()
  
          return True
function_tokens: def dropMimeData ( self , data , action , row , column , parentIndex ) : if action == QtCore . Qt . IgnoreAction : return True if not data . hasFormat ( "application/walter.layer.item" ) : # Probably it's a file. We need to add a new layer. if not data . hasText ( ) : return False # It's a file. We need to insert it to the list. text = str ( data . text ( ) ) # Remove prefix if necessary filePrefix = 'file://' if text . startswith ( filePrefix ) : text = text [ len ( filePrefix ) : ] # Use only the first line text = text . split ( '\n' ) [ 0 ] . strip ( chr ( 13 ) ) if row < 0 : self . add ( text ) else : self . insert ( row , text ) return True if parentIndex . isValid ( ) : parent = parentIndex . internalPointer ( ) else : parent = self . rootItem # -1 means user droped the item to the viewport. We need to put it to # the end of the list if row < 0 : row = parent . childCount ( ) # It's moving ot the items. We need to remove the old one and insert it # to the new position. encodedData = data . data ( "application/walter.layer.item" ) stream = QtCore . QDataStream ( encodedData , QtCore . QIODevice . ReadOnly ) while not stream . atEnd ( ) : srcRow = stream . readInt32 ( ) if srcRow == row or srcRow == row - 1 : # Position has not been changed. continue self . beginMoveRows ( QtCore . QModelIndex ( ) , srcRow , srcRow , QtCore . QModelIndex ( ) , row ) parent . insertChild ( parent . childItems . pop ( srcRow ) , row - ( 0 if row < srcRow else 1 ) ) self . endMoveRows ( ) # Update the Maya object. self . updateCurrentNode ( ) return True