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

View File

@ -16,8 +16,7 @@ from flatcamEditors.FlatCAMGeoEditor import FCShapeTool
from matplotlib.backend_bases import KeyEvent as mpl_key_event from matplotlib.backend_bases import KeyEvent as mpl_key_event
import webbrowser import webbrowser
from copy import deepcopy from ObjectCollection import KeySensitiveListView
from datetime import datetime
import subprocess import subprocess
import os import os
@ -3134,23 +3133,33 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# Select the object in the Tree above the current one # Select the object in the Tree above the current one
if key == QtCore.Qt.Key_Up: if key == QtCore.Qt.Key_Up:
self.app.collection.set_all_inactive() # make sure it works only for the Project Tab who is an instance of KeySensitiveListView
active_name = active.options['name'] focused_wdg = QtWidgets.QApplication.focusWidget()
active_index = names_list.index(active_name) if isinstance(focused_wdg, KeySensitiveListView):
if active_index == 0: self.app.collection.set_all_inactive()
self.app.collection.set_active(names_list[-1]) if active is None:
else: return
self.app.collection.set_active(names_list[active_index-1]) 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 # Select the object in the Tree bellow the current one
if key == QtCore.Qt.Key_Down: if key == QtCore.Qt.Key_Down:
self.app.collection.set_all_inactive() # make sure it works only for the Project Tab who is an instance of KeySensitiveListView
active_name = active.options['name'] focused_wdg = QtWidgets.QApplication.focusWidget()
active_index = names_list.index(active_name) if isinstance(focused_wdg, KeySensitiveListView):
if active_index == len(names_list) - 1: self.app.collection.set_all_inactive()
self.app.collection.set_active(names_list[0]) if active is None:
else: return
self.app.collection.set_active(names_list[active_index+1]) 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 # New Geometry