mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 20:28:01 -06:00
Use new MachineNode.getQualityChangesGroups instead of quality manager
I hope that the machine node doesn't become a collection of functions that don't fit anywhere else, but this isn't contributing to that hope. However I still think that this is particular to a certain printer, so it's within the object-oriented programming paradigm. And it's also within the scope of the class, which is getting the available profiles. So it still sort of fits. Contributes to issue CURA-6600.
This commit is contained in:
parent
b1ce9b64d4
commit
51710c2868
2 changed files with 15 additions and 31 deletions
|
@ -4,15 +4,12 @@
|
|||
from UM.Logger import Logger
|
||||
|
||||
import cura.CuraApplication # Imported this way to prevent circular references.
|
||||
from cura.Machines.ContainerTree import ContainerTree
|
||||
from cura.Machines.Models.QualityProfilesDropDownMenuModel import QualityProfilesDropDownMenuModel
|
||||
from cura.Machines.QualityManager import QualityManager
|
||||
|
||||
|
||||
#
|
||||
# This model is used for the custom profile items in the profile drop down menu.
|
||||
#
|
||||
## This model is used for the custom profile items in the profile drop down
|
||||
# menu.
|
||||
class CustomQualityProfilesDropDownMenuModel(QualityProfilesDropDownMenuModel):
|
||||
|
||||
def _update(self):
|
||||
Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__))
|
||||
|
||||
|
@ -22,12 +19,14 @@ class CustomQualityProfilesDropDownMenuModel(QualityProfilesDropDownMenuModel):
|
|||
Logger.log("d", "No active GlobalStack, set %s as empty.", self.__class__.__name__)
|
||||
return
|
||||
|
||||
quality_changes_group_dict = QualityManager.getInstance().getQualityChangesGroups(active_global_stack)
|
||||
variant_names = [extruder.variant.getName() for extruder in active_global_stack.extruders.values()]
|
||||
material_bases = [extruder.material.getMetaDataEntry("base_file") for extruder in active_global_stack.extruders.values()]
|
||||
extruder_enabled = [extruder.isEnabled for extruder in active_global_stack.extruders.values()]
|
||||
machine_node = ContainerTree.getInstance().machines[active_global_stack.definition.getId()]
|
||||
quality_changes_list = machine_node.getQualityChangesGroups(variant_names, material_bases, extruder_enabled)
|
||||
|
||||
item_list = []
|
||||
for key in sorted(quality_changes_group_dict, key = lambda name: name.upper()):
|
||||
quality_changes_group = quality_changes_group_dict[key]
|
||||
|
||||
for quality_changes_group in sorted(quality_changes_list, key = lambda qgc: qgc.name.lower()):
|
||||
item = {"name": quality_changes_group.name,
|
||||
"layer_height": "",
|
||||
"layer_height_without_unit": "",
|
||||
|
@ -36,4 +35,4 @@ class CustomQualityProfilesDropDownMenuModel(QualityProfilesDropDownMenuModel):
|
|||
|
||||
item_list.append(item)
|
||||
|
||||
self.setItems(item_list)
|
||||
self.setItems(item_list)
|
Loading…
Add table
Add a link
Reference in a new issue