retrieving URL file size correctly | improving downloaded file size format

This commit is contained in:
Vinicius Moreira
2019-10-09 15:01:46 -03:00
parent ec12bbb1de
commit 6132155614
9 changed files with 35 additions and 14 deletions

View File

@@ -84,8 +84,7 @@ class AdaptableFileDownloader(FileDownloader):
downloader = 'wget'
file_size = self.http_client.get_content_length(file_url)
file_size = int(file_size) / (1024 ** 2) if file_size else None
msg = bold('[{}] ').format(downloader) + self.i18n['downloading'] + ' ' + bold(file_url.split('/')[-1]) + (' ( {0:.2f} Mb )'.format(file_size) if file_size else '')
msg = bold('[{}] ').format(downloader) + self.i18n['downloading'] + ' ' + bold(file_url.split('/')[-1]) + (' ' + file_size if file_size else '')
watcher.change_substatus(msg)
success = handler.handle(process)
except:
@@ -101,8 +100,6 @@ class AdaptableFileDownloader(FileDownloader):
return success
def is_multithreaded(self) -> bool:
return self.multithread_enabled and self.is_aria2c_available()

View File

@@ -65,7 +65,7 @@ class InfoDialog(QDialog):
text.setStyleSheet("width: 400px")
text.setReadOnly(True)
label = QLabel("{}: ".format(i18n.get(i18n_key, i18n.get(attr.lower(), attr))).capitalize())
label = QLabel(i18n.get(i18n_key, i18n.get(attr.lower(), attr)).capitalize())
label.setStyleSheet("font-weight: bold")
self.gbox_info_layout.addWidget(label, idx, 0)

View File

@@ -118,4 +118,5 @@ manage_window.bt_settings.tooltip=Click here to open extra actions
downloading=Downloading
console.install_logs.path=Installation logs can be found at {}
author=author
source=source
source=source
size=size

View File

@@ -120,4 +120,5 @@ manage_window.bt_settings.tooltip=Haga clic aquí para abrir acciones adicionale
downloading=Descargando
console.install_logs.path=Los registros de instalación se pueden encontrar en {}
author=autor
source=origen
source=origen
size=tamaño

View File

@@ -120,4 +120,5 @@ manage_window.bt_settings.tooltip=Clique aqui para abrir ações adicionais
downloading=Baixando
console.install_logs.path=Os registros de instalação podem ser encontrados em {}
author=autor
source=fonte
source=fonte
size=tamanho