Create new MaterialManagementModel and move canMaterialBeRemoved

Just like the QualityManagementModel, this class is intended to be used as proxy for the material management page in the preferences. I'm intending to move all relevant pyqtSlots from the material manager into this one. The advantage of this switch is that the material manager had no well-bounded scope and so tended to become a big mess of all sorts of functions. This one has a clear scope: serve as a proxy for the buttons you can press in the preferences screen for materials.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-27 13:50:48 +02:00
parent 36dfd23e3f
commit 5b8ed91b04
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
4 changed files with 46 additions and 8 deletions

View file

@ -7,7 +7,7 @@ import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import Cura 1.0 as Cura
import Cura 1.5 as Cura
Item
{
@ -42,6 +42,11 @@ Item
name: "cura"
}
Cura.MaterialManagementModel
{
id: materialManagement
}
function resetExpandedActiveMaterial()
{
materialListView.expandActiveMaterial(active_root_material_id)
@ -147,7 +152,7 @@ Item
id: removeMenuButton
text: catalog.i18nc("@action:button", "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 && materialManagement.canMaterialBeRemoved(base.currentItem.container_node)
onClicked:
{