mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 00:07:51 -06:00
Merge branch 'feature_intent' into feature_intent_container_tree
Conflicts: .gitlab-ci.yml cura/Machines/MaterialManager.py cura/Machines/VariantManager.py cura/Settings/ContainerManager.py cura/Settings/MachineManager.py tests/TestMachineManager.py
This commit is contained in:
commit
6a8e1557c3
1383 changed files with 33204 additions and 35215 deletions
|
@ -22,8 +22,8 @@ from UM.Message import Message
|
|||
from UM.Settings.SettingFunction import SettingFunction
|
||||
from UM.Signal import postponeSignals, CompressTechnique
|
||||
|
||||
from cura.Machines.MaterialManager import MaterialManager
|
||||
from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch, QualityManager
|
||||
from cura.Machines.MaterialManager import MaterialManager
|
||||
|
||||
from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice, ConnectionType
|
||||
from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigurationModel
|
||||
|
@ -40,11 +40,10 @@ from .CuraStackBuilder import CuraStackBuilder
|
|||
|
||||
from UM.i18n import i18nCatalog
|
||||
catalog = i18nCatalog("cura")
|
||||
|
||||
from cura.Settings.GlobalStack import GlobalStack
|
||||
if TYPE_CHECKING:
|
||||
from cura.CuraApplication import CuraApplication
|
||||
from cura.Settings.CuraContainerStack import CuraContainerStack
|
||||
from cura.Settings.GlobalStack import GlobalStack
|
||||
from cura.Machines.ContainerNode import ContainerNode
|
||||
from cura.Machines.QualityChangesGroup import QualityChangesGroup
|
||||
from cura.Machines.QualityGroup import QualityGroup
|
||||
|
@ -377,7 +376,7 @@ class MachineManager(QObject):
|
|||
machines = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
||||
for machine in machines:
|
||||
if machine.definition.getId() == definition_id:
|
||||
return machine
|
||||
return cast(GlobalStack, machine)
|
||||
return None
|
||||
|
||||
@pyqtSlot(str)
|
||||
|
@ -588,7 +587,7 @@ class MachineManager(QObject):
|
|||
def activeStack(self) -> Optional["ExtruderStack"]:
|
||||
return self._active_container_stack
|
||||
|
||||
@pyqtProperty(str, notify=activeMaterialChanged)
|
||||
@pyqtProperty(str, notify = activeMaterialChanged)
|
||||
def activeMaterialId(self) -> str:
|
||||
if self._active_container_stack:
|
||||
material = self._active_container_stack.material
|
||||
|
@ -939,7 +938,7 @@ class MachineManager(QObject):
|
|||
|
||||
# Check to see if any objects are set to print with an extruder that will no longer exist
|
||||
root_node = self._application.getController().getScene().getRoot()
|
||||
for node in DepthFirstIterator(root_node): #type: ignore #Ignore type error because iter() should get called automatically by Python syntax.
|
||||
for node in DepthFirstIterator(root_node):
|
||||
if node.getMeshData():
|
||||
extruder_nr = node.callDecoration("getActiveExtruderPosition")
|
||||
|
||||
|
@ -975,10 +974,13 @@ class MachineManager(QObject):
|
|||
self._application.globalContainerStackChanged.emit()
|
||||
self.forceUpdateAllSettings()
|
||||
|
||||
# Note that this function is deprecated, but the decorators for this don't play well together!
|
||||
# @deprecated("use Cura.MachineManager.activeMachine.extruders instead", "4.2")
|
||||
@pyqtSlot(int, result = QObject)
|
||||
def getExtruder(self, position: int) -> Optional[ExtruderStack]:
|
||||
return self._getExtruder(position)
|
||||
|
||||
# This is a workaround for the deprecated decorator and the pyqtSlot not playing well together.
|
||||
@deprecated("use Cura.MachineManager.activeMachine.extruders instead", "4.2")
|
||||
def _getExtruder(self, position) -> Optional[ExtruderStack]:
|
||||
if self._global_container_stack:
|
||||
return self._global_container_stack.extruders.get(str(position))
|
||||
return None
|
||||
|
@ -1101,9 +1103,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]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue