From 1ed0503e027edd0dbaa1da95c261f8ce42aa9f9f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Jul 2016 10:37:03 +0200 Subject: [PATCH 1/4] Backspace now triggers same action as delete CURA-1891 --- resources/qml/Cura.qml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index d0870991d2..45137db5cc 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -54,10 +54,7 @@ UM.MainWindow Keys.onPressed: { if (event.key == Qt.Key_Backspace) { - if(objectContextMenu.objectId != 0) - { - Printer.deleteObject(objectContextMenu.objectId); - } + Cura.Actions.deleteSelection.trigger() } } From 21d4e9b8942532744dde1d149beb1358d760c723 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Jul 2016 11:00:28 +0200 Subject: [PATCH 2/4] Delete selection now also removed group nodes when they only have one child left CURA-1891 --- cura/CuraApplication.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index bc4378feff..2de70b7304 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -555,12 +555,19 @@ class CuraApplication(QtApplication): def deleteSelection(self): if not self.getController().getToolsEnabled(): return - + removed_group_nodes = [] op = GroupedOperation() nodes = Selection.getAllSelectedObjects() for node in nodes: op.addOperation(RemoveSceneNodeOperation(node)) - + group_node = node.getParent() + if group_node and group_node.callDecoration("isGroup") and group_node not in removed_group_nodes: + remaining_nodes_in_group = list(set(group_node.getChildren()) - set(nodes)) + if len(remaining_nodes_in_group) == 1: + removed_group_nodes.append(group_node) + remaining_nodes_in_group[0].translate(group_node.getPosition()) + remaining_nodes_in_group[0].setParent(group_node.getParent()) + op.addOperation(RemoveSceneNodeOperation(group_node)) op.push() pass From 03aa4f9c6a4e856079f1f4624b23ce80ae3586d0 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Jul 2016 11:05:11 +0200 Subject: [PATCH 3/4] Undo removing object from group now works correctly CURA-1891 --- cura/CuraApplication.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 2de70b7304..9c3e2511c1 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -565,8 +565,7 @@ class CuraApplication(QtApplication): remaining_nodes_in_group = list(set(group_node.getChildren()) - set(nodes)) if len(remaining_nodes_in_group) == 1: removed_group_nodes.append(group_node) - remaining_nodes_in_group[0].translate(group_node.getPosition()) - remaining_nodes_in_group[0].setParent(group_node.getParent()) + op.addOperation(SetParentOperation(remaining_nodes_in_group[0], group_node.getParent())) op.addOperation(RemoveSceneNodeOperation(group_node)) op.push() @@ -593,8 +592,7 @@ class CuraApplication(QtApplication): op.push() if group_node: if len(group_node.getChildren()) == 1 and group_node.callDecoration("isGroup"): - group_node.getChildren()[0].translate(group_node.getPosition()) - group_node.getChildren()[0].setParent(group_node.getParent()) + op.addOperation(SetParentOperation(group_node.getChildren()[0], group_node.getParent())) op = RemoveSceneNodeOperation(group_node) op.push() From d1a6420e1b33770733883ae6f0d7954b090bbf3e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 29 Jul 2016 11:07:16 +0200 Subject: [PATCH 4/4] Delete all object now clears Selection CURA-1891 --- cura/CuraApplication.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 9c3e2511c1..a646d687f6 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -657,6 +657,7 @@ class CuraApplication(QtApplication): op.addOperation(RemoveSceneNodeOperation(node)) op.push() + Selection.clear() ## Reset all translation on nodes with mesh data. @pyqtSlot()