mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-19 07:17:30 +08:00
Improve code legibility
CURA-1543
This commit is contained in:
parent
62cdde1a9b
commit
c4c6be7c34
@ -557,11 +557,7 @@ class CuraApplication(QtApplication):
|
|||||||
group_node.setCenterPosition(center)
|
group_node.setCenterPosition(center)
|
||||||
|
|
||||||
# Move selected nodes into the group-node
|
# Move selected nodes into the group-node
|
||||||
op = GroupedOperation()
|
Selection.applyOperation(SetParentOperation, group_node)
|
||||||
nodes = Selection.getAllSelectedObjects()
|
|
||||||
for node in nodes:
|
|
||||||
op.addOperation(SetParentOperation(node, group_node))
|
|
||||||
op.push()
|
|
||||||
|
|
||||||
# Deselect individual nodes and select the group-node instead
|
# Deselect individual nodes and select the group-node instead
|
||||||
for node in group_node.getChildren():
|
for node in group_node.getChildren():
|
||||||
@ -570,13 +566,13 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def ungroupSelected(self):
|
def ungroupSelected(self):
|
||||||
selected_objects = Selection.getAllSelectedObjects()[:] # clone the list
|
selected_objects = Selection.getAllSelectedObjects().copy()
|
||||||
for node in selected_objects:
|
for node in selected_objects:
|
||||||
if node.callDecoration("isGroup"):
|
if node.callDecoration("isGroup"):
|
||||||
op = GroupedOperation()
|
op = GroupedOperation()
|
||||||
|
|
||||||
group_parent = node.getParent()
|
group_parent = node.getParent()
|
||||||
children = node.getChildren()[:] # clone the list
|
children = node.getChildren().copy()
|
||||||
for child in children:
|
for child in children:
|
||||||
# Set the parent of the children to the parent of the group-node
|
# Set the parent of the children to the parent of the group-node
|
||||||
op.addOperation(SetParentOperation(child, group_parent))
|
op.addOperation(SetParentOperation(child, group_parent))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user