Przeglądaj źródła

- added more shortcut keys in the Geometry Editor and in Excellon Editor; activated also the zoom (fit, in, out) shortcut keys ('1' , '2', '3') for the editors

Marius Stanciu 7 lat temu
rodzic
commit
970b260333
3 zmienionych plików z 82 dodań i 8 usunięć
  1. 78 5
      FlatCAMEditor.py
  2. 3 3
      FlatCAMGUI.py
  3. 1 0
      README.md

+ 78 - 5
FlatCAMEditor.py

@@ -2569,6 +2569,15 @@ class FlatCAMGeoEditor(QtCore.QObject):
             self.on_tool_select('rotate')
             self.active_tool.set_origin(self.snap(self.x, self.y))
 
+        if event.key == '1':
+            self.app.on_zoom_fit(None)
+
+        if event.key == '2':
+            self.app.plotcanvas.zoom(1 / self.app.defaults['zoom_ratio'], [self.snap_x, self.snap_y])
+
+        if event.key == '3':
+            self.app.plotcanvas.zoom(self.app.defaults['zoom_ratio'], [self.snap_x, self.snap_y])
+
         # Arc Tool
         if event.key.name == 'A':
             self.select_tool('arc')
@@ -2584,6 +2593,22 @@ class FlatCAMGeoEditor(QtCore.QObject):
             self.active_tool.set_origin(self.snap(self.x, self.y))
             self.app.inform.emit("Click on target point.")
 
+        # Substract Tool
+        if event.key.name == 'E':
+            if self.get_selected() is not None:
+                self.intersection()
+            else:
+                msg = "Please select geometry items \n" \
+                      "on which to perform Intersection Tool."
+
+                messagebox =QtWidgets.QMessageBox()
+                messagebox.setText(msg)
+                messagebox.setWindowTitle("Warning")
+                messagebox.setWindowIcon(QtGui.QIcon('share/warning.png'))
+                messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
+                messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
+                messagebox.exec_()
+
         # Grid Snap
         if event.key.name == 'G':
             self.app.ui.grid_snap_btn.trigger()
@@ -2622,14 +2647,42 @@ class FlatCAMGeoEditor(QtCore.QObject):
         if event.key.name == 'R':
             self.select_tool('rectangle')
 
-        # Select Tool
+        # Substract Tool
         if event.key.name == 'S':
-            self.select_tool('select')
+            if self.get_selected() is not None:
+                self.subtract()
+            else:
+                msg = "Please select geometry items \n" \
+                      "on which to perform Substraction Tool."
+
+                messagebox =QtWidgets.QMessageBox()
+                messagebox.setText(msg)
+                messagebox.setWindowTitle("Warning")
+                messagebox.setWindowIcon(QtGui.QIcon('share/warning.png'))
+                messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
+                messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
+                messagebox.exec_()
 
         # Add Text Tool
         if event.key.name == 'T':
             self.select_tool('text')
 
+        # Substract Tool
+        if event.key.name == 'U':
+            if self.get_selected() is not None:
+                self.union()
+            else:
+                msg = "Please select geometry items \n" \
+                      "on which to perform union."
+
+                messagebox =QtWidgets.QMessageBox()
+                messagebox.setText(msg)
+                messagebox.setWindowTitle("Warning")
+                messagebox.setWindowIcon(QtGui.QIcon('share/warning.png'))
+                messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok)
+                messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok)
+                messagebox.exec_()
+
         # Cut Action Tool
         if event.key.name == 'X':
             if self.get_selected() is not None:
@@ -2662,11 +2715,15 @@ class FlatCAMGeoEditor(QtCore.QObject):
     def on_shortcut_list(self):
         msg = '''<b>Shortcut list in Geometry Editor</b><br>
 <br>
+<b>1:</b>       Zoom Fit<br>
+<b>2:</b>       Zoom Out<br>
+<b>3:</b>       Zoom In<br>
 <b>A:</b>       Add an 'Arc'<br>
 <b>B:</b>       Add a Buffer Geo<br>
 <b>C:</b>       Copy Geo Item<br>
+<b>E:</b>       Intersection Tool<br>
 <b>G:</b>       Grid Snap On/Off<br>
-<b>G:</b>       Paint Tool<br>
+<b>I:</b>       Paint Tool<br>
 <b>K:</b>       Corner Snap On/Off<br>
 <b>M:</b>       Move Geo Item<br>
 <br>
@@ -2674,8 +2731,9 @@ class FlatCAMGeoEditor(QtCore.QObject):
 <b>O:</b>       Add a 'Circle'<br>
 <b>P:</b>       Add a 'Path'<br>
 <b>R:</b>       Add an 'Rectangle'<br>
-<b>S:</b>       Select Tool Active<br>
+<b>S:</b>       Substraction Tool<br>
 <b>T:</b>       Add Text Geometry<br>
+<b>U:</b>       Union Tool<br>
 <br>
 <b>X:</b>       Cut Path<br>
 <br>
@@ -2683,7 +2741,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
 <br>
 <b>Space:</b>   Rotate selected Geometry<br>
 <b>Enter:</b>   Finish Current Action<br>
-<b>Escape:</b>  Abort Current Action<br>
+<b>Escape:</b>  Select Tool (Exit any other Tool)<br>
 <b>Delete:</b>  Delete Obj'''
 
         helpbox =QtWidgets.QMessageBox()
@@ -4756,6 +4814,18 @@ class FlatCAMExcEditor(QtCore.QObject):
                 self.app.inform.emit("[warning_notcl]Cancelled. Nothing selected to delete.")
             return
 
+        if event.key == '1':
+            self.launched_from_shortcuts = True
+            self.app.on_zoom_fit(None)
+
+        if event.key == '2':
+            self.launched_from_shortcuts = True
+            self.app.plotcanvas.zoom(1 / self.app.defaults['zoom_ratio'], [self.snap_x, self.snap_y])
+
+        if event.key == '3':
+            self.launched_from_shortcuts = True
+            self.app.plotcanvas.zoom(self.app.defaults['zoom_ratio'], [self.snap_x, self.snap_y])
+
         # Add Array of Drill Hole Tool
         if event.key.name == 'A':
             self.launched_from_shortcuts = True
@@ -4840,6 +4910,9 @@ class FlatCAMExcEditor(QtCore.QObject):
     def on_shortcut_list(self):
         msg = '''<b>Shortcut list in Geometry Editor</b><br>
 <br>
+<b>1:</b>       Zoom Fit<br>
+<b>2:</b>       Zoom Out<br>
+<b>3:</b>       Zoom In<br>
 <b>A:</b>       Add an 'Drill Array'<br>
 <b>C:</b>       Copy Drill Hole<br>
 <b>D:</b>       Add an Drill Hole<br>

+ 3 - 3
FlatCAMGUI.py

@@ -294,11 +294,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
         self.geo_editor_menu.addSeparator()
         self.geo_add_text_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/text32.png'), 'Add Text\tT')
         self.geo_editor_menu.addSeparator()
-        self.geo_union_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/union16.png'), 'Polygon Union')
+        self.geo_union_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/union16.png'), 'Polygon Union\tU')
         self.geo_intersection_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/intersection16.png'),
-                                                         'Polygon Intersection')
+                                                         'Polygon Intersection\tE')
         self.geo_subtract_menuitem = self.geo_editor_menu.addAction(
-            QtGui.QIcon('share/subtract16.png'), 'Polygon Subtraction'
+            QtGui.QIcon('share/subtract16.png'), 'Polygon Subtraction\tS'
         )
         self.geo_editor_menu.addSeparator()
         self.geo_cutpath_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/cutpath16.png'), 'Cut Path\tX')

+ 1 - 0
README.md

@@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
 
 - fixed issue in Tool Calculators when a float value was entered starting only with the dot.
 - added protection for entering incorrect values in Offset and Scale fields for Gerber and Geometry objects (in Selected Tab)
+- added more shortcut keys in the Geometry Editor and in Excellon Editor; activated also the zoom (fit, in, out) shortcut keys ('1' , '2', '3') for the editors
 
 28.01.2018