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

Contributes to issue CURA-4357.
This commit is contained in:
Ghostkeeper 2017-09-22 12:58:20 +02:00
commit 2020e355a2
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75
2 changed files with 132 additions and 143 deletions

View file

@ -110,12 +110,11 @@ class ProfilesModel(InstanceContainersModel):
# active machine and material, and later yield the right ones.
tmp_all_quality_items = OrderedDict()
for item in super()._recomputeItems():
profile = container_registry.findContainers(id = item["id"])
profile = container_registry.findContainers(id=item["id"])
quality_type = profile[0].getMetaDataEntry("quality_type") if profile else ""
if quality_type not in tmp_all_quality_items:
tmp_all_quality_items[quality_type] = {"suitable_container": None,
"all_containers": []}
tmp_all_quality_items[quality_type] = {"suitable_container": None, "all_containers": []}
tmp_all_quality_items[quality_type]["all_containers"].append(item)
if tmp_all_quality_items[quality_type]["suitable_container"] is None and profile[0] in qualities:
@ -126,25 +125,14 @@ class ProfilesModel(InstanceContainersModel):
for key in reversed(tmp_all_quality_items.keys()):
all_quality_items[key] = tmp_all_quality_items[key]
# First the suitable containers are set in the model
containers = []
for data_item in all_quality_items.values():
suitable_item = data_item["suitable_container"]
if suitable_item is None:
suitable_item = data_item["all_containers"][0]
containers.append(suitable_item)
item = data_item["suitable_container"]
if item is None:
item = data_item["all_containers"][0]
# Once the suitable containers are collected, the rest of the containers are appended
for data_item in all_quality_items.values():
for item in data_item["all_containers"]:
if item not in containers:
containers.append(item)
# Now all the containers are set
for item in containers:
profile = container_registry.findContainers(id = item["id"])
if not profile:
item["layer_height"] = "" #Can't update a profile that is unknown.
item["layer_height"] = "" # Can't update a profile that is unknown.
item["available"] = False
yield item
continue
@ -152,13 +140,13 @@ class ProfilesModel(InstanceContainersModel):
profile = profile[0]
item["available"] = profile in qualities
#Easy case: This profile defines its own layer height.
# Easy case: This profile defines its own layer height.
if profile.hasProperty("layer_height", "value"):
self._setItemLayerHeight(item, profile.getProperty("layer_height", "value"), unit)
yield item
continue
#Quality-changes profile that has no value for layer height. Get the corresponding quality profile and ask that profile.
# Quality-changes profile that has no value for layer height. Get the corresponding quality profile and ask that profile.
quality_type = profile.getMetaDataEntry("quality_type", None)
if quality_type:
quality_results = machine_manager.determineQualityAndQualityChangesForQualityType(quality_type)