Merge branch 'master' of github.com:Ultimaker/Cura into network_rewrite

This commit is contained in:
Jaime van Kessel 2017-11-27 13:43:39 +01:00
commit 083eee2e9d
22 changed files with 129 additions and 80 deletions

View file

@ -454,16 +454,14 @@ class CuraContainerRegistry(ContainerRegistry):
material_id = "default"
if machine.material.getId() not in ("empty", "empty_material"):
# TODO: find the ID that's suitable for this extruder
pass
material_id = machine.material.getId()
else:
material_id = "empty_material"
extruder_stack.setMaterialById(material_id)
quality_id = "default"
if machine.quality.getId() not in ("empty", "empty_quality"):
# TODO: find the ID that's suitable for this extruder
pass
quality_id = machine.quality.getId()
else:
quality_id = "empty_quality"
extruder_stack.setQualityById(quality_id)

View file

@ -121,7 +121,7 @@ class CuraContainerStack(ContainerStack):
#
# \throws Exceptions.InvalidContainerError Raised when no container could be found with the specified ID.
def setQualityById(self, new_quality_id: str) -> None:
quality = self._empty_instance_container
quality = self._empty_quality
if new_quality_id == "default":
new_quality = self.findDefaultQuality()
if new_quality:
@ -159,7 +159,7 @@ class CuraContainerStack(ContainerStack):
#
# \throws Exceptions.InvalidContainerError Raised when no container could be found with the specified ID.
def setMaterialById(self, new_material_id: str) -> None:
material = self._empty_instance_container
material = self._empty_material
if new_material_id == "default":
new_material = self.findDefaultMaterial()
if new_material:
@ -197,7 +197,7 @@ class CuraContainerStack(ContainerStack):
#
# \throws Exceptions.InvalidContainerError Raised when no container could be found with the specified ID.
def setVariantById(self, new_variant_id: str) -> None:
variant = self._empty_instance_container
variant = self._empty_variant
if new_variant_id == "default":
new_variant = self.findDefaultVariant()
if new_variant:

View file

@ -769,9 +769,10 @@ class MachineManager(QObject):
candidate_quality = None
if quality_type:
candidate_quality = quality_manager.findQualityByQualityType(quality_type,
quality_manager.getWholeMachineDefinition(machine_definition),
quality_manager.getWholeMachineDefinition(material_container.getDefinition()),
[material_container])
if not candidate_quality or isinstance(candidate_quality, type(self._empty_quality_changes_container)):
Logger.log("d", "Attempting to find fallback quality")
# Fall back to a quality (which must be compatible with all other extruders)

View file

@ -18,4 +18,8 @@ class MaterialsModel(InstanceContainersModel):
# \param container The container whose metadata was changed.
def _onContainerMetaDataChanged(self, container):
if container.getMetaDataEntry("type") == "material": #Only need to update if a material was changed.
self._update()
self._update()
def _onContainerChanged(self, container):
if container.getMetaDataEntry("type", "") == "material":
super()._onContainerChanged(container)