# 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()
  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
__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.
__open | Private slot to open the downloaded file.
__saveFileName | Private method to calculate a name for the file to download.
__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.
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_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, parent=None)

Constructor

downloadItem
  reference to the download object containing the download data.
parent= (QWebEngineDownloadItem)
  reference to the parent widget (QWidget)

#### 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.__open

__open()

Private slot to open the downloaded file.

#### 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.__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.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:
  tuple of URL, save location, flag and the URL of the related web page (QUrl, string, boolean,QUrl)

#### 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_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
  tuple of URL, save location, flag and the URL of the related web page (QUrl, string, boolean, QUrl)

#### DownloadItem.setIcon

setIcon(icon)

Public method to set the download icon.

icon
  reference to the icon to be set (QIcon)

Up