def populateDriveList(self): self.l_drive.clear() global drivList drivList = drive_down.list_in_root(drive_service) for k in drivList: it = QtGui.QListWidgetItem(k[0]) if k[2]: it.setIcon(QtGui.QIcon(r"drv.ico")) else: it.setIcon(QtGui.QIcon(r"file.ico")) self.l_drive.addItem(it) self.setProgressbarValue(self.progressBar, drive_down.get_space(drive_service))
def dropEvent(self, e): if e.mimeData().hasText: e.setDropAction(QtCore.Qt.CopyAction) sysPath = e.mimeData().text()[7::] self.addItem(QtGui.QListWidgetItem(QtGui.QIcon(r'file.ico'), sysPath.split('/')[-1])) size = os.path.getsize(sysPath) dbxUsed, dbxTot = dropbox_down.get_space() drvUsed, drvTot = drive_down.get_space(drive_service) freeDbx = dbxTot - dbxUsed freeDrv = drvTot - drvUsed if size < freeDbx: dropbox_down.upload_file(sysPath, sysPath.split('/')[-1]) # l_dbx.popu() elif size < freeDrv: drive_down.upload_file(sysPath, drive_service) # l_drive.popu() else: pass #this line is not needed really #call upload function with e.mimeData().text() e.accept()