mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 00:07:51 -06:00
[CURA-5775] The snaphot-creation of the UFP-writer should only be called when writing to UFP-files.
This commit is contained in:
parent
436860f841
commit
110d2daa81
1 changed files with 3 additions and 2 deletions
|
@ -27,14 +27,13 @@ class UFPWriter(MeshWriter):
|
||||||
|
|
||||||
MimeTypeDatabase.addMimeType(
|
MimeTypeDatabase.addMimeType(
|
||||||
MimeType(
|
MimeType(
|
||||||
name = "application/x-cura-stl-file",
|
name = "application/x-ufp",
|
||||||
comment = "Cura UFP File",
|
comment = "Cura UFP File",
|
||||||
suffixes = ["ufp"]
|
suffixes = ["ufp"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
self._snapshot = None
|
self._snapshot = None
|
||||||
Application.getInstance().getOutputDeviceManager().writeStarted.connect(self._createSnapshot)
|
|
||||||
|
|
||||||
def _createSnapshot(self, *args):
|
def _createSnapshot(self, *args):
|
||||||
# must be called from the main thread because of OpenGL
|
# 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"))
|
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")
|
archive.addRelation(virtual_path = "/3D/model.gcode", relation_type = "http://schemas.ultimaker.org/package/2018/relationships/gcode")
|
||||||
|
|
||||||
|
self._createSnapshot()
|
||||||
|
|
||||||
#Store the thumbnail.
|
#Store the thumbnail.
|
||||||
if self._snapshot:
|
if self._snapshot:
|
||||||
archive.addContentType(extension = "png", mime_type = "image/png")
|
archive.addContentType(extension = "png", mime_type = "image/png")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue