mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-10 07:09:02 +08:00
Add invisible preference for file type of output
This preference can't be made visible since a string freeze is into effect, but at least a user could go into the .cfg file and set the setting manually. Contributes to issue CURA-611.
This commit is contained in:
parent
70b8c64090
commit
bc0207cd14
@ -8,6 +8,7 @@ from UM.Mesh.MeshWriter import MeshWriter
|
||||
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
||||
from UM.OutputDevice.OutputDevice import OutputDevice
|
||||
from UM.OutputDevice import OutputDeviceError
|
||||
from UM.Preferences import Preferences
|
||||
|
||||
from UM.i18n import i18nCatalog
|
||||
catalog = i18nCatalog("cura")
|
||||
@ -22,15 +23,18 @@ class RemovableDriveOutputDevice(OutputDevice):
|
||||
self.setIconName("save_sd")
|
||||
self.setPriority(1)
|
||||
|
||||
Preferences.getInstance().addPreference("removable_drive/file_type", "text/x-gcode") #Add a preference that says in what file type we should store the file.
|
||||
|
||||
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")
|
||||
file_type = Preferences.getInstance().getValue("removable_drive/file_type")
|
||||
gcode_writer = Application.getInstance().getMeshFileHandler().getWriterByMimeType(file_type)
|
||||
if not gcode_writer:
|
||||
Logger.log("e", "Could not find GCode writer, not writing to removable drive %s", self.getName())
|
||||
Logger.log("e", "Could not find writer for MIME type %s, not writing to removable drive %s", file_type, self.getName())
|
||||
raise OutputDeviceError.WriteRequestFailedError()
|
||||
|
||||
if file_name == None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user