[CURA-5775] The snaphot-creation of the UFP-writer should only be called when writing to UFP-files.

This commit is contained in:
Remco Burema 2018-10-04 15:54:22 +02:00
parent 436860f841
commit 110d2daa81

View file

@ -27,14 +27,13 @@ class UFPWriter(MeshWriter):
MimeTypeDatabase.addMimeType(
MimeType(
name = "application/x-cura-stl-file",
name = "application/x-ufp",
comment = "Cura UFP File",
suffixes = ["ufp"]
)
)
self._snapshot = None
Application.getInstance().getOutputDeviceManager().writeStarted.connect(self._createSnapshot)
def _createSnapshot(self, *args):
# must be called from the main thread because of OpenGL
@ -62,6 +61,8 @@ class UFPWriter(MeshWriter):
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")
self._createSnapshot()
#Store the thumbnail.
if self._snapshot:
archive.addContentType(extension = "png", mime_type = "image/png")