Merge pull request #906 from mig5/show_canceled_item_as_canceled

Update the GUI when the browser has canceled an upload in Receive Mode. Don't increment the completed counter
This commit is contained in:
Micah Lee 2019-02-17 10:07:34 -08:00 committed by GitHub
commit 41f5800e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -332,14 +332,14 @@ class ReceiveModeRequest(Request):
self.told_gui_about_request = True self.told_gui_about_request = True
filename = secure_filename(filename) self.filename = secure_filename(filename)
self.progress[filename] = { self.progress[self.filename] = {
'uploaded_bytes': 0, 'uploaded_bytes': 0,
'complete': False 'complete': False
} }
f = ReceiveModeFile(self, filename, self.file_write_func, self.file_close_func) f = ReceiveModeFile(self, self.filename, self.file_write_func, self.file_close_func)
if f.upload_error: if f.upload_error:
self.web.common.log('ReceiveModeRequest', '_get_file_stream', 'Error creating file') self.web.common.log('ReceiveModeRequest', '_get_file_stream', 'Error creating file')
self.upload_error = True self.upload_error = True
@ -362,7 +362,7 @@ class ReceiveModeRequest(Request):
if self.told_gui_about_request: if self.told_gui_about_request:
upload_id = self.upload_id upload_id = self.upload_id
if not self.web.stop_q.empty(): if not self.web.stop_q.empty() or not self.progress[self.filename]['complete']:
# Inform the GUI that the upload has canceled # Inform the GUI that the upload has canceled
self.web.add_request(self.web.REQUEST_UPLOAD_CANCELED, self.path, { self.web.add_request(self.web.REQUEST_UPLOAD_CANCELED, self.path, {
'id': upload_id 'id': upload_id

View File

@ -198,9 +198,7 @@ class ReceiveMode(Mode):
self.history.update(event["data"]["id"], { self.history.update(event["data"]["id"], {
'action': 'canceled' 'action': 'canceled'
}) })
self.history.completed_count += 1
self.history.in_progress_count -= 1 self.history.in_progress_count -= 1
self.history.update_completed()
self.history.update_in_progress() self.history.update_in_progress()
def on_reload_settings(self): def on_reload_settings(self):