From b8dbc1d1600c72f49ac7e9f781b0f5236afee201 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 Jan 2020 09:50:45 +0100 Subject: [PATCH] Store the data from each plugin in it's own folder CURA-6627 --- plugins/3MFWriter/ThreeMFWorkspaceWriter.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 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_name_template = "%s/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())) + 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.