Listen to 'material-changed' since it doesn't update immediately.

part of CURA-6590
This commit is contained in:
Remco Burema 2019-07-03 16:14:08 +02:00
parent d43415191b
commit fea8262656
3 changed files with 19 additions and 2 deletions

View file

@ -1112,9 +1112,17 @@ class MachineManager(QObject):
def _onRootMaterialChanged(self) -> None:
self._current_root_material_id = {}
changed = False
if self._global_container_stack:
for position in self._global_container_stack.extruders:
self._current_root_material_id[position] = self._global_container_stack.extruders[position].material.getMetaDataEntry("base_file")
material_id = self._global_container_stack.extruders[position].material.getMetaDataEntry("base_file")
if position not in self._current_root_material_id or material_id != self._current_root_material_id[position]:
changed = True
self._current_root_material_id[position] = material_id
if changed:
self.activeMaterialChanged.emit()
@pyqtProperty("QVariant", notify = rootMaterialChanged)
def currentRootMaterialId(self) -> Dict[str, str]: