|
@@ -125,6 +125,7 @@ class MachineManager(QObject):
|
|
|
# When the materials lookup table gets updated, it can mean that a material has its name changed, which should
|
|
|
# be reflected on the GUI. This signal emission makes sure that it happens.
|
|
|
self._material_manager.materialsUpdated.connect(self.rootMaterialChanged)
|
|
|
+ self.rootMaterialChanged.connect(self._onRootMaterialChanged)
|
|
|
|
|
|
activeQualityGroupChanged = pyqtSignal()
|
|
|
activeQualityChangesGroupChanged = pyqtSignal()
|
|
@@ -876,23 +877,26 @@ class MachineManager(QObject):
|
|
|
def currentExtruderPositions(self):
|
|
|
return sorted(list(self._global_container_stack.extruders.keys()))
|
|
|
|
|
|
- @pyqtProperty("QVariant", notify = rootMaterialChanged)
|
|
|
- def currentRootMaterialId(self):
|
|
|
- # initial filling the current_root_material_id
|
|
|
+ ## Update _current_root_material_id and _current_root_material_name when
|
|
|
+ # the current root material was changed.
|
|
|
+ def _onRootMaterialChanged(self):
|
|
|
self._current_root_material_id = {}
|
|
|
for position in self._global_container_stack.extruders:
|
|
|
self._current_root_material_id[position] = self._global_container_stack.extruders[position].material.getMetaDataEntry("base_file")
|
|
|
- return self._current_root_material_id
|
|
|
|
|
|
- @pyqtProperty("QVariant", notify = rootMaterialChanged)
|
|
|
- def currentRootMaterialName(self):
|
|
|
- # initial filling the current_root_material_name
|
|
|
if self._global_container_stack:
|
|
|
self._current_root_material_name = {}
|
|
|
for position in self._global_container_stack.extruders:
|
|
|
if position not in self._current_root_material_name:
|
|
|
material = self._global_container_stack.extruders[position].material
|
|
|
self._current_root_material_name[position] = material.getName()
|
|
|
+
|
|
|
+ @pyqtProperty("QVariant", notify = rootMaterialChanged)
|
|
|
+ def currentRootMaterialId(self):
|
|
|
+ return self._current_root_material_id
|
|
|
+
|
|
|
+ @pyqtProperty("QVariant", notify = rootMaterialChanged)
|
|
|
+ def currentRootMaterialName(self):
|
|
|
return self._current_root_material_name
|
|
|
|
|
|
## Return the variant names in the extruder stack(s).
|