mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 17:27:51 -06:00
Give a warning when you can't update metadata because it's read-only
This bit me in the bum today.
This commit is contained in:
parent
0a325426d0
commit
e2a7a68883
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue