diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 5d098abf..f3bdf584 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -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: diff --git a/README.md b/README.md index d07cf301..3a247222 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 71338f76..e4b84b91 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -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 diff --git a/flatcamGUI/PlotCanvasLegacy.py b/flatcamGUI/PlotCanvasLegacy.py index 8d6c3515..65981b98 100644 --- a/flatcamGUI/PlotCanvasLegacy.py +++ b/flatcamGUI/PlotCanvasLegacy.py @@ -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.