mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-02 00:34:26 +08:00
Merge pull request #2543 from Ultimaker/CL-511_abort_crash
CL-511 fix abort crash
This commit is contained in:
commit
dfe4a76e85
@ -277,7 +277,10 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
||||
self._file_name = "%s.gcode.gz" % file_name
|
||||
self._showProgressMessage()
|
||||
|
||||
self._request = self._buildSendPrintJobHttpRequest(require_printer_name)
|
||||
new_request = self._buildSendPrintJobHttpRequest(require_printer_name)
|
||||
if new_request is None or self._stage != OutputStage.uploading:
|
||||
return
|
||||
self._request = new_request
|
||||
self._reply = self._manager.post(self._request, self._multipart)
|
||||
self._reply.uploadProgress.connect(self._onUploadProgress)
|
||||
# See _finishedPostPrintJobRequest()
|
||||
@ -296,7 +299,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
||||
gcode = getattr(Application.getInstance().getController().getScene(), "gcode_list")
|
||||
compressed_gcode = self._compressGcode(gcode)
|
||||
if compressed_gcode is None:
|
||||
return # User aborted print, so stop trying.
|
||||
return None # User aborted print, so stop trying.
|
||||
|
||||
part.setBody(compressed_gcode)
|
||||
self._multipart.append(part)
|
||||
@ -333,7 +336,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
||||
for line in gcode:
|
||||
if not self._compressing_print:
|
||||
self._progress_message.hide()
|
||||
return # Stop trying to zip, abort was called.
|
||||
return None # Stop trying to zip, abort was called.
|
||||
batched_line += line
|
||||
# if the gcode was read from a gcode file, self._gcode will be a list of all lines in that file.
|
||||
# Compressing line by line in this case is extremely slow, so we need to batch them.
|
||||
@ -628,9 +631,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
||||
request.setRawHeader(b"User-agent", b"CuraPrintClusterOutputDevice Plugin")
|
||||
|
||||
def _cleanupRequest(self):
|
||||
self._reply = None
|
||||
self._request = None
|
||||
self._multipart = None
|
||||
self._stage = OutputStage.ready
|
||||
self._file_name = None
|
||||
|
||||
@ -683,10 +684,9 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
||||
Logger.log("d", "User aborted sending print to remote.")
|
||||
self._progress_message.hide()
|
||||
self._compressing_print = False
|
||||
self._stage = OutputStage.ready
|
||||
if self._reply:
|
||||
self._reply.abort()
|
||||
self._reply = None
|
||||
self._stage = OutputStage.ready
|
||||
Application.getInstance().showPrintMonitor.emit(False)
|
||||
|
||||
@pyqtSlot(int, result=str)
|
||||
|
Loading…
x
Reference in New Issue
Block a user