mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-02 23:31:42 -07:00
Merge pull request #9153 from Ultimaker/CURA-7865_Save_file_in_existing_project_mvp
CURA-7865 Save file in existing project mvp
This commit is contained in:
commit
0ba3833995
4 changed files with 111 additions and 23 deletions
|
|
@ -72,24 +72,25 @@ 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")
|
||||
thumbnail = archive.getStream("/Metadata/thumbnail.png")
|
||||
|
||||
thumbnail_buffer = QBuffer()
|
||||
thumbnail_buffer.open(QBuffer.ReadWrite)
|
||||
thumbnail_image = self._snapshot
|
||||
thumbnail_image.save(thumbnail_buffer, "PNG")
|
||||
|
||||
thumbnail.write(thumbnail_buffer.data())
|
||||
archive.addRelation(virtual_path = "/Metadata/thumbnail.png",
|
||||
relation_type = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail",
|
||||
origin = "/3D/model.gcode")
|
||||
else:
|
||||
Logger.log("d", "Thumbnail not created, cannot save it")
|
||||
# TODO temporarily commented out, as is causes a crash whenever the UFPWriter is called outside of the main thread
|
||||
# self._createSnapshot()
|
||||
#
|
||||
# # Store the thumbnail.
|
||||
# if self._snapshot:
|
||||
# archive.addContentType(extension = "png", mime_type = "image/png")
|
||||
# thumbnail = archive.getStream("/Metadata/thumbnail.png")
|
||||
#
|
||||
# thumbnail_buffer = QBuffer()
|
||||
# thumbnail_buffer.open(QBuffer.ReadWrite)
|
||||
# thumbnail_image = self._snapshot
|
||||
# thumbnail_image.save(thumbnail_buffer, "PNG")
|
||||
#
|
||||
# thumbnail.write(thumbnail_buffer.data())
|
||||
# archive.addRelation(virtual_path = "/Metadata/thumbnail.png",
|
||||
# relation_type = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail",
|
||||
# origin = "/3D/model.gcode")
|
||||
# else:
|
||||
# Logger.log("d", "Thumbnail not created, cannot save it")
|
||||
|
||||
# Store the material.
|
||||
application = CuraApplication.getInstance()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue