mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Properly raise DeviceBusyError in RemovableDriveOutputDevice
Contributes to CURA-448
This commit is contained in:
parent
b7471d6b1d
commit
3e2797d727
1 changed files with 8 additions and 0 deletions
|
@ -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())))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue