diff options
author | Jaime van Kessel <nallath@gmail.com> | 2020-01-16 11:50:45 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2020-01-16 11:50:45 +0300 |
commit | b8dbc1d1600c72f49ac7e9f781b0f5236afee201 (patch) | |
tree | 1cb8594634cc608c0e106f80e09afd50d9b782a7 /plugins/3MFWriter | |
parent | 6ae3172287a20cd2e54b22a95997aa10c7bfe29a (diff) |
Store the data from each plugin in it's own folder
CURA-6627
Diffstat (limited to 'plugins/3MFWriter')
-rw-r--r-- | plugins/3MFWriter/ThreeMFWorkspaceWriter.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py index 953b0a57e6..cd56e77ebd 100644 --- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py +++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py @@ -81,13 +81,15 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter): 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())) + file_name_template = "%s/plugin_metadata.json" + + for plugin_id, metadata in Application.getInstance()._workspace_metadata_storage.getAllData().items(): + file_name = file_name_template % plugin_id + file_in_archive = zipfile.ZipInfo(file_name) + # 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(metadata, separators = (", ", ": "), indent = 4)) ## Helper function that writes ContainerStacks, InstanceContainers and DefinitionContainers to the archive. # \param container That follows the \type{ContainerInterface} to archive. |