Changed the entry point of the material guid to non-depricated spot

We depricated the GUID as entry point, but all printers support both right now.
This commit is contained in:
Jaime van Kessel 2016-10-26 13:38:09 +02:00
parent b1f3280b2d
commit 601bf20a96

View file

@ -68,12 +68,12 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
# "extruders": [ # "extruders": [
# { # {
# "feeder": {"max_speed": 45.0, "jerk": 5.0, "acceleration": 3000.0}, # "feeder": {"max_speed": 45.0, "jerk": 5.0, "acceleration": 3000.0},
# "active_material": {"GUID": "xxxxxxx", "length_remaining": -1.0}, # "active_material": {"guid": "xxxxxxx", "length_remaining": -1.0},
# "hotend": {"temperature": {"target": 0.0, "current": 22.8}, "id": "AA 0.4"} # "hotend": {"temperature": {"target": 0.0, "current": 22.8}, "id": "AA 0.4"}
# }, # },
# { # {
# "feeder": {"max_speed": 45.0, "jerk": 5.0, "acceleration": 3000.0}, # "feeder": {"max_speed": 45.0, "jerk": 5.0, "acceleration": 3000.0},
# "active_material": {"GUID": "xxxx", "length_remaining": -1.0}, # "active_material": {"guid": "xxxx", "length_remaining": -1.0},
# "hotend": {"temperature": {"target": 0.0, "current": 22.8}, "id": "BB 0.4"} # "hotend": {"temperature": {"target": 0.0, "current": 22.8}, "id": "BB 0.4"}
# } # }
# ], # ],
@ -421,7 +421,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
temperature = self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["temperature"]["current"] temperature = self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["temperature"]["current"]
self._setHotendTemperature(index, temperature) self._setHotendTemperature(index, temperature)
try: try:
material_id = self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["GUID"] material_id = self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["guid"]
except KeyError: except KeyError:
material_id = "" material_id = ""
self._setMaterialId(index, material_id) self._setMaterialId(index, material_id)
@ -504,7 +504,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
i18n_catalog.i18nc("@info:status", "Unable to start a new print job. No PrinterCore loaded in slot {0}".format(index + 1))) i18n_catalog.i18nc("@info:status", "Unable to start a new print job. No PrinterCore loaded in slot {0}".format(index + 1)))
self._error_message.show() self._error_message.show()
return return
if self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["GUID"] == "": if self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["guid"] == "":
Logger.log("e", "No material loaded in slot %s, unable to start print", index + 1) Logger.log("e", "No material loaded in slot %s, unable to start print", index + 1)
self._error_message = Message( self._error_message = Message(
i18n_catalog.i18nc("@info:status", i18n_catalog.i18nc("@info:status",
@ -533,7 +533,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
material = extruder_manager.getExtruderStack(index).findContainer({"type": "material"}) material = extruder_manager.getExtruderStack(index).findContainer({"type": "material"})
if material: if material:
remote_material_guid = self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["GUID"] remote_material_guid = self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["guid"]
if material.getMetaDataEntry("GUID") != remote_material_guid: if material.getMetaDataEntry("GUID") != remote_material_guid:
Logger.log("w", "Extruder %s has a different material (%s) as Cura (%s)", index + 1, Logger.log("w", "Extruder %s has a different material (%s) as Cura (%s)", index + 1,
remote_material_guid, remote_material_guid,