- in legacy graphic engine, fixed issue with Delete shortcut key trying to delete twice

This commit is contained in:
Marius Stanciu 2019-09-23 17:52:34 +03:00 committed by Marius
parent ae7fec6dd1
commit b5e9997713
4 changed files with 23 additions and 2 deletions

View File

@ -1474,7 +1474,11 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
try:
if aperture == 'all':
for apid in list(self.apertures.keys()):
self.mark_shapes[apid].clear(update=True)
if self.app.is_legacy is True:
self.mark_shapes[apid].clear(update=False)
else:
self.mark_shapes[apid].clear(update=True)
else:
self.mark_shapes[aperture].clear(update=True)
except Exception as e:

View File

@ -23,6 +23,7 @@ CAD program, and create G-Code for Isolation routing.
- optimized the Gerber mark shapes display
- fixed a color format bug in Tool Move for 3D engine
- made sure that when the Tool Move is used on a Gerber file with mark shapes active, those mark shapes are deleted before the actual move
- in legacy graphic engine, fixed issue with Delete shortcut key trying to delete twice
22.09.2019

View File

@ -2266,6 +2266,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
active = self.app.collection.get_active()
selected = self.app.collection.get_selected()
matplotlib_key_flag = False
# events out of the self.app.collection view (it's about Project Tab) are of type int
if type(event) is int:
key = event
@ -2273,6 +2275,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
elif type(event) == QtGui.QKeyEvent:
key = event.key()
elif isinstance(event, mpl_key_event): # MatPlotLib key events are trickier to interpret than the rest
matplotlib_key_flag = True
key = event.key
key = QtGui.QKeySequence(key)
@ -2491,7 +2495,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# Delete from PyQt
# It's meant to make a difference between delete objects and delete tools in
# Geometry Selected tool table
if key == QtCore.Qt.Key_Delete:
if key == QtCore.Qt.Key_Delete and matplotlib_key_flag is False:
self.app.on_delete_keypress()
# Delete from canvas

View File

@ -476,6 +476,18 @@ class PlotCanvasLegacy(QtCore.QObject):
return self.figure.add_axes([0.05, 0.05, 0.9, 0.9], label=name)
def remove_current_axes(self):
"""
:return: The name of the deleted axes
"""
axes_to_remove = self.figure.axes.gca()
current_axes_name = deepcopy(axes_to_remove._label)
self.figure.axes.remove(axes_to_remove)
return current_axes_name
def on_scroll(self, event):
"""
Scroll event handler.