Home ⌂Doc Index ◂Up ▴

eric6.WebBrowser.Download.DownloadItem

Module implementing a widget controlling a download.

Global Attributes

None

Classes

DownloadItem Class implementing a widget controlling a download.

Functions

None


DownloadItem

Class implementing a widget controlling a download.

Signals

downloadFinished(success)
emitted when a download finished
progress(int, int)
emitted to signal the download progress
statusChanged()
emitted upon a status change of a download

Derived from

QWidget, Ui_DownloadItem

Class Attributes

DownloadCancelled
DownloadSuccessful
Downloading

Class Methods

None

Methods

DownloadItem Constructor
__adjustSize Private method to adjust the size of the download item.
__downloadProgress Private method to show the download progress.
__finished Private slot to handle the download finished.
__getFileName Private method to get the file name to save to from the user.
__initialize Private method to initialize the widget.
__saveFileName Private method to calculate a name for the file to download.
__setDateTime Private method to set the download date and time.
__setFileName Private method to set the file name to save the download into.
__updateInfoLabel Private method to update the info label.
absoluteFilePath Public method to get the absolute path of the output file.
bytesReceived Public method to get the number of bytes received.
bytesTotal Public method to get the total number of bytes of the download.
cancelDownload Public slot to stop the download.
canceledFileSelect Public method to check, if the user canceled the file selection.
currentSpeed Public method to get an estimation for the download speed.
downloadCanceled Public method to check, if the download was cancelled.
downloadProgress Public method to get the download progress.
downloadedSuccessfully Public method to check for a successful download.
downloading Public method to determine, if a download is in progress.
fileName Public method to get the name of the output file.
getData Public method to get the relevant download data.
getInfoData Public method to get the text of the info label.
getPageUrl Public method to get the URL of the download page.
on_openButton_clicked Private slot to open the downloaded file.
on_pauseButton_clicked Private slot to pause the download.
on_stopButton_clicked Private slot to stop the download.
openFile Public slot to open the downloaded file.
openFolder Public slot to open the folder containing the downloaded file.
remainingTime Public method to get an estimation for the remaining time.
setData Public method to set the relevant download data.
setIcon Public method to set the download icon.

Static Methods

None

DownloadItem (Constructor)

DownloadItem(downloadItem=None, pageUrl=None, parent=None)

Constructor

downloadItem (QWebEngineDownloadItem)
reference to the download object containing the download data.
pageUrl (QUrl)
URL of the calling page
parent (QWidget)
reference to the parent widget

DownloadItem.__adjustSize

__adjustSize()

Private method to adjust the size of the download item.

DownloadItem.__downloadProgress

__downloadProgress(bytesReceived, bytesTotal)

Private method to show the download progress.

bytesReceived
number of bytes received (integer)
bytesTotal
number of total bytes (integer)

DownloadItem.__finished

__finished()

Private slot to handle the download finished.

DownloadItem.__getFileName

__getFileName()

Private method to get the file name to save to from the user.

DownloadItem.__initialize

__initialize()

Private method to initialize the widget.

DownloadItem.__saveFileName

__saveFileName(directory)

Private method to calculate a name for the file to download.

directory
name of the directory to store the file into (string)
Returns:
proposed filename and original filename (string, string)

DownloadItem.__setDateTime

__setDateTime(dateTime=None)

Private method to set the download date and time.

dateTime (QDateTime)
date and time to be set

DownloadItem.__setFileName

__setFileName(fileName)

Private method to set the file name to save the download into.

fileName (str)
name of the file to save into

DownloadItem.__updateInfoLabel

__updateInfoLabel()

Private method to update the info label.

DownloadItem.absoluteFilePath

absoluteFilePath()

Public method to get the absolute path of the output file.

Returns:
absolute path of the output file (string)

DownloadItem.bytesReceived

bytesReceived()

Public method to get the number of bytes received.

Returns:
number of bytes received (integer)

DownloadItem.bytesTotal

bytesTotal()

Public method to get the total number of bytes of the download.

Returns:
total number of bytes (integer)

DownloadItem.cancelDownload

cancelDownload()

Public slot to stop the download.

DownloadItem.canceledFileSelect

canceledFileSelect()

Public method to check, if the user canceled the file selection.

Returns:
flag indicating cancellation (boolean)

DownloadItem.currentSpeed

currentSpeed()

Public method to get an estimation for the download speed.

Returns:
estimation for the download speed (float)

DownloadItem.downloadCanceled

downloadCanceled()

Public method to check, if the download was cancelled.

Returns:
flag indicating a canceled download (boolean)

DownloadItem.downloadProgress

downloadProgress()

Public method to get the download progress.

Returns:
current download progress
Return Type:
int

DownloadItem.downloadedSuccessfully

downloadedSuccessfully()

Public method to check for a successful download.

Returns:
flag indicating a successful download (boolean)

DownloadItem.downloading

downloading()

Public method to determine, if a download is in progress.

Returns:
flag indicating a download is in progress (boolean)

DownloadItem.fileName

fileName()

Public method to get the name of the output file.

Returns:
name of the output file (string)

DownloadItem.getData

getData()

Public method to get the relevant download data.

Returns:
dictionary containing the URL, save location, done flag, the URL of the related web page and the date and time of the download
Return Type:
dict of {"URL": QUrl, "Location": str, "Done": bool, "PageURL": QUrl, "Downloaded": QDateTime}

DownloadItem.getInfoData

getInfoData()

Public method to get the text of the info label.

Returns:
text of the info label (string)

DownloadItem.getPageUrl

getPageUrl()

Public method to get the URL of the download page.

Returns:
URL of the download page (QUrl)

DownloadItem.on_openButton_clicked

on_openButton_clicked()

Private slot to open the downloaded file.

DownloadItem.on_pauseButton_clicked

on_pauseButton_clicked(checked)

Private slot to pause the download.

checked (bool)
flag indicating the state of the button

DownloadItem.on_stopButton_clicked

on_stopButton_clicked()

Private slot to stop the download.

DownloadItem.openFile

openFile()

Public slot to open the downloaded file.

DownloadItem.openFolder

openFolder()

Public slot to open the folder containing the downloaded file.

DownloadItem.remainingTime

remainingTime()

Public method to get an estimation for the remaining time.

Returns:
estimation for the remaining time (float)

DownloadItem.setData

setData(data)

Public method to set the relevant download data.

data (dict of {"URL": QUrl, "Location": str, "Done": bool,)
dictionary containing the URL, save location, done flag, the URL of the related web page and the date and time of the download "PageURL": QUrl, "Downloaded": QDateTime}

DownloadItem.setIcon

setIcon(icon)

Public method to set the download icon.

icon
reference to the icon to be set (QIcon)
Up



Home ⌂Doc Index ◂Up ▴