mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Merge branch 'refactoring_machine_manager' of github.com:Ultimaker/Cura into refactoring_machine_manager
This commit is contained in:
commit
fae82ef242
3 changed files with 10 additions and 31 deletions
|
@ -288,7 +288,7 @@ class MachineManager(QObject):
|
||||||
Logger.log("w", "Quality type [%s] not found in available qualities [%s]", quality_type, str(quality_groups.values()))
|
Logger.log("w", "Quality type [%s] not found in available qualities [%s]", quality_type, str(quality_groups.values()))
|
||||||
return
|
return
|
||||||
new_quality_group = quality_groups[quality_type]
|
new_quality_group = quality_groups[quality_type]
|
||||||
self._setQualityGroup(new_quality_group)
|
self._setQualityGroup(new_quality_group, empty_quality_changes = True)
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def setActiveMachine(self, stack_id: str) -> None:
|
def setActiveMachine(self, stack_id: str) -> None:
|
||||||
|
|
|
@ -1082,11 +1082,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
CuraApplication.getInstance().getMachineManager().activeQualityChanged.emit()
|
CuraApplication.getInstance().getMachineManager().activeQualityChanged.emit()
|
||||||
|
|
||||||
# Actually change the active machine.
|
# Actually change the active machine.
|
||||||
machine_manager = Application.getInstance().getMachineManager()
|
CuraApplication.getInstance().callLater(self._updateActiveMachine, global_stack)
|
||||||
machine_manager.setActiveMachine(global_stack.getId())
|
|
||||||
|
|
||||||
# Notify everything/one that is to notify about changes.
|
|
||||||
global_stack.containersChanged.emit(global_stack.getTop())
|
|
||||||
|
|
||||||
# Load all the nodes / meshdata of the workspace
|
# Load all the nodes / meshdata of the workspace
|
||||||
nodes = self._3mf_mesh_reader.read(file_name)
|
nodes = self._3mf_mesh_reader.read(file_name)
|
||||||
|
@ -1099,6 +1095,14 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
self.setWorkspaceName(base_file_name)
|
self.setWorkspaceName(base_file_name)
|
||||||
return nodes
|
return nodes
|
||||||
|
|
||||||
|
def _updateActiveMachine(self, global_stack):
|
||||||
|
# Actually change the active machine.
|
||||||
|
machine_manager = Application.getInstance().getMachineManager()
|
||||||
|
machine_manager.setActiveMachine(global_stack.getId())
|
||||||
|
|
||||||
|
# Notify everything/one that is to notify about changes.
|
||||||
|
global_stack.containersChanged.emit(global_stack.getTop())
|
||||||
|
|
||||||
## HACK: Replaces the material container in the given stack with a newly created material container.
|
## HACK: Replaces the material container in the given stack with a newly created material container.
|
||||||
# This function is used when the user chooses to resolve material conflicts by creating new ones.
|
# This function is used when the user chooses to resolve material conflicts by creating new ones.
|
||||||
def _replaceStackMaterialWithNew(self, stack, old_new_material_dict):
|
def _replaceStackMaterialWithNew(self, stack, old_new_material_dict):
|
||||||
|
|
|
@ -116,31 +116,6 @@ def test_addExtruder(global_stack):
|
||||||
# global_stack.addExtruder(unittest.mock.MagicMock())
|
# global_stack.addExtruder(unittest.mock.MagicMock())
|
||||||
assert len(global_stack.extruders) == 2 #Didn't add the faulty extruder.
|
assert len(global_stack.extruders) == 2 #Didn't add the faulty extruder.
|
||||||
|
|
||||||
## Tests getting the approximate material diameter.
|
|
||||||
@pytest.mark.parametrize("diameter, approximate_diameter", [
|
|
||||||
#Some real-life cases that are common in printers.
|
|
||||||
(2.85, 3),
|
|
||||||
(1.75, 2),
|
|
||||||
(3.0, 3),
|
|
||||||
(2.0, 2),
|
|
||||||
#Exceptional cases.
|
|
||||||
(0, 0),
|
|
||||||
(-10.1, -10),
|
|
||||||
(-1, -1),
|
|
||||||
(9000.1, 9000)
|
|
||||||
])
|
|
||||||
def test_approximateMaterialDiameter(diameter, approximate_diameter, global_stack):
|
|
||||||
global_stack.definition = DefinitionContainer(container_id = "TestDefinition")
|
|
||||||
material_diameter = UM.Settings.SettingDefinition.SettingDefinition(key = "material_diameter", container = global_stack.definition)
|
|
||||||
material_diameter.addSupportedProperty("value", UM.Settings.SettingDefinition.DefinitionPropertyType.Any, default = diameter)
|
|
||||||
global_stack.definition.definitions.append(material_diameter)
|
|
||||||
assert float(global_stack.approximateMaterialDiameter) == approximate_diameter
|
|
||||||
|
|
||||||
## Tests getting the material diameter when there is no material diameter.
|
|
||||||
def test_approximateMaterialDiameterNoDiameter(global_stack):
|
|
||||||
global_stack.definition = DefinitionContainer(container_id = "TestDefinition")
|
|
||||||
assert global_stack.approximateMaterialDiameter == "-1"
|
|
||||||
|
|
||||||
#Tests setting user changes profiles to invalid containers.
|
#Tests setting user changes profiles to invalid containers.
|
||||||
@pytest.mark.parametrize("container", [
|
@pytest.mark.parametrize("container", [
|
||||||
getInstanceContainer(container_type = "wrong container type"),
|
getInstanceContainer(container_type = "wrong container type"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue