mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 04:54:04 -06:00
Add tests for SetActiveMachine
This commit is contained in:
parent
37855e7d19
commit
ce930220e9
2 changed files with 71 additions and 19 deletions
|
@ -329,6 +329,9 @@ class MachineManager(QObject):
|
|||
# This signal might not have been emitted yet (if it didn't change) but we still want the models to update that depend on it because we changed the contents of the containers too.
|
||||
extruder_manager.activeExtruderChanged.emit()
|
||||
|
||||
self._validateVariantsAndMaterials(global_stack)
|
||||
|
||||
def _validateVariantsAndMaterials(self, global_stack) -> None:
|
||||
# Validate if the machine has the correct variants and materials.
|
||||
# It can happen that a variant or material is empty, even though the machine has them. This will ensure that
|
||||
# that situation will be fixed (and not occur again, since it switches it out to the preferred variant or
|
||||
|
@ -347,6 +350,7 @@ class MachineManager(QObject):
|
|||
Logger.log("w", "An extruder has an unknown material, switching it to the preferred material")
|
||||
self.setMaterialById(extruder.getMetaDataEntry("position"), machine_node.preferred_material)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def getMachine(definition_id: str, metadata_filter: Optional[Dict[str, str]] = None) -> Optional["GlobalStack"]:
|
||||
"""Given a definition id, return the machine with this id.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue