mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
Show custom qualities based on not supported
CURA-4796
This commit is contained in:
parent
73840f6bfc
commit
4abbd4b988
2 changed files with 13 additions and 8 deletions
|
@ -136,6 +136,9 @@ class QualityManager:
|
||||||
if basic_materials:
|
if basic_materials:
|
||||||
result = self._getFilteredContainersForStack(machine_definition, basic_materials, **criteria)
|
result = self._getFilteredContainersForStack(machine_definition, basic_materials, **criteria)
|
||||||
|
|
||||||
|
empty_quality = ContainerRegistry.getInstance().findInstanceContainers(id = "empty_quality")[0]
|
||||||
|
result.append(empty_quality)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
## Find all quality changes for a machine.
|
## Find all quality changes for a machine.
|
||||||
|
|
|
@ -36,6 +36,8 @@ class ProfilesModel(InstanceContainersModel):
|
||||||
Application.getInstance().getMachineManager().activeStackChanged.connect(self._update)
|
Application.getInstance().getMachineManager().activeStackChanged.connect(self._update)
|
||||||
Application.getInstance().getMachineManager().activeMaterialChanged.connect(self._update)
|
Application.getInstance().getMachineManager().activeMaterialChanged.connect(self._update)
|
||||||
|
|
||||||
|
self._empty_quality = ContainerRegistry.getInstance().findContainers(id = "empty_quality")[0]
|
||||||
|
|
||||||
# Factory function, used by QML
|
# Factory function, used by QML
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def createProfilesModel(engine, js_engine):
|
def createProfilesModel(engine, js_engine):
|
||||||
|
@ -72,11 +74,18 @@ class ProfilesModel(InstanceContainersModel):
|
||||||
# The actual list of quality profiles come from the first extruder in the extruder list.
|
# The actual list of quality profiles come from the first extruder in the extruder list.
|
||||||
result = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack, extruder_stacks)
|
result = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack, extruder_stacks)
|
||||||
|
|
||||||
|
# append empty quality if it's not there
|
||||||
|
if not any(q.getId() == self._empty_quality.getId() for q in result):
|
||||||
|
result.append(self._empty_quality)
|
||||||
|
|
||||||
# The usable quality types are set
|
# The usable quality types are set
|
||||||
quality_type_set = set([x.getMetaDataEntry("quality_type") for x in result])
|
quality_type_set = set([x.getMetaDataEntry("quality_type") for x in result])
|
||||||
|
|
||||||
# Fetch all qualities available for this machine and the materials selected in extruders
|
# Fetch all qualities available for this machine and the materials selected in extruders
|
||||||
all_qualities = QualityManager.getInstance().findAllQualitiesForMachineAndMaterials(global_stack_definition, materials)
|
all_qualities = QualityManager.getInstance().findAllQualitiesForMachineAndMaterials(global_stack_definition, materials)
|
||||||
|
# append empty quality if it's not there
|
||||||
|
if not any(q.getId() == self._empty_quality.getId() for q in all_qualities):
|
||||||
|
all_qualities.append(self._empty_quality)
|
||||||
|
|
||||||
# If in the all qualities there is some of them that are not available due to incompatibility with materials
|
# If in the all qualities there is some of them that are not available due to incompatibility with materials
|
||||||
# we also add it so that they will appear in the slide quality bar. However in recomputeItems will be marked as
|
# we also add it so that they will appear in the slide quality bar. However in recomputeItems will be marked as
|
||||||
|
@ -85,13 +94,7 @@ class ProfilesModel(InstanceContainersModel):
|
||||||
if quality.getMetaDataEntry("quality_type") not in quality_type_set:
|
if quality.getMetaDataEntry("quality_type") not in quality_type_set:
|
||||||
result.append(quality)
|
result.append(quality)
|
||||||
|
|
||||||
# if still profiles are found, add a single empty_quality ("Not supported") instance to the drop down list
|
return {item.getId(): item for item in result}, {} #Only return true profiles for now, no metadata. The quality manager is not able to get only metadata yet.
|
||||||
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 {item.getId():item for item in result}, {} #Only return true profiles for now, no metadata. The quality manager is not able to get only metadata yet.
|
|
||||||
|
|
||||||
## Re-computes the items in this model, and adds the layer height role.
|
## Re-computes the items in this model, and adds the layer height role.
|
||||||
def _recomputeItems(self):
|
def _recomputeItems(self):
|
||||||
|
@ -114,7 +117,6 @@ class ProfilesModel(InstanceContainersModel):
|
||||||
# active machine and material, and later yield the right ones.
|
# active machine and material, and later yield the right ones.
|
||||||
tmp_all_quality_items = OrderedDict()
|
tmp_all_quality_items = OrderedDict()
|
||||||
for item in super()._recomputeItems():
|
for item in super()._recomputeItems():
|
||||||
|
|
||||||
profiles = container_registry.findContainersMetadata(id = item["id"])
|
profiles = container_registry.findContainersMetadata(id = item["id"])
|
||||||
if not profiles or "quality_type" not in profiles[0]:
|
if not profiles or "quality_type" not in profiles[0]:
|
||||||
quality_type = ""
|
quality_type = ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue