WIP: Fix material name update upon machine switching

This commit is contained in:
Lipu Fei 2018-02-21 12:39:04 +01:00
parent c411091fde
commit 02472f6ad2
2 changed files with 10 additions and 5 deletions

View file

@ -259,10 +259,10 @@ class MachineManager(QObject):
self.activeQualityChanged.emit()
self.activeVariantChanged.emit()
self.activeMaterialChanged.emit()
self._error_check_timer.start()
def _onProfilesModelChanged(self, *args) -> None:
self.__emitChangedSignals()
self.rootMaterialChanged.emit()
self._error_check_timer.start()
def _onInstanceContainersChanged(self, container) -> None:
self._instance_container_timer.start()
@ -307,7 +307,11 @@ class MachineManager(QObject):
containers = container_registry.findContainerStacks(id = stack_id)
if containers:
Application.getInstance().setGlobalContainerStack(containers[0])
global_stack = containers[0]
Application.getInstance().setGlobalContainerStack(global_stack)
self._global_container_stack = global_stack
self.globalContainerChanged.emit()
self._onGlobalContainerChanged()
ExtruderManager.getInstance()._globalContainerStackChanged()
self._initMachineState(containers[0])
@ -898,6 +902,7 @@ class MachineManager(QObject):
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

View file

@ -265,7 +265,7 @@ Column
text: currentRootMaterialName
tooltip: currentRootMaterialName
visible: Cura.MachineManager.hasMaterials
enabled: !extrudersList.visible || base.currentExtruderIndex > -1
enabled: !extrudersList.visible || base.currentExtruderIndex > -1
height: UM.Theme.getSize("setting_control").height
width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width
anchors.right: parent.right