mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 09:17:50 -06:00
Remove cache of material manager
It doesn't make the code much simpler because the cache is also not a local variable. Contributes to issue CURA-6679.
This commit is contained in:
parent
33739ea7a8
commit
be4e754984
4 changed files with 8 additions and 11 deletions
|
@ -599,7 +599,7 @@ class MachineManager(QObject):
|
||||||
def activeStack(self) -> Optional["ExtruderStack"]:
|
def activeStack(self) -> Optional["ExtruderStack"]:
|
||||||
return self._active_container_stack
|
return self._active_container_stack
|
||||||
|
|
||||||
@pyqtProperty(str, notify=activeMaterialChanged)
|
@pyqtProperty(str, notify = activeMaterialChanged)
|
||||||
def activeMaterialId(self) -> str:
|
def activeMaterialId(self) -> str:
|
||||||
if self._active_container_stack:
|
if self._active_container_stack:
|
||||||
material = self._active_container_stack.material
|
material = self._active_container_stack.material
|
||||||
|
|
|
@ -13,7 +13,6 @@ Item
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
|
|
||||||
property QtObject materialManager: CuraApplication.getMaterialManager()
|
|
||||||
// Keep PreferencesDialog happy
|
// Keep PreferencesDialog happy
|
||||||
property var resetEnabled: false
|
property var resetEnabled: false
|
||||||
property var currentItem: null
|
property var currentItem: null
|
||||||
|
@ -119,7 +118,7 @@ Item
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
forceActiveFocus();
|
forceActiveFocus();
|
||||||
base.newRootMaterialIdToSwitchTo = base.materialManager.createMaterial();
|
base.newRootMaterialIdToSwitchTo = CuraApplication.getMaterialManager().createMaterial();
|
||||||
base.toActivateNewMaterial = true;
|
base.toActivateNewMaterial = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +133,7 @@ Item
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
forceActiveFocus();
|
forceActiveFocus();
|
||||||
base.newRootMaterialIdToSwitchTo = base.materialManager.duplicateMaterial(base.currentItem.container_node);
|
base.newRootMaterialIdToSwitchTo = CuraApplication.getMaterialManager().duplicateMaterial(base.currentItem.container_node);
|
||||||
base.toActivateNewMaterial = true;
|
base.toActivateNewMaterial = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +144,7 @@ Item
|
||||||
id: removeMenuButton
|
id: removeMenuButton
|
||||||
text: catalog.i18nc("@action:button", "Remove")
|
text: catalog.i18nc("@action:button", "Remove")
|
||||||
iconName: "list-remove"
|
iconName: "list-remove"
|
||||||
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated && base.materialManager.canMaterialBeRemoved(base.currentItem.container_node)
|
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated && CuraApplication.getMaterialManager().canMaterialBeRemoved(base.currentItem.container_node)
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
forceActiveFocus();
|
forceActiveFocus();
|
||||||
|
@ -294,7 +293,7 @@ Item
|
||||||
{
|
{
|
||||||
// Set the active material as the fallback. It will be selected when the current material is deleted
|
// Set the active material as the fallback. It will be selected when the current material is deleted
|
||||||
base.newRootMaterialIdToSwitchTo = base.active_root_material_id
|
base.newRootMaterialIdToSwitchTo = base.active_root_material_id
|
||||||
base.materialManager.removeMaterial(base.currentItem.container_node);
|
CuraApplication.getMaterialManager().removeMaterial(base.currentItem.container_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,10 +82,10 @@ Rectangle
|
||||||
{
|
{
|
||||||
if (materialSlot.is_favorite)
|
if (materialSlot.is_favorite)
|
||||||
{
|
{
|
||||||
base.materialManager.removeFavorite(material.root_material_id)
|
CuraApplication.getMaterialManager().removeFavorite(material.root_material_id)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
base.materialManager.addFavorite(material.root_material_id)
|
CuraApplication.getMaterialManager().addFavorite(material.root_material_id)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
style: ButtonStyle
|
style: ButtonStyle
|
||||||
|
|
|
@ -14,8 +14,6 @@ TabView
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
|
|
||||||
property QtObject materialManager: CuraApplication.getMaterialManager()
|
|
||||||
|
|
||||||
property QtObject properties
|
property QtObject properties
|
||||||
property var currentMaterialNode: null
|
property var currentMaterialNode: null
|
||||||
|
|
||||||
|
@ -567,7 +565,7 @@ TabView
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the values
|
// update the values
|
||||||
base.materialManager.setMaterialName(base.currentMaterialNode, new_name)
|
CuraApplication.getMaterialManager().setMaterialName(base.currentMaterialNode, new_name)
|
||||||
properties.name = new_name
|
properties.name = new_name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue