Add a setSelectionExtruder method to CuraActions

Can be used to set the extruder used for the selection

Contributes to CURA-3609
This commit is contained in:
Arjen Hiemstra 2017-04-20 17:29:41 +02:00
parent 61f542c215
commit 5f65cb25c6

View File

@ -16,6 +16,8 @@ from UM.Operations.SetTransformOperation import SetTransformOperation
from .SetParentOperation import SetParentOperation from .SetParentOperation import SetParentOperation
from .MultiplyObjectsJob import MultiplyObjectsJob from .MultiplyObjectsJob import MultiplyObjectsJob
from cura.Settings.SetObjectExtruderOperation import SetObjectExtruderOperation
class CuraActions(QObject): class CuraActions(QObject):
def __init__(self, parent = None): def __init__(self, parent = None):
super().__init__(parent) super().__init__(parent)
@ -74,5 +76,15 @@ class CuraActions(QObject):
op.addOperation(SetParentOperation(remaining_nodes_in_group[0], group_node.getParent())) op.addOperation(SetParentOperation(remaining_nodes_in_group[0], group_node.getParent()))
op.addOperation(RemoveSceneNodeOperation(group_node)) op.addOperation(RemoveSceneNodeOperation(group_node))
op.push() op.push()
@pyqtSlot(str)
def setSelectionExtruder(self, extruder_id: str) -> None:
operation = GroupedOperation()
for node in Selection.getAllSelectedObjects():
if node.callDecoration("getActiveExtruder") == extruder_id:
continue
operation.addOperation(SetObjectExtruderOperation(node, extruder_id))
operation.push()
def _openUrl(self, url): def _openUrl(self, url):
QDesktopServices.openUrl(url) QDesktopServices.openUrl(url)