From e01c8a4f106f69583280d12ac8642b2177e36d72 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 29 Jul 2016 19:25:40 +0200 Subject: [PATCH] Add Select All functionality --- cura/CuraApplication.py | 18 +++++++++++++++++- resources/qml/Actions.qml | 11 +++++++++++ resources/qml/Cura.qml | 3 +++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a646d687f6..53d509b71c 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -633,7 +633,23 @@ class CuraApplication(QtApplication): if node: op = SetTransformOperation(node, Vector()) op.push() - + + ## Select all nodes containing mesh data in the scene. + @pyqtSlot() + def selectAll(self): + if not self.getController().getToolsEnabled(): + return + + Selection.clear() + for node in DepthFirstIterator(self.getController().getScene().getRoot()): + if type(node) is not SceneNode: + continue + if not node.getMeshData() and not node.callDecoration("isGroup"): + continue # Node that doesnt have a mesh and is not a group. + if node.getParent() and node.getParent().callDecoration("isGroup"): + continue # Grouped nodes don't need resetting as their parent (the group) is resetted) + Selection.add(node) + ## Delete all nodes containing mesh data in the scene. @pyqtSlot() def deleteAll(self): diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index c443c38875..ed88433e33 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -27,6 +27,7 @@ Item property alias multiplyObject: multiplyObjectAction; + property alias selectAll: selectAllAction; property alias deleteAll: deleteAllAction; property alias reloadAll: reloadAllAction; property alias resetAllTranslation: resetAllTranslationAction; @@ -230,6 +231,16 @@ Item iconName: "edit-duplicate" } + Action + { + id: selectAllAction; + text: catalog.i18nc("@action:inmenu menubar:edit","&Select All Objects"); + enabled: UM.Controller.toolsEnabled; + iconName: "edit-select-all"; + shortcut: "Ctrl+A"; + onTriggered: Printer.selectAll(); + } + Action { id: deleteAllAction; diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 45137db5cc..ae72353e0e 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -118,6 +118,7 @@ UM.MainWindow MenuItem { action: Cura.Actions.undo; } MenuItem { action: Cura.Actions.redo; } MenuSeparator { } + MenuItem { action: Cura.Actions.selectAll; } MenuItem { action: Cura.Actions.deleteSelection; } MenuItem { action: Cura.Actions.deleteAll; } MenuItem { action: Cura.Actions.resetAllTranslation; } @@ -537,6 +538,7 @@ UM.MainWindow MenuItem { action: Cura.Actions.deleteObject; } MenuItem { action: Cura.Actions.multiplyObject; } MenuSeparator { } + MenuItem { action: Cura.Actions.selectAll; } MenuItem { action: Cura.Actions.deleteAll; } MenuItem { action: Cura.Actions.reloadAll; } MenuItem { action: Cura.Actions.resetAllTranslation; } @@ -589,6 +591,7 @@ UM.MainWindow Menu { id: contextMenu; + MenuItem { action: Cura.Actions.selectAll; } MenuItem { action: Cura.Actions.deleteAll; } MenuItem { action: Cura.Actions.reloadAll; } MenuItem { action: Cura.Actions.resetAllTranslation; }