4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a widget controlling a download. |
7 Module implementing a widget controlling a download. |
8 """ |
8 """ |
9 |
|
10 |
9 |
11 import os |
10 import os |
12 |
11 |
13 from PyQt5.QtCore import ( |
12 from PyQt5.QtCore import ( |
14 pyqtSlot, pyqtSignal, Qt, QTime, QUrl, QStandardPaths, QFileInfo, QDateTime |
13 pyqtSlot, pyqtSignal, Qt, QTime, QUrl, QStandardPaths, QFileInfo, QDateTime |
174 QFileInfo(originalFileName).fileName(), |
173 QFileInfo(originalFileName).fileName(), |
175 mimetype, |
174 mimetype, |
176 "{0}://{1}".format(url.scheme(), url.authority()), |
175 "{0}://{1}".format(url.scheme(), url.authority()), |
177 self) |
176 self) |
178 |
177 |
179 if dlg.exec_() == QDialog.Rejected or dlg.getAction() == "cancel": |
178 if dlg.exec() == QDialog.Rejected or dlg.getAction() == "cancel": |
180 self.progressBar.setVisible(False) |
179 self.progressBar.setVisible(False) |
181 self.on_stopButton_clicked() |
180 self.on_stopButton_clicked() |
182 self.filenameLabel.setText( |
181 self.filenameLabel.setText( |
183 self.tr("Download canceled: {0}").format( |
182 self.tr("Download canceled: {0}").format( |
184 QFileInfo(defaultFileName).fileName())) |
183 QFileInfo(defaultFileName).fileName())) |