mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Adapt to Python 3.9 API changes
Python 3.9 now made the TreeBuilder.start() `attrs` parameter ([1]) mandatory on all implementations. Adapt the plugin accordingly. [1] https://bugs.python.org/issue39495
This commit is contained in:
parent
9562dc01f4
commit
352fef3efa
1 changed files with 11 additions and 11 deletions
|
@ -151,7 +151,7 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
"version": self.CurrentFdmMaterialVersion})
|
"version": self.CurrentFdmMaterialVersion})
|
||||||
|
|
||||||
## Begin Metadata Block
|
## Begin Metadata Block
|
||||||
builder.start("metadata") # type: ignore
|
builder.start("metadata", {}) # type: ignore
|
||||||
|
|
||||||
metadata = copy.deepcopy(self.getMetaData())
|
metadata = copy.deepcopy(self.getMetaData())
|
||||||
# setting_version is derived from the "version" tag in the schema, so don't serialize it into a file
|
# setting_version is derived from the "version" tag in the schema, so don't serialize it into a file
|
||||||
|
@ -165,21 +165,21 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
properties = metadata.pop("properties", {})
|
properties = metadata.pop("properties", {})
|
||||||
|
|
||||||
## Begin Name Block
|
## Begin Name Block
|
||||||
builder.start("name") # type: ignore
|
builder.start("name", {}) # type: ignore
|
||||||
|
|
||||||
builder.start("brand") # type: ignore
|
builder.start("brand", {}) # type: ignore
|
||||||
builder.data(metadata.pop("brand", ""))
|
builder.data(metadata.pop("brand", ""))
|
||||||
builder.end("brand")
|
builder.end("brand")
|
||||||
|
|
||||||
builder.start("material") # type: ignore
|
builder.start("material", {}) # type: ignore
|
||||||
builder.data(metadata.pop("material", ""))
|
builder.data(metadata.pop("material", ""))
|
||||||
builder.end("material")
|
builder.end("material")
|
||||||
|
|
||||||
builder.start("color") # type: ignore
|
builder.start("color", {}) # type: ignore
|
||||||
builder.data(metadata.pop("color_name", ""))
|
builder.data(metadata.pop("color_name", ""))
|
||||||
builder.end("color")
|
builder.end("color")
|
||||||
|
|
||||||
builder.start("label") # type: ignore
|
builder.start("label", {}) # type: ignore
|
||||||
builder.data(self.getName())
|
builder.data(self.getName())
|
||||||
builder.end("label")
|
builder.end("label")
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
key_to_use = key
|
key_to_use = key
|
||||||
if key in self._metadata_tags_that_have_cura_namespace:
|
if key in self._metadata_tags_that_have_cura_namespace:
|
||||||
key_to_use = "cura:" + key_to_use
|
key_to_use = "cura:" + key_to_use
|
||||||
builder.start(key_to_use) # type: ignore
|
builder.start(key_to_use, {}) # type: ignore
|
||||||
if value is not None: #Nones get handled well by the builder.
|
if value is not None: #Nones get handled well by the builder.
|
||||||
#Otherwise the builder always expects a string.
|
#Otherwise the builder always expects a string.
|
||||||
#Deserialize expects the stringified version.
|
#Deserialize expects the stringified version.
|
||||||
|
@ -202,10 +202,10 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
## End Metadata Block
|
## End Metadata Block
|
||||||
|
|
||||||
## Begin Properties Block
|
## Begin Properties Block
|
||||||
builder.start("properties") # type: ignore
|
builder.start("properties", {}) # type: ignore
|
||||||
|
|
||||||
for key, value in properties.items():
|
for key, value in properties.items():
|
||||||
builder.start(key) # type: ignore
|
builder.start(key, {}) # type: ignore
|
||||||
builder.data(value)
|
builder.data(value)
|
||||||
builder.end(key)
|
builder.end(key)
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
## End Properties Block
|
## End Properties Block
|
||||||
|
|
||||||
## Begin Settings Block
|
## Begin Settings Block
|
||||||
builder.start("settings") # type: ignore
|
builder.start("settings", {}) # type: ignore
|
||||||
|
|
||||||
if self.getMetaDataEntry("definition") == "fdmprinter":
|
if self.getMetaDataEntry("definition") == "fdmprinter":
|
||||||
for instance in self.findInstances():
|
for instance in self.findInstances():
|
||||||
|
@ -258,7 +258,7 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
product = product_name
|
product = product_name
|
||||||
break
|
break
|
||||||
|
|
||||||
builder.start("machine") # type: ignore
|
builder.start("machine", {}) # type: ignore
|
||||||
builder.start("machine_identifier", {
|
builder.start("machine_identifier", {
|
||||||
"manufacturer": container.getMetaDataEntry("machine_manufacturer",
|
"manufacturer": container.getMetaDataEntry("machine_manufacturer",
|
||||||
definition_metadata.get("manufacturer", "Unknown")),
|
definition_metadata.get("manufacturer", "Unknown")),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue