mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-26 07:49:48 -05:00
#1095 Fix crash for shares larger than 2GB. #1089 add ETA/bytes uploaded in progress bar of ReceiveMode items
This commit is contained in:
parent
1c424500f0
commit
cefa271d29
@ -119,7 +119,7 @@ class ShareHistoryItem(HistoryItem):
|
||||
self.progress_bar.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||
self.progress_bar.setAlignment(QtCore.Qt.AlignHCenter)
|
||||
self.progress_bar.setMinimum(0)
|
||||
self.progress_bar.setMaximum(total_bytes)
|
||||
self.progress_bar.setMaximum(total_bytes / 1024)
|
||||
self.progress_bar.setValue(0)
|
||||
self.progress_bar.setStyleSheet(
|
||||
self.common.gui.css["downloads_uploads_progress_bar"]
|
||||
@ -138,8 +138,8 @@ class ShareHistoryItem(HistoryItem):
|
||||
def update(self, downloaded_bytes):
|
||||
self.downloaded_bytes = downloaded_bytes
|
||||
|
||||
self.progress_bar.setValue(downloaded_bytes)
|
||||
if downloaded_bytes == self.progress_bar.total_bytes:
|
||||
self.progress_bar.setValue(downloaded_bytes / 1024)
|
||||
if (downloaded_bytes / 1024) == (self.progress_bar.total_bytes / 1024):
|
||||
pb_fmt = strings._("gui_all_modes_progress_complete").format(
|
||||
self.common.format_seconds(time.time() - self.started)
|
||||
)
|
||||
@ -322,8 +322,8 @@ class ReceiveHistoryItem(HistoryItem):
|
||||
total_uploaded_bytes += data["progress"][filename]["uploaded_bytes"]
|
||||
|
||||
# Update the progress bar
|
||||
self.progress_bar.setMaximum(self.content_length)
|
||||
self.progress_bar.setValue(total_uploaded_bytes)
|
||||
self.progress_bar.setMaximum(self.content_length / 1024)
|
||||
self.progress_bar.setValue(total_uploaded_bytes / 1024)
|
||||
|
||||
elapsed = datetime.now() - self.started
|
||||
if elapsed.seconds < 10:
|
||||
@ -339,6 +339,8 @@ class ReceiveHistoryItem(HistoryItem):
|
||||
estimated_time_remaining,
|
||||
)
|
||||
|
||||
self.progress_bar.setFormat(pb_fmt)
|
||||
|
||||
# Using list(progress) to avoid "RuntimeError: dictionary changed size during iteration"
|
||||
for filename in list(data["progress"]):
|
||||
# Add a new file if needed
|
||||
@ -461,7 +463,7 @@ class IndividualFileHistoryItem(HistoryItem):
|
||||
self.downloaded_bytes = downloaded_bytes
|
||||
|
||||
self.progress_bar.setValue(downloaded_bytes)
|
||||
if downloaded_bytes == self.progress_bar.total_bytes:
|
||||
if (downloaded_bytes / 1024 ) == (self.progress_bar.total_bytes / 1024):
|
||||
self.status_code_label.setText("200")
|
||||
self.status_code_label.setStyleSheet(
|
||||
self.common.gui.css["history_individual_file_status_code_label_2xx"]
|
||||
|
Loading…
Reference in New Issue
Block a user