(self, event)
| 304 | window.setPlaylistInsertPosition(None) |
| 305 | |
| 306 | def dropEvent(self, event): |
| 307 | window = self.parent().parent().parent().parent().parent() |
| 308 | if not window.playlist.isEnabled(): |
| 309 | return |
| 310 | window.setPlaylistInsertPosition(None) |
| 311 | if QtGui.QDropEvent.proposedAction(event) == Qt.MoveAction: |
| 312 | QtGui.QDropEvent.setDropAction(event, Qt.CopyAction) # Avoids file being deleted |
| 313 | data = event.mimeData() |
| 314 | urls = data.urls() |
| 315 | |
| 316 | if urls and urls[0].scheme() == 'file': |
| 317 | indexRow = window.playlist.count() if window.clearedPlaylistNote else 0 |
| 318 | |
| 319 | for url in urls[::-1]: |
| 320 | if isMacOS() and IsPySide: |
| 321 | macURL = NSString.alloc().initWithString_(str(url.toString())) |
| 322 | pathString = macURL.stringByAddingPercentEscapesUsingEncoding_(NSUTF8StringEncoding) |
| 323 | dropfilepath = os.path.abspath(NSURL.URLWithString_(pathString).filePathURL().path()) |
| 324 | else: |
| 325 | dropfilepath = os.path.abspath(str(url.toLocalFile())) |
| 326 | if os.path.isfile(dropfilepath): |
| 327 | window.addFileToPlaylist(dropfilepath, indexRow) |
| 328 | elif os.path.isdir(dropfilepath): |
| 329 | window.addFolderToPlaylist(dropfilepath) |
| 330 | else: |
| 331 | super(MainWindow.PlaylistWidget, self).dropEvent(event) |
| 332 | |
| 333 | class PlaylistWidget(QtWidgets.QListWidget): |
| 334 | selfWindow = None |
nothing calls this directly
no test coverage detected