Jelajahi Sumber

- in Gerber Editor added the shortcut key 'Space' to change the direction of the array of pads

Marius Stanciu 5 tahun lalu
induk
melakukan
675c7028bb
3 mengubah file dengan 38 tambahan dan 5 penghapusan
  1. 1 0
      CHANGELOG.md
  2. 25 0
      appEditors/AppGerberEditor.py
  3. 12 5
      appGUI/MainGUI.py

+ 1 - 0
CHANGELOG.md

@@ -16,6 +16,7 @@ CHANGELOG for FlatCAM beta
 - updated the translation strings
 - fixed the UI layout in Excellon Editor and made sure that after changing a value in the Notebook side after the mouse is inside the canvas, the canvas takes the focus allowing the key shortcuts to work
 - Turkish language strings updated (by Mehmet Kaya)
+- in Gerber Editor added the shortcut key 'Space' to change the direction of the array of pads
 
 3.11.2020
 

+ 25 - 0
appEditors/AppGerberEditor.py

@@ -744,6 +744,31 @@ class FCPadArray(FCShapeTool):
         self.draw_app.ui.array_frame.hide()
         self.draw_app.app.jump_signal.disconnect()
 
+    def on_key(self, key):
+        key_modifier = QtWidgets.QApplication.keyboardModifiers()
+
+        if key_modifier == QtCore.Qt.ShiftModifier:
+            mod_key = 'Shift'
+        elif key_modifier == QtCore.Qt.ControlModifier:
+            mod_key = 'Control'
+        else:
+            mod_key = None
+
+        if mod_key == 'Control':
+            pass
+        elif mod_key is None:
+            # Toggle Drill Array Direction
+            if key == QtCore.Qt.Key_Space:
+                if self.draw_app.ui.pad_axis_radio.get_value() == 'X':
+                    self.draw_app.ui.pad_axis_radio.set_value('Y')
+                elif self.draw_app.ui.pad_axis_radio.get_value() == 'Y':
+                    self.draw_app.ui.pad_axis_radio.set_value('A')
+                elif self.draw_app.ui.pad_axis_radio.get_value() == 'A':
+                    self.draw_app.ui.pad_axis_radio.set_value('X')
+
+                # ## Utility geometry (animated)
+                self.draw_app.update_utility_geometry(data=(self.draw_app.snap_x, self.draw_app.snap_y))
+
     def clean_up(self):
         self.draw_app.selected = []
         self.draw_app.ui.apertures_table.clearSelection()

+ 12 - 5
appGUI/MainGUI.py

@@ -3277,10 +3277,6 @@ class MainGUI(QtWidgets.QMainWindow):
                     self.on_toggle_notebook()
                     return
 
-                # Rotate
-                if key == QtCore.Qt.Key_Space or key == 'Space':
-                    self.app.grb_editor.transform_tool.on_rotate_key()
-
                 # Switch to Project Tab
                 if key == QtCore.Qt.Key_1 or key == '1':
                     self.app.grb_editor.launched_from_shortcuts = True
@@ -3306,6 +3302,11 @@ class MainGUI(QtWidgets.QMainWindow):
                     if response is not None:
                         self.app.inform.emit(response)
                 else:
+
+                    # Rotate
+                    if key == QtCore.Qt.Key_Space or key == 'Space':
+                        self.app.grb_editor.transform_tool.on_rotate_key()
+
                     # Add Array of pads
                     if key == QtCore.Qt.Key_A or key == 'A':
                         self.app.grb_editor.launched_from_shortcuts = True
@@ -4823,7 +4824,7 @@ class ShortcutsTab(QtWidgets.QWidget):
             _('Esc'), _("Abort and return to Select"),
             _('Space'), _("Toggle Slot direction"),
             _('Ctrl+S'), _("Save Object and Exit Editor"),
-            _('Ctrl+Space'), _("Toggle Slot Array direction")
+            _('Ctrl+Space'), _("Toggle array direction")
         )
 
         # GERBER EDITOR SHORTCUT LIST
@@ -4900,6 +4901,11 @@ class ShortcutsTab(QtWidgets.QWidget):
                     <td height="20"><strong>%s</strong></td>
                     <td>&nbsp;%s</td>
                 </tr>
+                </tr>
+                <tr height="20">
+                    <td height="20"><strong>%s</strong></td>
+                    <td>&nbsp;%s</td>
+                </tr>
                 <tr height="20">
                     <td height="20">&nbsp;</td>
                     <td>&nbsp;</td>
@@ -4957,6 +4963,7 @@ class ShortcutsTab(QtWidgets.QWidget):
             _('Del'), _("Delete"),
             _('Del'), _("Alternate: Delete Apertures"),
             _('Esc'), _("Abort and return to Select"),
+            _('Space'), _("Toggle array direction"),
             _('Shift+M'), _("Distance Minimum Tool"),
             _('Ctrl+E'), _("Eraser Tool"),
             _('Ctrl+S'), _("Save Object and Exit Editor"),