Explorar el Código

- added key shortcuts (arrow up/down) that will select the objects in the Project tab if the focus is in that tab

Marius Stanciu hace 5 años
padre
commit
69b39e2937
Se han modificado 2 ficheros con 26 adiciones y 0 borrados
  1. 4 0
      README.md
  2. 22 0
      flatcamGUI/FlatCAMGUI.py

+ 4 - 0
README.md

@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
 
 =================================================
 
+6.04.2020 
+
+- added key shortcuts (arrow up/down) that will select the objects in the Project tab if the focus is in that tab
+
 5.04.2020 
 
 - made sure that the HDPI scaling attribute is set before the QApplication is started

+ 22 - 0
flatcamGUI/FlatCAMGUI.py

@@ -2778,6 +2778,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
         modifiers = QtWidgets.QApplication.keyboardModifiers()
         active = self.app.collection.get_active()
         selected = self.app.collection.get_selected()
+        names_list = self.app.collection.get_names()
 
         matplotlib_key_flag = False
 
@@ -3131,6 +3132,27 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
                     self.app.collection.update_view()
                     self.app.delete_selection_shape()
 
+                # Select the object in the Tree above the current one
+                if key == QtCore.Qt.Key_Up:
+                    self.app.collection.set_all_inactive()
+                    active_name = active.options['name']
+                    active_index = names_list.index(active_name)
+                    if active_index == 0:
+                        self.app.collection.set_active(names_list[-1])
+                    else:
+                        self.app.collection.set_active(names_list[active_index-1])
+
+                # Select the object in the Tree bellow the current one
+                if key == QtCore.Qt.Key_Down:
+                    self.app.collection.set_all_inactive()
+                    active_name = active.options['name']
+                    active_index = names_list.index(active_name)
+                    if active_index == len(names_list) - 1:
+                        self.app.collection.set_active(names_list[0])
+                    else:
+                        self.app.collection.set_active(names_list[active_index+1])
+
+
                 # New Geometry
                 if key == QtCore.Qt.Key_B:
                     self.app.new_gerber_object()