mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Store metadata when writing the workspace
This commit is contained in:
parent
b6d1429eb7
commit
6ae3172287
1 changed files with 11 additions and 0 deletions
|
@ -73,11 +73,22 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
||||||
version_config_parser.write(version_file_string)
|
version_config_parser.write(version_file_string)
|
||||||
archive.writestr(version_file, version_file_string.getvalue())
|
archive.writestr(version_file, version_file_string.getvalue())
|
||||||
|
|
||||||
|
self._writePluginMetadataToArchive(archive)
|
||||||
|
|
||||||
# Close the archive & reset states.
|
# Close the archive & reset states.
|
||||||
archive.close()
|
archive.close()
|
||||||
mesh_writer.setStoreArchive(False)
|
mesh_writer.setStoreArchive(False)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _writePluginMetadataToArchive(self, archive):
|
||||||
|
file_name = "Cura/plugin_metadata.json"
|
||||||
|
|
||||||
|
file_in_archive = zipfile.ZipInfo(file_name)
|
||||||
|
# For some reason we have to set the compress type of each file as well (it doesn't keep the type of the entire archive)
|
||||||
|
file_in_archive.compress_type = zipfile.ZIP_DEFLATED
|
||||||
|
import json
|
||||||
|
archive.writestr(file_in_archive, json.dumps(Application.getInstance()._workspace_metadata_storage.getAllData()))
|
||||||
|
|
||||||
## Helper function that writes ContainerStacks, InstanceContainers and DefinitionContainers to the archive.
|
## Helper function that writes ContainerStacks, InstanceContainers and DefinitionContainers to the archive.
|
||||||
# \param container That follows the \type{ContainerInterface} to archive.
|
# \param container That follows the \type{ContainerInterface} to archive.
|
||||||
# \param archive The archive to write to.
|
# \param archive The archive to write to.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue