mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 03:07:53 -06:00
Disable material if not compatible
Similar to how it's displayed in the printer. Contributes to issue CURA-5460.
This commit is contained in:
parent
16226bdd48
commit
c0fc0a7eba
5 changed files with 12 additions and 7 deletions
|
@ -21,10 +21,11 @@ class BaseMaterialsModel(ListModel):
|
||||||
MaterialRole = Qt.UserRole + 5
|
MaterialRole = Qt.UserRole + 5
|
||||||
ColorRole = Qt.UserRole + 6
|
ColorRole = Qt.UserRole + 6
|
||||||
ContainerNodeRole = Qt.UserRole + 7
|
ContainerNodeRole = Qt.UserRole + 7
|
||||||
|
CompatibleRole = Qt.UserRole + 8
|
||||||
|
|
||||||
extruderPositionChanged = pyqtSignal()
|
extruderPositionChanged = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None) -> None:
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self._application = Application.getInstance()
|
self._application = Application.getInstance()
|
||||||
self._machine_manager = self._application.getMachineManager()
|
self._machine_manager = self._application.getMachineManager()
|
||||||
|
@ -36,6 +37,7 @@ class BaseMaterialsModel(ListModel):
|
||||||
self.addRoleName(self.MaterialRole, "material")
|
self.addRoleName(self.MaterialRole, "material")
|
||||||
self.addRoleName(self.ColorRole, "color_name")
|
self.addRoleName(self.ColorRole, "color_name")
|
||||||
self.addRoleName(self.ContainerNodeRole, "container_node")
|
self.addRoleName(self.ContainerNodeRole, "container_node")
|
||||||
|
self.addRoleName(self.CompatibleRole, "compatible")
|
||||||
|
|
||||||
self._extruder_position = 0
|
self._extruder_position = 0
|
||||||
self._extruder_stack = None
|
self._extruder_stack = None
|
||||||
|
|
|
@ -122,7 +122,8 @@ class BrandMaterialsModel(ListModel):
|
||||||
"brand": metadata["brand"],
|
"brand": metadata["brand"],
|
||||||
"material": metadata["material"],
|
"material": metadata["material"],
|
||||||
"color_name": metadata["color_name"],
|
"color_name": metadata["color_name"],
|
||||||
"container_node": container_node
|
"container_node": container_node,
|
||||||
|
"compatible": metadata.get("compatible", "unknown")
|
||||||
}
|
}
|
||||||
brand_group_dict[brand][material_type].append(item)
|
brand_group_dict[brand][material_type].append(item)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class GenericMaterialsModel(BaseMaterialsModel):
|
||||||
self._material_manager.materialsUpdated.connect(self._update) #Update when the list of materials changes.
|
self._material_manager.materialsUpdated.connect(self._update) #Update when the list of materials changes.
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
def _update(self):
|
def _update(self) -> None:
|
||||||
Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__))
|
Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__))
|
||||||
|
|
||||||
global_stack = self._machine_manager.activeMachine
|
global_stack = self._machine_manager.activeMachine
|
||||||
|
@ -51,7 +51,8 @@ class GenericMaterialsModel(BaseMaterialsModel):
|
||||||
"brand": metadata["brand"],
|
"brand": metadata["brand"],
|
||||||
"material": metadata["material"],
|
"material": metadata["material"],
|
||||||
"color_name": metadata["color_name"],
|
"color_name": metadata["color_name"],
|
||||||
"container_node": container_node
|
"container_node": container_node,
|
||||||
|
"compatible": metadata.get("compatible", "unknown")
|
||||||
}
|
}
|
||||||
item_list.append(item)
|
item_list.append(item)
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ Menu
|
||||||
text: model.name
|
text: model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex]
|
checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex]
|
||||||
|
enabled: model.compatible
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Ultimaker B.V.
|
//Copyright (c) 2018 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.
|
||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue