Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Prado Gesto <d.pradogesto@ultimaker.com>2018-08-03 13:02:11 +0300
committerDiego Prado Gesto <d.pradogesto@ultimaker.com>2018-08-03 13:02:11 +0300
commit38a0c9b66de36f46390b42834f595557a56d1df0 (patch)
treee877de6dceedc746423590b3f38807a03c94ae70 /plugins/UFPWriter
parentd8abf8f47046087317e785897d7b829a31fecac4 (diff)
Add some extra information when the Cura can't write the files.
Diffstat (limited to 'plugins/UFPWriter')
-rw-r--r--plugins/UFPWriter/UFPWriter.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/UFPWriter/UFPWriter.py b/plugins/UFPWriter/UFPWriter.py
index aca293e25a..9344bf54da 100644
--- a/plugins/UFPWriter/UFPWriter.py
+++ b/plugins/UFPWriter/UFPWriter.py
@@ -1,5 +1,6 @@
#Copyright (c) 2018 Ultimaker B.V.
#Cura is released under the terms of the LGPLv3 or higher.
+from typing import cast
from Charon.VirtualFile import VirtualFile #To open UFP files.
from Charon.OpenMode import OpenMode #To indicate that we want to write to UFP files.
@@ -13,6 +14,9 @@ from PyQt5.QtCore import QBuffer
from cura.Snapshot import Snapshot
+from UM.i18n import i18nCatalog
+catalog = i18nCatalog("cura")
+
class UFPWriter(MeshWriter):
def __init__(self):
@@ -32,7 +36,11 @@ class UFPWriter(MeshWriter):
#Store the g-code from the scene.
archive.addContentType(extension = "gcode", mime_type = "text/x-gcode")
gcode_textio = StringIO() #We have to convert the g-code into bytes.
- PluginRegistry.getInstance().getPluginObject("GCodeWriter").write(gcode_textio, None)
+ gcode_writer = cast(MeshWriter, PluginRegistry.getInstance().getPluginObject("GCodeWriter"))
+ success = gcode_writer.write(gcode_textio, None)
+ if not success: #Writing the g-code failed. Then I can also not write the gzipped g-code.
+ self.setInformation(gcode_writer.getInformation())
+ return False
gcode = archive.getStream("/3D/model.gcode")
gcode.write(gcode_textio.getvalue().encode("UTF-8"))
archive.addRelation(virtual_path = "/3D/model.gcode", relation_type = "http://schemas.ultimaker.org/package/2018/relationships/gcode")