Don't find any variants if the machine says it doesn't have them

Even if there might be a matching variant...

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-22 15:44:41 +02:00
parent 999e19940e
commit 0302ae4257
No known key found for this signature in database
GPG Key ID: 86BEF881AE2CF276
3 changed files with 9 additions and 1 deletions

View File

@ -32,6 +32,7 @@ class MachineNode(ContainerNode):
# ONLY DO THAT FOR METADATA THAT DOESN'T CHANGE DURING RUNTIME! # ONLY DO THAT FOR METADATA THAT DOESN'T CHANGE DURING RUNTIME!
# Otherwise you need to keep it up-to-date during runtime. # Otherwise you need to keep it up-to-date during runtime.
self.has_materials = parseBool(my_metadata.get("has_materials", "true")) self.has_materials = parseBool(my_metadata.get("has_materials", "true"))
self.has_variants = parseBool(my_metadata.get("has_variants", "false"))
self.has_machine_materials = parseBool(my_metadata.get("has_machine_materials", "false")) self.has_machine_materials = parseBool(my_metadata.get("has_machine_materials", "false"))
self.has_machine_quality = parseBool(my_metadata.get("has_machine_quality", "false")) self.has_machine_quality = parseBool(my_metadata.get("has_machine_quality", "false"))
self.quality_definition = my_metadata.get("quality_definition", container_id) self.quality_definition = my_metadata.get("quality_definition", container_id)
@ -91,6 +92,9 @@ class MachineNode(ContainerNode):
## (Re)loads all variants under this printer. ## (Re)loads all variants under this printer.
def _loadAll(self): def _loadAll(self):
if not self.has_variants:
return
# Find all the variants for this definition ID. # Find all the variants for this definition ID.
container_registry = ContainerRegistry.getInstance() container_registry = ContainerRegistry.getInstance()
variants = container_registry.findInstanceContainersMetadata(type = "variant", definition = self.container_id, hardware_type = "nozzle") variants = container_registry.findInstanceContainersMetadata(type = "variant", definition = self.container_id, hardware_type = "nozzle")

View File

@ -1,4 +1,4 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
@ -7,6 +7,7 @@ from UM.Application import Application
from UM.Logger import Logger from UM.Logger import Logger
from UM.Qt.ListModel import ListModel from UM.Qt.ListModel import ListModel
from UM.Util import parseBool from UM.Util import parseBool
from cura.Machines.ContainerTree import ContainerTree
from cura.Machines.VariantType import VariantType from cura.Machines.VariantType import VariantType
@ -37,6 +38,8 @@ class NozzleModel(ListModel):
if global_stack is None: if global_stack is None:
self.setItems([]) self.setItems([])
return return
machine_node = ContainerTree.getInstance().machines[global_stack.definition.getId()]
has_variants = parseBool(global_stack.getMetaDataEntry("has_variants", False)) has_variants = parseBool(global_stack.getMetaDataEntry("has_variants", False))
if not has_variants: if not has_variants:

View File

@ -11,6 +11,7 @@
"file_formats": "text/x-gcode;application/x-stl-ascii;application/x-stl-binary;application/x-wavefront-obj;application/x3g", "file_formats": "text/x-gcode;application/x-stl-ascii;application/x-stl-binary;application/x-wavefront-obj;application/x3g",
"visible": false, "visible": false,
"has_materials": true, "has_materials": true,
"has_variants": false,
"preferred_material": "generic_pla", "preferred_material": "generic_pla",
"preferred_quality_type": "normal", "preferred_quality_type": "normal",
"machine_extruder_trains": "machine_extruder_trains":