From e2a7a6888374a5000ac7ad961919922ed0fbc931 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 14 Feb 2019 13:26:20 +0100 Subject: [PATCH] Give a warning when you can't update metadata because it's read-only This bit me in the bum today. --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index ac63270a8e..24fa641ec4 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Ultimaker B.V. +# Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import copy @@ -60,6 +60,7 @@ class XmlMaterialProfile(InstanceContainer): def setMetaDataEntry(self, key, value, apply_to_all = True): registry = ContainerRegistry.getInstance() if registry.isReadOnly(self.getId()): + Logger.log("w", "Can't change metadata {key} of material {material_id} because it's read-only.".format(key = key, material_id = self.getId())) return # Prevent recursion @@ -121,6 +122,8 @@ class XmlMaterialProfile(InstanceContainer): registry = ContainerRegistry.getInstance() base_file = self.getMetaDataEntry("base_file", "") + print("--------base_file:", base_file) + print("--------metadata:", self._metadata) if base_file and self.getId() != base_file: # Since we create an instance of XmlMaterialProfile for each machine and nozzle in the profile, # we should only serialize the "base" material definition, since that can then take care of