2022-03-15

Find the completion of download in QWebEngineDownloadItem with the function isFinished() or finished() in Python

I want to detect the completion of download by PyQt5.QtWebEngineWidgets.QWebEngineDownloadItem.

I have read the docs but its showing error. I want to detect by isFinished() or finished() with this code below:

def downloadRequested(item): #QWebEngineDownloadItem
            print('downloading to', item.path())
            item.accept()
            words = ["The file was downloaded succesfully in", item.path()]
            sentence = ' '.join(words)
            print(sentence)

And the connect function

w.page().profile().downloadRequested.connect(downloadRequested)

Ok w is the view

w = self.QWebEngineView

I want to detect it inside downloadRequested() and after the detection I want to execute this code :

call(["python", "download.py"])


No comments:

Post a Comment