mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 12:47:49 -06:00
Merge branch 'refactoring_machine_manager' of github.com:Ultimaker/Cura into refactoring_machine_manager
This commit is contained in:
commit
11be94c735
10 changed files with 77 additions and 110 deletions
|
@ -955,8 +955,6 @@ class CuraApplication(QtApplication):
|
||||||
qmlRegisterType(GenericMaterialsModel, "Cura", 1, 0, "GenericMaterialsModel")
|
qmlRegisterType(GenericMaterialsModel, "Cura", 1, 0, "GenericMaterialsModel")
|
||||||
qmlRegisterType(BrandMaterialsModel, "Cura", 1, 0, "BrandMaterialsModel")
|
qmlRegisterType(BrandMaterialsModel, "Cura", 1, 0, "BrandMaterialsModel")
|
||||||
qmlRegisterType(MaterialsModel, "Cura", 1, 0, "MaterialsModel")
|
qmlRegisterType(MaterialsModel, "Cura", 1, 0, "MaterialsModel")
|
||||||
|
|
||||||
# TODO: make this singleton?
|
|
||||||
qmlRegisterType(QualityManagementModel, "Cura", 1, 0, "QualityManagementModel")
|
qmlRegisterType(QualityManagementModel, "Cura", 1, 0, "QualityManagementModel")
|
||||||
|
|
||||||
qmlRegisterSingletonType(QualityProfilesModel, "Cura", 1, 0, "QualityProfilesModel", self.getQualityProfileModel)
|
qmlRegisterSingletonType(QualityProfilesModel, "Cura", 1, 0, "QualityProfilesModel", self.getQualityProfileModel)
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
# Copyright (c) 2017 Ultimaker B.V.
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from typing import Any, List, Optional
|
from typing import Optional
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty
|
||||||
|
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Qt.ListModel import ListModel
|
from UM.Qt.ListModel import ListModel
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
|
||||||
from UM.Settings.Models.InstanceContainersModel import InstanceContainersModel
|
|
||||||
|
|
||||||
|
|
||||||
def getAvailableMaterials(extruder_position: Optional[int] = None):
|
def getAvailableMaterials(extruder_position: Optional[int] = None):
|
||||||
|
@ -48,6 +46,8 @@ class BaseMaterialsModel(ListModel):
|
||||||
ColorRole = Qt.UserRole + 6
|
ColorRole = Qt.UserRole + 6
|
||||||
ContainerNodeRole = Qt.UserRole + 7
|
ContainerNodeRole = Qt.UserRole + 7
|
||||||
|
|
||||||
|
extruderPositionChanged = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
|
@ -59,6 +59,17 @@ class BaseMaterialsModel(ListModel):
|
||||||
self.addRoleName(self.ColorRole, "color_name")
|
self.addRoleName(self.ColorRole, "color_name")
|
||||||
self.addRoleName(self.ContainerNodeRole, "container_node")
|
self.addRoleName(self.ContainerNodeRole, "container_node")
|
||||||
|
|
||||||
|
self._extruder_position = 0
|
||||||
|
|
||||||
|
def setExtruderPosition(self, position: int):
|
||||||
|
if self._extruder_position != position:
|
||||||
|
self._extruder_position = position
|
||||||
|
self.extruderPositionChanged.emit()
|
||||||
|
|
||||||
|
@pyqtProperty(int, fset = setExtruderPosition, notify = extruderPositionChanged)
|
||||||
|
def extruderPosition(self) -> int:
|
||||||
|
return self._extruder_positoin
|
||||||
|
|
||||||
|
|
||||||
class GenericMaterialsModel(BaseMaterialsModel):
|
class GenericMaterialsModel(BaseMaterialsModel):
|
||||||
|
|
||||||
|
@ -82,7 +93,7 @@ class GenericMaterialsModel(BaseMaterialsModel):
|
||||||
self.setItems([])
|
self.setItems([])
|
||||||
return
|
return
|
||||||
|
|
||||||
result_dict = getAvailableMaterials()
|
result_dict = getAvailableMaterials(self._extruder_position)
|
||||||
if result_dict is None:
|
if result_dict is None:
|
||||||
self.setItems([])
|
self.setItems([])
|
||||||
return
|
return
|
||||||
|
@ -126,12 +137,16 @@ class BrandMaterialsModel(ListModel):
|
||||||
NameRole = Qt.UserRole + 1
|
NameRole = Qt.UserRole + 1
|
||||||
MaterialsRole = Qt.UserRole + 2
|
MaterialsRole = Qt.UserRole + 2
|
||||||
|
|
||||||
|
extruderPositionChanged = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.addRoleName(self.NameRole, "name")
|
self.addRoleName(self.NameRole, "name")
|
||||||
self.addRoleName(self.MaterialsRole, "materials")
|
self.addRoleName(self.MaterialsRole, "materials")
|
||||||
|
|
||||||
|
self._extruder_position = 0
|
||||||
|
|
||||||
from cura.CuraApplication import CuraApplication
|
from cura.CuraApplication import CuraApplication
|
||||||
self._machine_manager = CuraApplication.getInstance().getMachineManager()
|
self._machine_manager = CuraApplication.getInstance().getMachineManager()
|
||||||
extruder_manager = CuraApplication.getInstance().getExtruderManager()
|
extruder_manager = CuraApplication.getInstance().getExtruderManager()
|
||||||
|
@ -141,13 +156,24 @@ class BrandMaterialsModel(ListModel):
|
||||||
extruder_manager.activeExtruderChanged.connect(self._update)
|
extruder_manager.activeExtruderChanged.connect(self._update)
|
||||||
material_manager.materialsUpdated.connect(self._update)
|
material_manager.materialsUpdated.connect(self._update)
|
||||||
|
|
||||||
|
self._update()
|
||||||
|
|
||||||
|
def setExtruderPosition(self, position: int):
|
||||||
|
if self._extruder_position != position:
|
||||||
|
self._extruder_position = position
|
||||||
|
self.extruderPositionChanged.emit()
|
||||||
|
|
||||||
|
@pyqtProperty(int, fset = setExtruderPosition, notify = extruderPositionChanged)
|
||||||
|
def extruderPosition(self) -> int:
|
||||||
|
return self._extruder_position
|
||||||
|
|
||||||
def _update(self):
|
def _update(self):
|
||||||
global_stack = self._machine_manager.activeMachine
|
global_stack = self._machine_manager.activeMachine
|
||||||
if global_stack is None:
|
if global_stack is None:
|
||||||
self.setItems([])
|
self.setItems([])
|
||||||
return
|
return
|
||||||
|
|
||||||
result_dict = getAvailableMaterials()
|
result_dict = getAvailableMaterials(self._extruder_position)
|
||||||
if result_dict is None:
|
if result_dict is None:
|
||||||
self.setItems([])
|
self.setItems([])
|
||||||
return
|
return
|
||||||
|
@ -180,7 +206,7 @@ class BrandMaterialsModel(ListModel):
|
||||||
|
|
||||||
for brand, material_dict in brand_group_dict.items():
|
for brand, material_dict in brand_group_dict.items():
|
||||||
brand_item = {"name": brand,
|
brand_item = {"name": brand,
|
||||||
"materials": MaterialsModelGroupedByType(self)} # TODO
|
"materials": MaterialsModelGroupedByType(self)}
|
||||||
|
|
||||||
material_type_item_list = []
|
material_type_item_list = []
|
||||||
for material_type, material_list in material_dict.items():
|
for material_type, material_list in material_dict.items():
|
||||||
|
|
|
@ -89,7 +89,11 @@ class QualitySettingsModel(ListModel):
|
||||||
else:
|
else:
|
||||||
quality_changes_node = quality_changes_group.nodes_for_extruders.get(self._extruder_position)
|
quality_changes_node = quality_changes_group.nodes_for_extruders.get(self._extruder_position)
|
||||||
if quality_changes_node is not None: # it can be None if number of extruders are changed during runtime
|
if quality_changes_node is not None: # it can be None if number of extruders are changed during runtime
|
||||||
quality_containers.insert(0, quality_changes_node.getContainer())
|
try:
|
||||||
|
quality_containers.insert(0, quality_changes_node.getContainer())
|
||||||
|
except:
|
||||||
|
# FIXME: This is to prevent incomplete update of QualityManager
|
||||||
|
return
|
||||||
settings_keys.update(quality_changes_group.getAllKeys())
|
settings_keys.update(quality_changes_group.getAllKeys())
|
||||||
|
|
||||||
current_category = ""
|
current_category = ""
|
||||||
|
|
|
@ -404,24 +404,17 @@ class ContainerManager(QObject):
|
||||||
for node in quality_changes_group.getAllNodes():
|
for node in quality_changes_group.getAllNodes():
|
||||||
self._container_registry.removeContainer(node.metadata["id"])
|
self._container_registry.removeContainer(node.metadata["id"])
|
||||||
|
|
||||||
## Rename a set of quality changes containers.
|
|
||||||
#
|
#
|
||||||
# This will search for quality_changes containers matching the supplied name and rename them.
|
# Rename a set of quality changes containers. Returns the new name.
|
||||||
# Note that if the machine specifies that qualities should be filtered by machine and/or material
|
|
||||||
# only the containers related to the active machine/material are renamed.
|
|
||||||
#
|
#
|
||||||
# \param quality_name The name of the quality changes containers to rename.
|
@pyqtSlot(QObject, str, result = str)
|
||||||
# \param new_name The new name of the quality changes.
|
def renameQualityChangesGroup(self, quality_changes_group, new_name) -> str:
|
||||||
#
|
|
||||||
# \return True if successful, False if not.
|
|
||||||
@pyqtSlot(QObject, str)
|
|
||||||
def renameQualityChangesGroup(self, quality_changes_group, new_name):
|
|
||||||
Logger.log("i", "Renaming QualityChangesGroup[%s] to [%s]", quality_changes_group.name, new_name)
|
Logger.log("i", "Renaming QualityChangesGroup[%s] to [%s]", quality_changes_group.name, new_name)
|
||||||
self._machine_manager.blurSettings.emit()
|
self._machine_manager.blurSettings.emit()
|
||||||
|
|
||||||
if new_name == quality_changes_group.name:
|
if new_name == quality_changes_group.name:
|
||||||
Logger.log("i", "QualityChangesGroup name [%s] unchanged.", quality_changes_group.name)
|
Logger.log("i", "QualityChangesGroup name [%s] unchanged.", quality_changes_group.name)
|
||||||
return
|
return new_name
|
||||||
|
|
||||||
new_name = self._container_registry.uniqueName(new_name)
|
new_name = self._container_registry.uniqueName(new_name)
|
||||||
for node in quality_changes_group.getAllNodes():
|
for node in quality_changes_group.getAllNodes():
|
||||||
|
@ -430,6 +423,8 @@ class ContainerManager(QObject):
|
||||||
self._machine_manager.activeQualityChanged.emit()
|
self._machine_manager.activeQualityChanged.emit()
|
||||||
self._machine_manager.activeQualityGroupChanged.emit()
|
self._machine_manager.activeQualityGroupChanged.emit()
|
||||||
|
|
||||||
|
return new_name
|
||||||
|
|
||||||
@pyqtSlot(str, "QVariantMap")
|
@pyqtSlot(str, "QVariantMap")
|
||||||
def duplicateQualityChanges(self, quality_changes_name, quality_model_item):
|
def duplicateQualityChanges(self, quality_changes_name, quality_model_item):
|
||||||
global_stack = Application.getInstance().getGlobalContainerStack()
|
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
|
|
|
@ -989,7 +989,6 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
@pyqtSlot("QVariant")
|
@pyqtSlot("QVariant")
|
||||||
def setGlobalVariant(self, container_node):
|
def setGlobalVariant(self, container_node):
|
||||||
Logger.log("d", "---------------- container = [%s]", container_node)
|
|
||||||
self.blurSettings.emit()
|
self.blurSettings.emit()
|
||||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||||
self._setGlobalVariant(container_node)
|
self._setGlobalVariant(container_node)
|
||||||
|
@ -998,7 +997,6 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
@pyqtSlot(str, "QVariant")
|
@pyqtSlot(str, "QVariant")
|
||||||
def setMaterial(self, position, container_node):
|
def setMaterial(self, position, container_node):
|
||||||
Logger.log("d", "---------------- container = [%s]", container_node)
|
|
||||||
position = str(position)
|
position = str(position)
|
||||||
self.blurSettings.emit()
|
self.blurSettings.emit()
|
||||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||||
|
@ -1007,7 +1005,6 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
@pyqtSlot(str, "QVariant")
|
@pyqtSlot(str, "QVariant")
|
||||||
def setVariantGroup(self, position, container_node):
|
def setVariantGroup(self, position, container_node):
|
||||||
Logger.log("d", "---------------- container = [%s]", container_node)
|
|
||||||
position = str(position)
|
position = str(position)
|
||||||
self.blurSettings.emit()
|
self.blurSettings.emit()
|
||||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||||
|
@ -1015,32 +1012,27 @@ class MachineManager(QObject):
|
||||||
self._updateMaterialWithVariant(position)
|
self._updateMaterialWithVariant(position)
|
||||||
self._updateQualityWithMaterial()
|
self._updateQualityWithMaterial()
|
||||||
|
|
||||||
@pyqtSlot("QVariant")
|
@pyqtSlot(QObject)
|
||||||
def setQualityGroup(self, quality_group):
|
def setQualityGroup(self, quality_group):
|
||||||
Logger.log("d", "---------------- qg = [%s]", quality_group.name)
|
|
||||||
self.blurSettings.emit()
|
self.blurSettings.emit()
|
||||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||||
self._setQualityGroup(quality_group)
|
self._setQualityGroup(quality_group)
|
||||||
|
|
||||||
Logger.log("d", "Quality set!")
|
|
||||||
|
|
||||||
# See if we need to show the Discard or Keep changes screen
|
# See if we need to show the Discard or Keep changes screen
|
||||||
if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1:
|
if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1:
|
||||||
Application.getInstance().discardOrKeepProfileChanges()
|
Application.getInstance().discardOrKeepProfileChanges()
|
||||||
|
|
||||||
@pyqtProperty("QVariant", fset = setQualityGroup, notify = activeQualityGroupChanged)
|
@pyqtProperty(QObject, fset = setQualityGroup, notify = activeQualityGroupChanged)
|
||||||
def activeQualityGroup(self):
|
def activeQualityGroup(self):
|
||||||
return self._current_quality_group
|
return self._current_quality_group
|
||||||
|
|
||||||
@pyqtSlot("QVariant")
|
@pyqtSlot(QObject)
|
||||||
def setQualityChangesGroup(self, quality_changes_group):
|
def setQualityChangesGroup(self, quality_changes_group):
|
||||||
Logger.log("d", "---------------- qcg = [%s]", quality_changes_group.name)
|
|
||||||
self.blurSettings.emit()
|
self.blurSettings.emit()
|
||||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||||
self._setQualityChangesGroup(quality_changes_group)
|
self._setQualityChangesGroup(quality_changes_group)
|
||||||
Logger.log("d", "Quality changes set!")
|
|
||||||
|
|
||||||
@pyqtProperty("QVariant", fset = setQualityChangesGroup, notify = activeQualityChangesGroupChanged)
|
@pyqtProperty(QObject, fset = setQualityChangesGroup, notify = activeQualityChangesGroupChanged)
|
||||||
def activeQualityChangesGroup(self):
|
def activeQualityChangesGroup(self):
|
||||||
return self._current_quality_changes_group
|
return self._current_quality_changes_group
|
||||||
|
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
# Copyright (c) 2018 Ultimaker B.V.
|
|
||||||
# Cura is released under the terms of the LGPLv2 or higher.
|
|
||||||
from UM.Extension import Extension
|
|
||||||
|
|
||||||
from PyQt5.QtCore import QObject
|
|
||||||
|
|
||||||
|
|
||||||
class TestTool(Extension, QObject):
|
|
||||||
def __init__(self, parent = None):
|
|
||||||
QObject.__init__(self, parent)
|
|
||||||
Extension.__init__(self)
|
|
||||||
|
|
||||||
self.addMenuItem("Test material manager", self._testMaterialManager)
|
|
||||||
self.addMenuItem("Test get quality", self._testGetQuality)
|
|
||||||
self.addMenuItem("Test get quality changes", self.testGetQualityChanges)
|
|
||||||
|
|
||||||
def _testMaterialManager(self):
|
|
||||||
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
|
||||||
from cura.CuraApplication import CuraApplication
|
|
||||||
CuraApplication.getInstance()._material_manager._test_metadata()
|
|
||||||
|
|
||||||
def _testGetQuality(self):
|
|
||||||
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
|
||||||
from cura.CuraApplication import CuraApplication
|
|
||||||
result_dict = {}
|
|
||||||
global_stack = CuraApplication.getInstance().getMachineManager()._global_container_stack
|
|
||||||
result = CuraApplication.getInstance()._quality_manager.getQualityGroups(global_stack)
|
|
||||||
print("!!!!!!!!!!!!!!!!!!!")
|
|
||||||
|
|
||||||
def testGetQualityChanges(self):
|
|
||||||
print("!!!!!!!!!!!!!!!!!!!")
|
|
||||||
|
|
||||||
from cura.CuraApplication import CuraApplication
|
|
||||||
result_dict = {}
|
|
||||||
global_stack = CuraApplication.getInstance().getMachineManager()._global_container_stack
|
|
||||||
result = CuraApplication.getInstance()._quality_manager.getQualityChangesGroups(global_stack)
|
|
||||||
for name, r in result.items():
|
|
||||||
print("!!!!!!!!!! [%s] - %s" % (name, r))
|
|
|
@ -1,13 +0,0 @@
|
||||||
# Copyright (c) 2016 Ultimaker B.V.
|
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
|
||||||
|
|
||||||
from . import TestTool
|
|
||||||
|
|
||||||
from UM.i18n import i18nCatalog
|
|
||||||
catalog = i18nCatalog("cura")
|
|
||||||
|
|
||||||
def getMetaData():
|
|
||||||
return {}
|
|
||||||
|
|
||||||
def register(app):
|
|
||||||
return {"extension": TestTool.TestTool()}
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Test Tools",
|
|
||||||
"author": "Ultimaker",
|
|
||||||
"version": "1.0",
|
|
||||||
"description": "Dump the contents of all settings to a HTML file.",
|
|
||||||
"api": 4
|
|
||||||
}
|
|
|
@ -82,12 +82,13 @@ Menu
|
||||||
Cura.GenericMaterialsModel
|
Cura.GenericMaterialsModel
|
||||||
{
|
{
|
||||||
id: genericMaterialsModel
|
id: genericMaterialsModel
|
||||||
//Component.onCompleted: populateMenuModels()
|
extruderPosition: menu.extruderIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.BrandMaterialsModel
|
Cura.BrandMaterialsModel
|
||||||
{
|
{
|
||||||
id: brandModel
|
id: brandModel
|
||||||
|
extruderPosition: menu.extruderIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
ExclusiveGroup { id: group }
|
ExclusiveGroup { id: group }
|
||||||
|
|
|
@ -171,36 +171,46 @@ Item
|
||||||
object: "<new name>"
|
object: "<new name>"
|
||||||
onAccepted:
|
onAccepted:
|
||||||
{
|
{
|
||||||
base.newQualityChangesNameToSwitchTo = newName; // We want to switch to the new profile once it's created
|
base.newQualityNameToSelect = newName; // We want to switch to the new profile once it's created
|
||||||
|
base.toActivateNewQuality = true;
|
||||||
Cura.ContainerManager.createQualityChanges(newName);
|
Cura.ContainerManager.createQualityChanges(newName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property string newQualityChangesNameToSwitchTo: ""
|
property string newQualityNameToSelect: ""
|
||||||
|
property bool toActivateNewQuality: false
|
||||||
|
|
||||||
// This connection makes sure that we will switch to the new
|
// This connection makes sure that we will switch to the correct quality after the model gets updated
|
||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
target: qualitiesModel
|
target: qualitiesModel
|
||||||
onItemsChanged: {
|
onItemsChanged: {
|
||||||
var currentItemName = base.currentItem == null ? "" : base.currentItem.name;
|
var toSelectItemName = base.currentItem == null ? "" : base.currentItem.name;
|
||||||
|
if (newQualityNameToSelect != "") {
|
||||||
|
toSelectItemName = newQualityNameToSelect;
|
||||||
|
}
|
||||||
|
|
||||||
for (var idx = 0; idx < qualitiesModel.rowCount(); ++idx) {
|
var newIdx = -1; // Default to nothing if nothing can be found
|
||||||
var item = qualitiesModel.getItem(idx);
|
if (toSelectItemName != "") {
|
||||||
if (base.newQualityChangesNameToSwitchTo != "") {
|
// Select the required quality name if given
|
||||||
if (item.name == base.newQualityChangesNameToSwitchTo) {
|
for (var idx = 0; idx < qualitiesModel.rowCount(); ++idx) {
|
||||||
|
var item = qualitiesModel.getItem(idx);
|
||||||
|
if (item.name == toSelectItemName) {
|
||||||
// Switch to the newly created profile if needed
|
// Switch to the newly created profile if needed
|
||||||
qualityListView.currentIndex = idx;
|
newIdx = idx;
|
||||||
if (item.is_read_only) {
|
if (base.toActivateNewQuality) {
|
||||||
Cura.MachineManager.setQualityGroup(item.quality_group);
|
// Activate this custom quality if required
|
||||||
} else {
|
|
||||||
Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group);
|
Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group);
|
||||||
}
|
}
|
||||||
base.newQualityChangesNameToSwitchTo = "";
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
qualityListView.currentIndex = newIdx;
|
||||||
|
|
||||||
|
// Reset states
|
||||||
|
base.newQualityNameToSelect = "";
|
||||||
|
base.toActivateNewQuality = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +223,6 @@ Item
|
||||||
onAccepted:
|
onAccepted:
|
||||||
{
|
{
|
||||||
Cura.ContainerManager.duplicateQualityChanges(newName, base.currentItem);
|
Cura.ContainerManager.duplicateQualityChanges(newName, base.currentItem);
|
||||||
qualityListView.currentIndex = -1; // TODO: Reset selection.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,8 +253,8 @@ Item
|
||||||
object: "<new name>"
|
object: "<new name>"
|
||||||
onAccepted:
|
onAccepted:
|
||||||
{
|
{
|
||||||
Cura.ContainerManager.renameQualityChangesGroup(base.currentItem.quality_changes_group, newName);
|
var actualNewName = Cura.ContainerManager.renameQualityChangesGroup(base.currentItem.quality_changes_group, newName);
|
||||||
qualityListView.currentIndex = -1; // TODO: Reset selection.
|
base.newQualityNameToSelect = actualNewName; // Select the new name after the model gets updated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue