Просмотр исходного кода

- Gerber Editor: added some messages to warn user if no selection exists when trying to do aperture deletion or aperture geometry deletion

Marius Stanciu 6 лет назад
Родитель
Сommit
b35dc84f0d
2 измененных файлов с 14 добавлено и 2 удалено
  1. 4 0
      README.md
  2. 10 2
      flatcamEditors/FlatCAMGrbEditor.py

+ 4 - 0
README.md

@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
 
 
 =================================================
 =================================================
 
 
+17.04.2019
+
+- Gerber Editor: added some messages to warn user if no selection exists when trying to do aperture deletion or aperture geometry deletion
+
 16.04.2019
 16.04.2019
 
 
 - added ability to use ENTER key to finish tool adding in Editors, NCC Tool, Paint Tool and SolderPaste Tool.
 - added ability to use ENTER key to finish tool adding in Editors, NCC Tool, Paint Tool and SolderPaste Tool.

+ 10 - 2
flatcamEditors/FlatCAMGrbEditor.py

@@ -1962,6 +1962,9 @@ class FlatCAMGrbEditor(QtCore.QObject):
         try:
         try:
             if apid is None or apid is False:
             if apid is None or apid is False:
                 # deleted_tool_dia = float(self.apertures_table.item(self.apertures_table.currentRow(), 1).text())
                 # deleted_tool_dia = float(self.apertures_table.item(self.apertures_table.currentRow(), 1).text())
+                if len(self.apertures_table.selectionModel().selectedRows()) == 0:
+                    self.app.inform.emit(_("[WARNING_NOTCL] Select an aperture in Aperture Table"))
+                    return
                 for index in self.apertures_table.selectionModel().selectedRows():
                 for index in self.apertures_table.selectionModel().selectedRows():
                     row = index.row()
                     row = index.row()
                     deleted_apcode_list.append(self.apertures_table.item(row, 1).text())
                     deleted_apcode_list.append(self.apertures_table.item(row, 1).text())
@@ -1972,7 +1975,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
                 else:
                 else:
                     deleted_apcode_list.append(apid)
                     deleted_apcode_list.append(apid)
         except:
         except:
-            self.app.inform.emit(_("[WARNING_NOTCL] Select a tool in Tool Table"))
+            self.app.inform.emit(_("[WARNING_NOTCL] Select an aperture in Aperture Table"))
             return
             return
 
 
         for deleted_aperture in deleted_apcode_list:
         for deleted_aperture in deleted_apcode_list:
@@ -2964,12 +2967,17 @@ class FlatCAMGrbEditor(QtCore.QObject):
 
 
     def delete_selected(self):
     def delete_selected(self):
         temp_ref = [s for s in self.selected]
         temp_ref = [s for s in self.selected]
+
+        if len(temp_ref) == 0:
+            self.app.inform.emit(_("[ERROR_NOTCL] Failed. No aperture geometry is selected."))
+            return
+
         for shape_sel in temp_ref:
         for shape_sel in temp_ref:
             self.delete_shape(shape_sel)
             self.delete_shape(shape_sel)
 
 
         self.selected = []
         self.selected = []
         self.build_ui()
         self.build_ui()
-        self.app.inform.emit(_("[success] Done. Apertures deleted."))
+        self.app.inform.emit(_("[success] Done. Apertures geometry deleted."))
 
 
     def delete_shape(self, shape):
     def delete_shape(self, shape):
         self.is_modified = True
         self.is_modified = True