- repurposed shortcut key 'Delete' to delete tools in tooltable when the mouse is over the Seleted tab (with Geometry inside) or in Tools tab (when NCC Tool or Paint Tool is inside). Or in Excellon Editor when mouse is hovering the Selected tab selecting a tool, 'Delete' key will delete that tool, if on canvas 'Delete' key will delete a selected shape (drill). In rest, will delete selected objects.

This commit is contained in:
Marius Stanciu
2019-02-10 02:09:05 +02:00
committed by Marius S
parent b68a010bde
commit f35994a712
4 changed files with 128 additions and 69 deletions

View File

@@ -991,7 +991,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
</tr>
<tr height="20">
<td height="20"><strong>Del</strong></td>
<td>&nbsp;Delete Obj</td>
<td>&nbsp;Delete Object</td>
</tr>
<tr height="20">
<td height="20"><strong>Del</strong></td>
<td>&nbsp;Alternate: Delete Tool</td>
</tr>
<tr height="20">
<td height="20"><strong>'`'</strong></td>
@@ -1150,6 +1154,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
<td height="20"><strong>Del</strong></td>
<td>&nbsp;Delete Drill(s)</td>
</tr>
<tr height="20">
<td height="20"><strong>Del</strong></td>
<td>&nbsp;Alternate: Delete Tool(s)</td>
</tr>
<tr height="20">
<td height="20">&nbsp;</td>
<td>&nbsp;</td>
@@ -1616,7 +1624,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
if key == QtCore.Qt.Key_Y:
self.app.on_skewy()
return
elif modifiers == QtCore.Qt.AltModifier:
# Eanble all plots
if key == Qt.Key_1:
@@ -1698,11 +1705,17 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
if key == QtCore.Qt.Key_3:
self.app.on_select_tab('tool')
# Delete
if key == QtCore.Qt.Key_Delete or key == 'Delete':
# Delete from PyQt
# It's meant to make a difference between delete objects and delete tools in
# Geometry Selected tool table
if key == QtCore.Qt.Key_Delete:
self.app.on_delete_keypress()
# Delete from canvas
if key == 'Delete':
# Delete via the application to
# ensure cleanup of the GUI
if active:
# Delete via the application to
# ensure cleanup of the GUI
active.app.on_delete()
# Escape = Deselect All
@@ -1768,7 +1781,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# Add a Tool from shortcut
if key == QtCore.Qt.Key_T:
self.app.on_skey_tool_add()
self.app.on_tool_add_keypress()
# Zoom Fit
if key == QtCore.Qt.Key_V:
@@ -2055,8 +2068,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.app.exc_editor.select_tool('select')
return
# Delete selected object
if key == QtCore.Qt.Key_Delete or key == 'Delete':
# Delete selected object if delete key event comes out of canvas
if key == 'Delete':
self.app.exc_editor.launched_from_shortcuts = True
if self.app.exc_editor.selected:
self.app.exc_editor.delete_selected()
@@ -2065,6 +2078,12 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.app.inform.emit("[WARNING_NOTCL]Cancelled. Nothing selected to delete.")
return
# Delete tools in tools table if delete key event comes from the Selected Tab
if key == QtCore.Qt.Key_Delete:
self.app.exc_editor.launched_from_shortcuts = True
self.app.exc_editor.on_tool_delete()
return
if key == QtCore.Qt.Key_Minus or key == '-':
self.app.exc_editor.launched_from_shortcuts = True
self.app.plotcanvas.zoom(1 / self.app.defaults['zoom_ratio'],