mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 22:35:56 +08:00
CURA-4606 incompatible material(s) now results in an empty quality list
This commit is contained in:
parent
b96d49c010
commit
8401e1c7f7
@ -48,12 +48,18 @@ class QualityProfilesModel(ListModel):
|
|||||||
def _update(self):
|
def _update(self):
|
||||||
Logger.log("d", "Updating quality profile model ...")
|
Logger.log("d", "Updating quality profile model ...")
|
||||||
|
|
||||||
active_global_stack = Application.getInstance().getMachineManager()._global_container_stack
|
machine_manager = Application.getInstance().getMachineManager()
|
||||||
|
active_global_stack = machine_manager._global_container_stack
|
||||||
if active_global_stack is None:
|
if active_global_stack is None:
|
||||||
self.setItems([])
|
self.setItems([])
|
||||||
Logger.log("d", "No active GlobalStack, set quality profile model as empty.")
|
Logger.log("d", "No active GlobalStack, set quality profile model as empty.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Check for material compatibility
|
||||||
|
if not machine_manager.activeMaterialsCompatible():
|
||||||
|
self.setItems([])
|
||||||
|
return
|
||||||
|
|
||||||
quality_group_dict = self._quality_manager.getQualityGroups(active_global_stack)
|
quality_group_dict = self._quality_manager.getQualityGroups(active_global_stack)
|
||||||
|
|
||||||
item_list = []
|
item_list = []
|
||||||
|
@ -1018,6 +1018,13 @@ class MachineManager(QObject):
|
|||||||
self._current_root_material_id[position] = root_material_id
|
self._current_root_material_id[position] = root_material_id
|
||||||
self.rootMaterialChanged.emit()
|
self.rootMaterialChanged.emit()
|
||||||
|
|
||||||
|
def activeMaterialsCompatible(self):
|
||||||
|
# check material - variant compatibility
|
||||||
|
for position, extruder in self._global_container_stack.extruders.items():
|
||||||
|
if not extruder.material.getMetaDataEntry("compatible"):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
## Update current quality type and machine after setting material
|
## Update current quality type and machine after setting material
|
||||||
def _updateQualityWithMaterial(self):
|
def _updateQualityWithMaterial(self):
|
||||||
current_quality = None
|
current_quality = None
|
||||||
@ -1027,6 +1034,11 @@ class MachineManager(QObject):
|
|||||||
candidate_quality_groups = quality_manager.getQualityGroups(self._global_container_stack)
|
candidate_quality_groups = quality_manager.getQualityGroups(self._global_container_stack)
|
||||||
available_quality_types = {qt for qt, g in candidate_quality_groups.items() if g.is_available}
|
available_quality_types = {qt for qt, g in candidate_quality_groups.items() if g.is_available}
|
||||||
|
|
||||||
|
if not self.activeMaterialsCompatible:
|
||||||
|
Logger.log("d", "Material [%s] is not compatible, setting empty material." % str(extruder.material))
|
||||||
|
self._setEmptyQuality()
|
||||||
|
return
|
||||||
|
|
||||||
if not available_quality_types:
|
if not available_quality_types:
|
||||||
self._setEmptyQuality()
|
self._setEmptyQuality()
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user