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

This commit is contained in:
Marius Stanciu 2020-04-06 06:28:55 +03:00 committed by Marius
parent 8a2ed1c726
commit 69b39e2937
2 changed files with 26 additions and 0 deletions

View File

@ -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

View File

@ -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()