mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 05:58:58 +08:00
Fix updating materials models when materials change before first printer switch
Otherwise the _extruder_stack field would not yet be set. Contributes to issue CURA-6600.
This commit is contained in:
parent
8346e465f6
commit
63ae6ee9ec
@ -31,8 +31,13 @@ class BaseMaterialsModel(ListModel):
|
||||
self._container_registry = self._application.getInstance().getContainerRegistry()
|
||||
self._machine_manager = self._application.getMachineManager()
|
||||
|
||||
self._extruder_position = 0
|
||||
self._extruder_stack = None
|
||||
self._enabled = True
|
||||
|
||||
# Update the stack and the model data when the machine changes
|
||||
self._machine_manager.globalContainerChanged.connect(self._updateExtruderStack)
|
||||
self._updateExtruderStack()
|
||||
|
||||
# Update this model when switching machines, when adding materials or changing their metadata.
|
||||
self._machine_manager.activeStackChanged.connect(self._update)
|
||||
@ -55,12 +60,8 @@ class BaseMaterialsModel(ListModel):
|
||||
self.addRoleName(Qt.UserRole + 15, "container_node")
|
||||
self.addRoleName(Qt.UserRole + 16, "is_favorite")
|
||||
|
||||
self._extruder_position = 0
|
||||
self._extruder_stack = None
|
||||
|
||||
self._available_materials = None # type: Optional[Dict[str, MaterialNode]]
|
||||
self._favorite_ids = set() # type: Set[str]
|
||||
self._enabled = True
|
||||
|
||||
def _updateExtruderStack(self):
|
||||
global_stack = self._machine_manager.activeMachine
|
||||
|
Loading…
x
Reference in New Issue
Block a user