- fixed a bug in handling the UP/DOWN key shortcuts that caused a crash when no object was selected in the Project Tab; also made sure that the said keys are handled only for the Project Tab

This commit is contained in:
Marius Stanciu 2020-04-06 20:52:00 +03:00 committed by Marius
parent ee6ac2593f
commit d14e5d9445
2 changed files with 26 additions and 16 deletions

View File

@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing.
- added key shortcuts (arrow up/down) that will select the objects in the Project tab if the focus is in that tab
- added a minor change to the ListSys Tcl command
- fixed an crash generated when running the Tool Database from the Menu -> Options menu entry
- fixed a bug in handling the UP/DOWN key shortcuts that caused a crash when no object was selected in the Project Tab; also made sure that the said keys are handled only for the Project Tab
5.04.2020

View File

@ -16,8 +16,7 @@ from flatcamEditors.FlatCAMGeoEditor import FCShapeTool
from matplotlib.backend_bases import KeyEvent as mpl_key_event
import webbrowser
from copy import deepcopy
from datetime import datetime
from ObjectCollection import KeySensitiveListView
import subprocess
import os
@ -3134,23 +3133,33 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# 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])
# make sure it works only for the Project Tab who is an instance of KeySensitiveListView
focused_wdg = QtWidgets.QApplication.focusWidget()
if isinstance(focused_wdg, KeySensitiveListView):
self.app.collection.set_all_inactive()
if active is None:
return
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])
# make sure it works only for the Project Tab who is an instance of KeySensitiveListView
focused_wdg = QtWidgets.QApplication.focusWidget()
if isinstance(focused_wdg, KeySensitiveListView):
self.app.collection.set_all_inactive()
if active is None:
return
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