mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 01:07:52 -06:00
Remove some changes, debugging - CURA-4451
WIP - CURA-4451 correctly show not supported when any of the extruders has a not supported profile - CURA-4451 Clean up and add comments - CURA-4451
This commit is contained in:
parent
c679f4aa6b
commit
b95ba24530
12 changed files with 136 additions and 159 deletions
|
@ -6,12 +6,12 @@ from collections import OrderedDict
|
|||
from PyQt5.QtCore import Qt
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.Logger import Logger
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
from UM.Settings.Models.InstanceContainersModel import InstanceContainersModel
|
||||
|
||||
from cura.QualityManager import QualityManager
|
||||
from cura.Settings.ExtruderManager import ExtruderManager
|
||||
from cura.Settings.NotSupportedProfileContainer import NotSupportedProfileContainer
|
||||
|
||||
|
||||
## QML Model for listing the current list of valid quality profiles.
|
||||
|
@ -20,14 +20,12 @@ class ProfilesModel(InstanceContainersModel):
|
|||
LayerHeightRole = Qt.UserRole + 1001
|
||||
LayerHeightWithoutUnitRole = Qt.UserRole + 1002
|
||||
AvailableRole = Qt.UserRole + 1003
|
||||
NotSupportedRole = Qt.UserRole + 1004
|
||||
|
||||
def __init__(self, parent = None):
|
||||
super().__init__(parent)
|
||||
self.addRoleName(self.LayerHeightRole, "layer_height")
|
||||
self.addRoleName(self.LayerHeightWithoutUnitRole, "layer_height_without_unit")
|
||||
self.addRoleName(self.AvailableRole, "available")
|
||||
self.addRoleName(self.NotSupportedRole, "not_supported")
|
||||
|
||||
Application.getInstance().globalContainerStackChanged.connect(self._update)
|
||||
|
||||
|
@ -74,15 +72,6 @@ class ProfilesModel(InstanceContainersModel):
|
|||
# The actual list of quality profiles come from the first extruder in the extruder list.
|
||||
result = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack, extruder_stacks)
|
||||
|
||||
# If not qualities are found we dynamically create an empty container with name "Not Supported"
|
||||
if len(result) == 0:
|
||||
machine_id = global_container_stack.definition.getId()
|
||||
material_id = extruder_stacks[0].material.getId()
|
||||
container_id = machine_id + "_" + material_id + "_not_supported"
|
||||
not_supported_container = NotSupportedProfileContainer(container_id, machine_id, material_id)
|
||||
result.append(not_supported_container)
|
||||
return result
|
||||
|
||||
# The usable quality types are set
|
||||
quality_type_set = set([x.getMetaDataEntry("quality_type") for x in result])
|
||||
|
||||
|
@ -96,6 +85,12 @@ class ProfilesModel(InstanceContainersModel):
|
|||
if quality.getMetaDataEntry("quality_type") not in quality_type_set:
|
||||
result.append(quality)
|
||||
|
||||
# if still profiles are found, add a single empty_quality ("Not supported") instance to the drop down list
|
||||
if len(result) == 0:
|
||||
# If not qualities are found we dynamically create a not supported container for this machine + material combination
|
||||
not_supported_container = ContainerRegistry.getInstance().findContainers(id = "empty_quality")[0]
|
||||
result.append(not_supported_container)
|
||||
|
||||
return result
|
||||
|
||||
## Re-computes the items in this model, and adds the layer height role.
|
||||
|
@ -127,8 +122,7 @@ class ProfilesModel(InstanceContainersModel):
|
|||
extruder_stacks = new_extruder_stacks + extruder_stacks
|
||||
|
||||
# Get a list of usable/available qualities for this machine and material
|
||||
qualities = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack,
|
||||
extruder_stacks)
|
||||
qualities = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack, extruder_stacks)
|
||||
|
||||
container_registry = ContainerRegistry.getInstance()
|
||||
machine_manager = Application.getInstance().getMachineManager()
|
||||
|
@ -177,17 +171,23 @@ class ProfilesModel(InstanceContainersModel):
|
|||
if not profile:
|
||||
self._setItemLayerHeight(item, "", "")
|
||||
item["available"] = False
|
||||
item["not_supported"] = True
|
||||
yield item
|
||||
continue
|
||||
|
||||
profile = profile[0]
|
||||
|
||||
# empty qualities should show in the list (they are "Not Supported" profiles)
|
||||
if profile.getId() == "empty_quality":
|
||||
self._setItemLayerHeight(item, "", "")
|
||||
item["available"] = True
|
||||
yield item
|
||||
continue
|
||||
|
||||
item["available"] = profile in qualities
|
||||
|
||||
# Easy case: This profile defines its own layer height.
|
||||
if profile.hasProperty("layer_height", "value"):
|
||||
self._setItemLayerHeight(item, profile.getProperty("layer_height", "value"), unit)
|
||||
item["not_supported"] = False
|
||||
yield item
|
||||
continue
|
||||
|
||||
|
@ -199,14 +199,14 @@ class ProfilesModel(InstanceContainersModel):
|
|||
if quality_result["stack"] is global_container_stack:
|
||||
quality = quality_result["quality"]
|
||||
break
|
||||
else: #No global container stack in the results:
|
||||
else:
|
||||
# No global container stack in the results:
|
||||
if quality_results:
|
||||
quality = quality_results[0]["quality"] #Take any of the extruders.
|
||||
quality = quality_results[0]["quality"] # Take any of the extruders.
|
||||
else:
|
||||
quality = None
|
||||
if quality and quality.hasProperty("layer_height", "value"):
|
||||
self._setItemLayerHeight(item, quality.getProperty("layer_height", "value"), unit)
|
||||
item["not_supported"] = False
|
||||
yield item
|
||||
continue
|
||||
|
||||
|
@ -217,7 +217,6 @@ class ProfilesModel(InstanceContainersModel):
|
|||
if not skip_until_container or skip_until_container == ContainerRegistry.getInstance().getEmptyInstanceContainer(): #No variant in stack.
|
||||
skip_until_container = global_container_stack.getBottom()
|
||||
self._setItemLayerHeight(item, global_container_stack.getRawProperty("layer_height", "value", skip_until_container = skip_until_container.getId()), unit) # Fall through to the currently loaded material.
|
||||
item["not_supported"] = False
|
||||
yield item
|
||||
|
||||
def _setItemLayerHeight(self, item, value, unit):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue