Add placeholder thumbnail to package

This kitten really likes boxes of all kinds: Cardboard and plastic boxes for sure, but also digital boxes such as the UFP.

Contributes to issue CURA-4872.
This commit is contained in:
Ghostkeeper 2018-01-26 13:52:20 +01:00
parent 8a3a3d32da
commit 8bd351c133
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
2 changed files with 6 additions and 1 deletions

View file

@ -3,6 +3,7 @@
from charon.VirtualFile import VirtualFile #To open UFP files.
from charon.OpenMode import OpenMode #To indicate that we want to write to UFP files.
import os.path #To get the placeholder kitty icon.
from UM.Mesh.MeshWriter import MeshWriter #The writer we need to implement.
from UM.PluginRegistry import PluginRegistry #To get the g-code writer.
@ -19,4 +20,8 @@ class UFPWriter(MeshWriter):
archive.addRelation(target = "/3D/model.gcode", file_type = "http://schemas.ultimaker.org/package/2018/relationships/gcode")
#Store the thumbnail.
#TODO
#TODO: Generate the thumbnail image. Below is just a placeholder.
archive.addContentType(extension = "png", mime_type = "image/png")
thumbnail = archive.getStream("/Metadata/thumbnail.png")
thumbnail.write(os.path.join(os.path.basename(__file__), "kitten.png"))
archive.addRelation(target = "/Metadata/thumbnail.png", file_type = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail")