Merge branch 'mb-fix-backend-plugin-crash' of https://github.com/smartavionics/Cura into smartavionics-mb-fix-backend-plugin-crash

This commit is contained in:
Ghostkeeper 2019-09-03 16:14:26 +02:00
commit a9adceec87
No known key found for this signature in database
GPG Key ID: 86BEF881AE2CF276

View File

@ -632,7 +632,10 @@ class CuraEngineBackend(QObject, Backend):
self.setState(BackendState.Done)
self.processingProgress.emit(1.0)
try:
gcode_list = self._scene.gcode_dict[self._start_slice_job_build_plate] #type: ignore #Because we generate this attribute dynamically.
except KeyError: # Can occur if the g-code has been cleared while a slice message is still arriving from the other end.
gcode_list = []
for index, line in enumerate(gcode_list):
replaced = line.replace("{print_time}", str(self._application.getPrintInformation().currentPrintTime.getDisplayString(DurationFormat.Format.ISO8601)))
replaced = replaced.replace("{filament_amount}", str(self._application.getPrintInformation().materialLengths))