19 |
19 |
20 from E5Gui import E5FileDialog |
20 from E5Gui import E5FileDialog |
21 |
21 |
22 from .Ui_DownloadItem import Ui_DownloadItem |
22 from .Ui_DownloadItem import Ui_DownloadItem |
23 |
23 |
24 from .DownloadUtilities import timeString, dataString |
24 from .DownloadUtilities import timeString, dataString, speedString |
25 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
25 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
26 |
26 |
27 import UI.PixmapCache |
27 import UI.PixmapCache |
28 import Utilities.MimeTypes |
28 import Utilities.MimeTypes |
29 import Globals |
29 import Globals |
399 self.progressBar.setMaximum(totalValue) |
399 self.progressBar.setMaximum(totalValue) |
400 |
400 |
401 self.progress.emit(currentValue, totalValue) |
401 self.progress.emit(currentValue, totalValue) |
402 self.__updateInfoLabel() |
402 self.__updateInfoLabel() |
403 |
403 |
|
404 def downloadProgress(self): |
|
405 """ |
|
406 Public method to get the download progress. |
|
407 |
|
408 @return current download progress |
|
409 @rtype int |
|
410 """ |
|
411 return self.progressBar.value() |
|
412 |
404 def bytesTotal(self): |
413 def bytesTotal(self): |
405 """ |
414 """ |
406 Public method to get the total number of bytes of the download. |
415 Public method to get the total number of bytes of the download. |
407 |
416 |
408 @return total number of bytes (integer) |
417 @return total number of bytes (integer) |
469 remaining = "" |
478 remaining = "" |
470 |
479 |
471 if bytesTotal > 0: |
480 if bytesTotal > 0: |
472 remaining = timeString(timeRemaining) |
481 remaining = timeString(timeRemaining) |
473 |
482 |
474 info = self.tr("{0} of {1} ({2}/sec)\n{3}")\ |
483 info = self.tr("{0} of {1} ({2}/sec) {3}")\ |
475 .format( |
484 .format( |
476 dataString(self.__bytesReceived), |
485 dataString(self.__bytesReceived), |
477 bytesTotal == -1 and self.tr("?") or |
486 bytesTotal == -1 and self.tr("?") or |
478 dataString(bytesTotal), |
487 dataString(bytesTotal), |
479 dataString(int(speed)), |
488 speedString(speed), |
480 remaining) |
489 remaining) |
481 else: |
490 else: |
482 if self.__bytesReceived == bytesTotal or bytesTotal == -1: |
491 if self.__bytesReceived == bytesTotal or bytesTotal == -1: |
483 info = self.tr("{0} downloaded")\ |
492 info = self.tr("{0} downloaded")\ |
484 .format(dataString(self.__bytesReceived)) |
493 .format(dataString(self.__bytesReceived)) |