Write to SD Card directly when it has been detected

This commit is contained in:
Arjen Hiemstra 2015-03-16 11:44:03 +01:00
parent 53f2eb7e13
commit 3a2aa12bc3
3 changed files with 19 additions and 2 deletions

View file

@ -6,6 +6,8 @@ from UM.Math.Vector import Vector
from UM.Math.Matrix import Matrix
from UM.Resources import Resources
from UM.Scene.ToolHandle import ToolHandle
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Mesh.WriteMeshJob import WriteMeshJob
from UM.Scene.BoxRenderer import BoxRenderer
from UM.Scene.Selection import Selection
@ -132,6 +134,20 @@ class PrinterApplication(QtApplication):
def removableDrives(self):
return list(self.getStorageDevice('LocalFileStorage').getRemovableDrives().keys())
@pyqtSlot()
def saveToSD(self):
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
if type(node) is not SceneNode or not node.getMeshData():
continue
drives = self.getStorageDevice('LocalFileStorage').getRemovableDrives()
path = next(iter(drives.values()))
filename = os.path.join(path, node.getName()[0:node.getName().rfind('.')] + '.gcode')
job = WriteMeshJob(filename, node.getMeshData())
job.start()
return
def _removableDrivesChanged(self):
print(self.getStorageDevice('LocalFileStorage').getRemovableDrives())
self.removableDrivesChanged.emit()