- Refactor the Web.ShareMode client_cancel variable to be Web.stop_q, a thread-safe queue that communicates to both share and receive mode when the user stops the server. In share mode this still stops sending the file. In receive mode, if there's a transfer in progress, it cancels it in the middle, and doesn't end up saving that file

- In receive mode, make the receive mode dir right before saving a file (so if it doesn't complete, don't make an empty dir)
- Minor UX tweak: resizing the window stretches the History widget first
This commit is contained in:
Micah Lee 2019-01-20 15:25:36 -08:00
parent 89ccf0306b
commit b75757ee49
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
8 changed files with 102 additions and 39 deletions

View file

@ -83,7 +83,7 @@ class ReceiveMode(Mode):
# Wrapper layout
self.wrapper_layout = QtWidgets.QHBoxLayout()
self.wrapper_layout.addLayout(self.main_layout)
self.wrapper_layout.addWidget(self.history)
self.wrapper_layout.addWidget(self.history, stretch=1)
self.setLayout(self.wrapper_layout)
def get_stop_server_shutdown_timeout_text(self):
@ -198,6 +198,18 @@ class ReceiveMode(Mode):
self.history.update_completed()
self.history.update_in_progress()
def handle_request_upload_canceled(self, event):
"""
Handle REQUEST_UPLOAD_CANCELED event.
"""
self.history.update(event["data"]["id"], {
'action': 'canceled'
})
self.history.completed_count += 1
self.history.in_progress_count -= 1
self.history.update_completed()
self.history.update_in_progress()
def on_reload_settings(self):
"""
We should be ok to re-enable the 'Start Receive Mode' button now.