mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-01 08:14:22 +08:00
Disconnect upload finished signals, move already uploading check down, CURA-4398
This commit is contained in:
parent
a8476c30ca
commit
cd59048475
@ -485,6 +485,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||
Logger.log("d", "Stopping post upload because the connection was lost.")
|
||||
try:
|
||||
self._post_reply.uploadProgress.disconnect(self._onUploadProgress)
|
||||
self._post_reply.finished.disconnect(self._onUploadFinished)
|
||||
except TypeError:
|
||||
pass # The disconnection can fail on mac in some cases. Ignore that.
|
||||
|
||||
@ -517,6 +518,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||
Logger.log("d", "Stopping post upload because the connection was lost.")
|
||||
try:
|
||||
self._post_reply.uploadProgress.disconnect(self._onUploadProgress)
|
||||
self._post_reply.finished.disconnect(self._onUploadFinished)
|
||||
except TypeError:
|
||||
pass # The disconnection can fail on mac in some cases. Ignore that.
|
||||
|
||||
@ -652,14 +654,6 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||
# \param kwargs Keyword arguments.
|
||||
def requestWrite(self, nodes, file_name=None, filter_by_machine=False, file_handler=None, **kwargs):
|
||||
|
||||
# Check if we're already writing
|
||||
if not self._write_finished:
|
||||
self._error_message = Message(
|
||||
i18n_catalog.i18nc("@info:status",
|
||||
"Sending new jobs (temporarily) blocked, still sending the previous print job."))
|
||||
self._error_message.show()
|
||||
return
|
||||
|
||||
if self._printer_state not in ["idle", ""]:
|
||||
self._error_message = Message(
|
||||
i18n_catalog.i18nc("@info:status", "Unable to start a new print job, printer is busy. Current printer status is %s.") % self._printer_state,
|
||||
@ -759,6 +753,14 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||
)
|
||||
return
|
||||
|
||||
# Check if we're already writing
|
||||
if not self._write_finished:
|
||||
self._error_message = Message(
|
||||
i18n_catalog.i18nc("@info:status",
|
||||
"Sending new jobs (temporarily) blocked, still sending the previous print job."))
|
||||
self._error_message.show()
|
||||
return
|
||||
|
||||
# Indicate we're starting a new write action, is set back to True in the startPrint() method
|
||||
self._write_finished = False
|
||||
|
||||
@ -996,6 +998,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||
if self._post_reply:
|
||||
self._post_reply.abort()
|
||||
self._post_reply.uploadProgress.disconnect(self._onUploadProgress)
|
||||
self._post_reply.finished.disconnect(self._onUploadFinished)
|
||||
Logger.log("d", "Uploading of print failed after %s", time() - self._send_gcode_start)
|
||||
self._post_reply = None
|
||||
self._progress_message.hide()
|
||||
@ -1177,6 +1180,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||
del self._material_post_objects[id(reply)]
|
||||
elif "print_job" in reply_url:
|
||||
reply.uploadProgress.disconnect(self._onUploadProgress)
|
||||
reply.finished.disconnect(self._onUploadFinished)
|
||||
Logger.log("d", "Uploading of print succeeded after %s", time() - self._send_gcode_start)
|
||||
# Only reset the _post_reply if it was the same one.
|
||||
if reply == self._post_reply:
|
||||
|
Loading…
x
Reference in New Issue
Block a user