mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 10:17:52 -06:00
First steps towards salvation - CURA-4451
This commit is contained in:
parent
3ef680af5e
commit
d018e0b2bb
1 changed files with 12 additions and 12 deletions
|
@ -72,6 +72,15 @@ 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)
|
||||||
|
|
||||||
|
# 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()
|
||||||
|
not_supported_container = self.generateNoSupportedInstanceContainer(machine_id, material_id)
|
||||||
|
result.append(not_supported_container)
|
||||||
|
# ContainerRegistry.getInstance().addContainer(not_supported_container)
|
||||||
|
return result
|
||||||
|
|
||||||
# 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])
|
||||||
|
|
||||||
|
@ -85,26 +94,17 @@ 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 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()
|
|
||||||
result.append(self.generateNoSupportedInstanceContainer(machine_id, material_id))
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def generateNoSupportedInstanceContainer(self, machine_id: str, material_id: str):
|
def generateNoSupportedInstanceContainer(self, machine_id: str, material_id: str):
|
||||||
container = InstanceContainer("not_supported")
|
container = InstanceContainer("not_supported")
|
||||||
container.setName("Not Supported")
|
container.setName("Not Supported")
|
||||||
container.metaData["quality_type"] = "normal"
|
|
||||||
container.metaData["setting_version"] = 3
|
container.metaData["setting_version"] = 3
|
||||||
container.metaData["supported"] = False
|
container.metaData["supported"] = False
|
||||||
container.metaData["type"] = "quality"
|
container.metaData["type"] = "quality"
|
||||||
container.metaData["weight"] = "0"
|
container.metaData["weight"] = "0"
|
||||||
container.metaData["material"] = material_id
|
container.metaData["material"] = material_id
|
||||||
container.readOnly = True
|
container.metaData["quality_type"] = "normal"
|
||||||
container.setDirty(False)
|
|
||||||
container.setCachedValues({})
|
|
||||||
definition = ContainerRegistry.getInstance().findDefinitionContainers(id = machine_id)
|
definition = ContainerRegistry.getInstance().findDefinitionContainers(id = machine_id)
|
||||||
container.setDefinition(definition)
|
container.setDefinition(definition)
|
||||||
return container
|
return container
|
||||||
|
@ -181,8 +181,8 @@ class ProfilesModel(InstanceContainersModel):
|
||||||
for item in containers:
|
for item in containers:
|
||||||
profile = container_registry.findContainers(id=item["id"])
|
profile = container_registry.findContainers(id=item["id"])
|
||||||
if not profile:
|
if not profile:
|
||||||
self._setItemLayerHeight(item, "", unit)
|
self._setItemLayerHeight(item, "", "")
|
||||||
item["available"] = False
|
item["available"] = True
|
||||||
yield item
|
yield item
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue