Merge branch 'CURA-6590_continue_fix_diameter_reset'

This commit is contained in:
Ghostkeeper 2019-07-08 15:05:20 +02:00
commit 6941af0022
No known key found for this signature in database
GPG Key ID: 86BEF881AE2CF276
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]:

View File

@ -49,6 +49,15 @@ Item
// When loaded, try to select the active material in the tree
Component.onCompleted: resetExpandedActiveMaterial()
Connections
{
target: Cura.MachineManager
onActiveMaterialChanged:
{
resetExpandedActiveMaterial()
}
}
// Every time the selected item has changed, notify to the details panel
onCurrentItemChanged:
{

View File

@ -51,7 +51,7 @@ Rectangle
anchors.left: swatch.right
anchors.verticalCenter: materialSlot.verticalCenter
anchors.leftMargin: UM.Theme.getSize("narrow_margin").width
font.italic: Cura.MachineManager.currentRootMaterialId[Cura.ExtruderManager.activeExtruderIndex] == material.root_material_id
font.italic: material != null && Cura.MachineManager.currentRootMaterialId[Cura.ExtruderManager.activeExtruderIndex] == material.root_material_id
}
MouseArea
{