Przeglądaj źródła

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

Marius Stanciu 6 lat temu
rodzic
commit
b5e9997713
4 zmienionych plików z 23 dodań i 2 usunięć
  1. 5 1
      FlatCAMObj.py
  2. 1 0
      README.md
  3. 5 1
      flatcamGUI/FlatCAMGUI.py
  4. 12 0
      flatcamGUI/PlotCanvasLegacy.py

+ 5 - 1
FlatCAMObj.py

@@ -1474,7 +1474,11 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
         try:
         try:
             if aperture == 'all':
             if aperture == 'all':
                 for apid in list(self.apertures.keys()):
                 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:
             else:
                 self.mark_shapes[aperture].clear(update=True)
                 self.mark_shapes[aperture].clear(update=True)
         except Exception as e:
         except Exception as e:

+ 1 - 0
README.md

@@ -23,6 +23,7 @@ CAD program, and create G-Code for Isolation routing.
 - optimized the Gerber mark shapes display
 - optimized the Gerber mark shapes display
 - fixed a color format bug in Tool Move for 3D engine
 - 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
 - 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
 22.09.2019
 
 

+ 5 - 1
flatcamGUI/FlatCAMGUI.py

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

+ 12 - 0
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)
         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):
     def on_scroll(self, event):
         """
         """
         Scroll event handler.
         Scroll event handler.