Merge pull request #606 from Ultimaker/fix_cura-623

Fix cura 623
This commit is contained in:
Jaime van Kessel 2016-01-22 15:35:37 +01:00
commit 3a32cb5f60
3 changed files with 14 additions and 1 deletions

View file

@ -292,6 +292,9 @@ class CuraApplication(QtApplication):
# Remove all selected objects from the scene. # Remove all selected objects from the scene.
@pyqtSlot() @pyqtSlot()
def deleteSelection(self): def deleteSelection(self):
if not self.getController().getToolsEnabled():
return
op = GroupedOperation() op = GroupedOperation()
nodes = Selection.getAllSelectedObjects() nodes = Selection.getAllSelectedObjects()
for node in nodes: for node in nodes:
@ -305,6 +308,9 @@ class CuraApplication(QtApplication):
# Note that this only removes an object if it is selected. # Note that this only removes an object if it is selected.
@pyqtSlot("quint64") @pyqtSlot("quint64")
def deleteObject(self, object_id): def deleteObject(self, object_id):
if not self.getController().getToolsEnabled():
return
node = self.getController().getScene().findObject(object_id) node = self.getController().getScene().findObject(object_id)
if not node and object_id != 0: #Workaround for tool handles overlapping the selected object if not node and object_id != 0: #Workaround for tool handles overlapping the selected object
@ -364,6 +370,9 @@ class CuraApplication(QtApplication):
## Delete all mesh data on the scene. ## Delete all mesh data on the scene.
@pyqtSlot() @pyqtSlot()
def deleteAll(self): def deleteAll(self):
if not self.getController().getToolsEnabled():
return
nodes = [] nodes = []
for node in DepthFirstIterator(self.getController().getScene().getRoot()): for node in DepthFirstIterator(self.getController().getScene().getRoot()):
if type(node) is not SceneNode: if type(node) is not SceneNode:

View file

@ -127,6 +127,7 @@ Item
{ {
id: deleteSelectionAction; id: deleteSelectionAction;
text: catalog.i18nc("@action:inmenu menubar:edit","Delete &Selection"); text: catalog.i18nc("@action:inmenu menubar:edit","Delete &Selection");
enabled: UM.Controller.toolsEnabled;
iconName: "edit-delete"; iconName: "edit-delete";
shortcut: StandardKey.Delete; shortcut: StandardKey.Delete;
} }
@ -135,6 +136,7 @@ Item
{ {
id: deleteObjectAction; id: deleteObjectAction;
text: catalog.i18nc("@action:inmenu","Delete Object"); text: catalog.i18nc("@action:inmenu","Delete Object");
enabled: UM.Controller.toolsEnabled;
iconName: "edit-delete"; iconName: "edit-delete";
} }
@ -179,6 +181,7 @@ Item
{ {
id: deleteAllAction; id: deleteAllAction;
text: catalog.i18nc("@action:inmenu menubar:edit","&Clear Build Platform"); text: catalog.i18nc("@action:inmenu menubar:edit","&Clear Build Platform");
enabled: UM.Controller.toolsEnabled;
iconName: "edit-delete"; iconName: "edit-delete";
shortcut: "Ctrl+D"; shortcut: "Ctrl+D";
} }

View file

@ -33,7 +33,7 @@ Item {
checkable: true; checkable: true;
checked: model.active; checked: model.active;
enabled: UM.Selection.hasSelection; enabled: UM.Selection.hasSelection && UM.Controller.toolsEnabled;
style: UM.Theme.styles.tool_button; style: UM.Theme.styles.tool_button;
@ -97,6 +97,7 @@ Item {
y: UM.Theme.sizes.default_margin.height; y: UM.Theme.sizes.default_margin.height;
source: UM.ActiveTool.valid ? UM.ActiveTool.activeToolPanel : ""; source: UM.ActiveTool.valid ? UM.ActiveTool.activeToolPanel : "";
enabled: UM.Controller.toolsEnabled;
} }
} }
} }