mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06: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
1 changed files with 6 additions and 2 deletions
|
@ -8,6 +8,7 @@ from UM.Mesh.MeshWriter import MeshWriter
|
||||||
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
||||||
from UM.OutputDevice.OutputDevice import OutputDevice
|
from UM.OutputDevice.OutputDevice import OutputDevice
|
||||||
from UM.OutputDevice import OutputDeviceError
|
from UM.OutputDevice import OutputDeviceError
|
||||||
|
from UM.Preferences import Preferences
|
||||||
|
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
@ -22,15 +23,18 @@ class RemovableDriveOutputDevice(OutputDevice):
|
||||||
self.setIconName("save_sd")
|
self.setIconName("save_sd")
|
||||||
self.setPriority(1)
|
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
|
self._writing = False
|
||||||
|
|
||||||
def requestWrite(self, node, file_name = None):
|
def requestWrite(self, node, file_name = None):
|
||||||
if self._writing:
|
if self._writing:
|
||||||
raise OutputDeviceError.DeviceBusyError()
|
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:
|
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()
|
raise OutputDeviceError.WriteRequestFailedError()
|
||||||
|
|
||||||
if file_name == None:
|
if file_name == None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue