|
@@ -22,7 +22,12 @@ class RemovableDriveOutputDevice(OutputDevice):
|
|
|
self.setIconName("save_sd")
|
|
|
self.setPriority(1)
|
|
|
|
|
|
+ self._writing = False
|
|
|
+
|
|
|
def requestWrite(self, node, file_name = None):
|
|
|
+ if self._writing:
|
|
|
+ raise OutputDeviceError.DeviceBusyError()
|
|
|
+
|
|
|
gcode_writer = Application.getInstance().getMeshFileHandler().getWriterByMimeType("text/x-gcode")
|
|
|
if not gcode_writer:
|
|
|
Logger.log("e", "Could not find GCode writer, not writing to removable drive %s", self.getName())
|
|
@@ -55,6 +60,7 @@ class RemovableDriveOutputDevice(OutputDevice):
|
|
|
self.writeStarted.emit(self)
|
|
|
|
|
|
job._message = message
|
|
|
+ self._writing = True
|
|
|
job.start()
|
|
|
except PermissionError as e:
|
|
|
raise OutputDeviceError.PermissionDeniedError() from e
|
|
@@ -70,6 +76,8 @@ class RemovableDriveOutputDevice(OutputDevice):
|
|
|
if hasattr(job, "_message"):
|
|
|
job._message.hide()
|
|
|
job._message = None
|
|
|
+
|
|
|
+ self._writing = False
|
|
|
self.writeFinished.emit(self)
|
|
|
if job.getResult():
|
|
|
message = Message(catalog.i18nc("@info:status", "Saved to Removable Drive {0} as {1}").format(self.getName(), os.path.basename(job.getFileName())))
|