Merge branch '2.3'

This commit is contained in:
Simon Edwards 2016-10-13 10:59:32 +02:00
commit 8b75dd5f97
5 changed files with 37 additions and 12 deletions

View file

@ -148,7 +148,17 @@ class MachineManager(QObject):
if matching_extruder and matching_extruder.findContainer({"type": "material"}).getMetaDataEntry("GUID") != material_id:
# Save the material that needs to be changed. Multiple changes will be handled by the callback.
self._auto_materials_changed[str(index)] = containers[0].getId()
if matching_extruder:
variant_container = matching_extruder.findContainer({"type": "variant"})
if self._global_container_stack.getBottom().getMetaDataEntry("has_variants") and variant_container:
variant_id = self.getQualityVariantId(self._global_container_stack.getBottom(), variant_container)
for container in containers:
if container.getMetaDataEntry("variant") == variant_id:
self._auto_materials_changed[str(index)] = container.getId()
break
else:
# Just use the first result we found.
self._auto_materials_changed[str(index)] = containers[0].getId()
self._printer_output_devices[0].materialHotendChangedMessage(self._materialHotendChangedCallback)
else:
Logger.log("w", "No material definition found for printer definition %s and GUID %s" % (definition_id, material_id))
@ -498,8 +508,8 @@ class MachineManager(QObject):
@pyqtProperty(str, notify = activeQualityChanged)
def activeQualityType(self):
if self._global_container_stack:
quality = self._global_container_stack.findContainer(type = "quality")
if self._active_container_stack:
quality = self._active_container_stack.findContainer(type = "quality")
if quality:
return quality.getMetaDataEntry("quality_type")
return ""
@ -529,8 +539,8 @@ class MachineManager(QObject):
@pyqtProperty(str, notify = activeQualityChanged)
def activeQualityChangesId(self):
if self._global_container_stack:
changes = self._global_container_stack.findContainer(type = "quality_changes")
if self._active_container_stack:
changes = self._active_container_stack.findContainer(type = "quality_changes")
if changes:
return changes.getId()
return ""