mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Partial fix for intent manager not finding correct profile in test
Only in test.
This commit is contained in:
parent
7d40d962e8
commit
557746a832
4 changed files with 20 additions and 12 deletions
|
@ -1028,12 +1028,14 @@ class MachineManager(QObject):
|
|||
def _onMaterialNameChanged(self) -> None:
|
||||
self.activeMaterialChanged.emit()
|
||||
|
||||
## Get the signals that signal that the containers changed for all stacks.
|
||||
#
|
||||
# This includes the global stack and all extruder stacks. So if any
|
||||
# container changed anywhere.
|
||||
def _getContainerChangedSignals(self) -> List[Signal]:
|
||||
if self._global_container_stack is None:
|
||||
return []
|
||||
stacks = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||
stacks.append(self._global_container_stack)
|
||||
return [ s.containersChanged for s in stacks ]
|
||||
return [s.containersChanged for s in ExtruderManager.getInstance().getActiveExtruderStacks() + [self._global_container_stack]]
|
||||
|
||||
@pyqtSlot(str, str, str)
|
||||
def setSettingForAllExtruders(self, setting_name: str, property_name: str, property_value: str) -> None:
|
||||
|
|
|
@ -4,8 +4,6 @@ from UM.Settings.DefinitionContainer import DefinitionContainer
|
|||
from cura.Machines.ContainerTree import ContainerTree
|
||||
from cura.Settings.GlobalStack import GlobalStack
|
||||
|
||||
import cura.CuraApplication # DEBUG!
|
||||
|
||||
|
||||
def createMockedStack(definition_id: str):
|
||||
result = MagicMock(spec = GlobalStack)
|
||||
|
|
|
@ -50,10 +50,16 @@ class MockContainer(ContainerInterface, UM.PluginObject.PluginObject):
|
|||
return default
|
||||
|
||||
## Gets a human-readable name for this container.
|
||||
#
|
||||
# \return Always returns "MockContainer".
|
||||
# \return The name from the metadata, or "MockContainer" if there was no
|
||||
# name provided.
|
||||
def getName(self):
|
||||
return "MockContainer"
|
||||
return self._metadata.get("name", "MockContainer")
|
||||
|
||||
## Get whether a container stack is enabled or not.
|
||||
# \return Always returns True.
|
||||
@property
|
||||
def isEnabled(self):
|
||||
return True
|
||||
|
||||
## Get whether the container item is stored on a read only location in the filesystem.
|
||||
#
|
||||
|
|
|
@ -21,7 +21,7 @@ mocked_qualitygroup_metadata = {
|
|||
"normal": QualityGroup("um3_aa4_pla_normal", "normal"),
|
||||
"abnorm": QualityGroup("um3_aa4_pla_abnorm", "abnorm")} # type:Dict[str, QualityGroup]
|
||||
|
||||
@pytest.fixture()
|
||||
@pytest.fixture
|
||||
def mock_container_tree() -> MagicMock:
|
||||
container_tree = MagicMock()
|
||||
container_tree.getCurrentQualityGroups = MagicMock(return_value = mocked_qualitygroup_metadata)
|
||||
|
@ -57,7 +57,7 @@ def mock_container_tree() -> MagicMock:
|
|||
}
|
||||
return container_tree
|
||||
|
||||
@pytest.fixture()
|
||||
@pytest.fixture
|
||||
def intent_manager(application, extruder_manager, machine_manager, container_registry, global_stack) -> IntentManager:
|
||||
application.getExtruderManager = MagicMock(return_value = extruder_manager)
|
||||
application.getGlobalContainerStack = MagicMock(return_value = global_stack)
|
||||
|
@ -98,16 +98,18 @@ def doSetup(application, extruder_manager, container_registry, global_stack) ->
|
|||
qualitygroup.node_for_global = MagicMock(name = "Node for global")
|
||||
|
||||
global_stack.definition = MockContainer({"id": "ultimaker3"})
|
||||
application.getGlobalContainerStack = MagicMock(return_value = global_stack)
|
||||
|
||||
extruder_stack_a = MockContainer({"id": "Extruder The First"})
|
||||
extruder_stack_a.variant = MockContainer({"name": "AA 0.4"})
|
||||
extruder_stack_a.quality = MockContainer({"id": "um3_aa4_pla_normal"})
|
||||
extruder_stack_a.material = MockContainer({"base_file": "generic_pla"})
|
||||
extruder_stack_b = MockContainer({"id": "Extruder II: Plastic Boogaloo"})
|
||||
extruder_stack_b.variant = MockContainer({"name": "AA 0.4"})
|
||||
extruder_stack_b.quality = MockContainer({"id": "um3_aa4_pla_normal"})
|
||||
extruder_stack_b.material = MockContainer({"base_file": "generic_pla"})
|
||||
global_stack.extruderList = [extruder_stack_a, extruder_stack_b]
|
||||
|
||||
application.getGlobalContainerStack().extruderList = [extruder_stack_a, extruder_stack_b]
|
||||
application.getGlobalContainerStack = MagicMock(return_value = global_stack)
|
||||
extruder_manager.getUsedExtruderStacks = MagicMock(return_value = [extruder_stack_a, extruder_stack_b])
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue