MCPcopy Create free account
hub / github.com/Syncplay/syncplay / dropEvent

Method dropEvent

syncplay/ui/gui.py:1975–1995  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

1973 event.acceptProposedAction()
1974
1975 def dropEvent(self, event):
1976 rewindFile = False
1977 if QtGui.QDropEvent.proposedAction(event) == Qt.MoveAction:
1978 QtGui.QDropEvent.setDropAction(event, Qt.CopyAction) # Avoids file being deleted
1979 rewindFile = True
1980 data = event.mimeData()
1981 urls = data.urls()
1982 if urls and urls[0].scheme() == 'file':
1983 url = event.mimeData().urls()[0]
1984 if isMacOS() and IsPySide:
1985 macURL = NSString.alloc().initWithString_(str(url.toString()))
1986 pathString = macURL.stringByAddingPercentEscapesUsingEncoding_(NSUTF8StringEncoding)
1987 dropfilepath = os.path.abspath(NSURL.URLWithString_(pathString).filePathURL().path())
1988 else:
1989 dropfilepath = os.path.abspath(str(url.toLocalFile()))
1990 if rewindFile == False:
1991 self._syncplayClient.openFile(dropfilepath, resetPosition=False, fromUser=True)
1992 else:
1993 self._syncplayClient.setPosition(0)
1994 self._syncplayClient.openFile(dropfilepath, resetPosition=True, fromUser=True)
1995 self._syncplayClient.setPosition(0)
1996
1997 def setPlaylist(self, newPlaylist, newIndexFilename=None):
1998 if self.updatingPlaylist:

Callers 2

dropEventMethod · 0.45
dropEventMethod · 0.45

Calls 3

isMacOSFunction · 0.90
openFileMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected