Browse Source

Merged marius_stanciu/flatcam_beta/Beta_8.993 into Beta

Marius Stanciu 5 years ago
parent
commit
cc7d2167ba
3 changed files with 18 additions and 12 deletions
  1. 4 3
      CHANGELOG.md
  2. 7 5
      FlatCAMApp.py
  3. 7 4
      FlatCAMCommon.py

+ 4 - 3
CHANGELOG.md

@@ -10,16 +10,17 @@ CHANGELOG for FlatCAM beta
 6.05.2020
 6.05.2020
 
 
 - wip in adding Exclusion areas in Geometry object; each Geometry object has now a storage for shapes (exclusion shapes, should I make them more general?)
 - wip in adding Exclusion areas in Geometry object; each Geometry object has now a storage for shapes (exclusion shapes, should I make them more general?)
-- changed the above: too many shapes collections and the performance will go down. Created a class Exclusion areas that holds all the require properties and the Object UI elements will connect to it's methods. This way I can apply this to Excellon object too (who are a special type of Geometry Object)
+- changed the above: too many shapes collections and the performance will go down. Created a class ExclusionAreas that holds all the require properties and the Object UI elements will connect to it's methods. This way I can apply this feature to Excellon object too (who is a special type of Geometry Object)
+- handled the New project event and the object deletion (when all objects are deleted then the exclusion areas will be deleted too)
 
 
 5.05.2020
 5.05.2020
 
 
-- fixed an issue that made the preprocessors comboxes in Preferences not to load and display the saved value fro the file
+- fixed an issue that made the preprocessors combo boxes in Preferences not to load and display the saved value fro the file
 - some PEP8 corrections
 - some PEP8 corrections
 
 
 4.05.2020
 4.05.2020
 
 
-- in detachable tabs, Linux loose the reference of the detached tab and on close of the detachable tabs will gave a 'segmantation fault' error. Solved it by not deleting the reference in case of Unix-like systems
+- in detachable tabs, Linux loose the reference of the detached tab and on close of the detachable tabs will gave a 'segmentation fault' error. Solved it by not deleting the reference in case of Unix-like systems
 - some strings added to translation strings
 - some strings added to translation strings
 
 
 3.05.2020
 3.05.2020

+ 7 - 5
FlatCAMApp.py

@@ -5130,11 +5130,6 @@ class App(QtCore.QObject):
                                 obj_active.mark_shapes[el].enabled = False
                                 obj_active.mark_shapes[el].enabled = False
                                 # obj_active.mark_shapes[el] = None
                                 # obj_active.mark_shapes[el] = None
                                 del el
                                 del el
-                        # if the deleted object is GerberObject then make sure to delete the possible mark shapes
-                        if obj_active.kind == 'geometry':
-                            obj_active.exclusion_shapes.clear(update=True)
-                            obj_active.exclusion_shapes.enabled = False
-                            del obj_active.exclusion_shapes
                         elif isinstance(obj_active, CNCJobObject):
                         elif isinstance(obj_active, CNCJobObject):
                             try:
                             try:
                                 obj_active.text_col.enabled = False
                                 obj_active.text_col.enabled = False
@@ -5152,6 +5147,10 @@ class App(QtCore.QObject):
                     self.inform.emit('%s...' % _("Object(s) deleted"))
                     self.inform.emit('%s...' % _("Object(s) deleted"))
                     # make sure that the selection shape is deleted, too
                     # make sure that the selection shape is deleted, too
                     self.delete_selection_shape()
                     self.delete_selection_shape()
+
+                    # if there are no longer objects delete also the exclusion areas shapes
+                    if not self.collection.get_list():
+                        self.exc_areas.clear_shapes()
                 else:
                 else:
                     self.inform.emit('[ERROR_NOTCL] %s' % _("Failed. No object(s) selected..."))
                     self.inform.emit('[ERROR_NOTCL] %s' % _("Failed. No object(s) selected..."))
         else:
         else:
@@ -7419,6 +7418,9 @@ class App(QtCore.QObject):
                 except AttributeError:
                 except AttributeError:
                     pass
                     pass
 
 
+        # delete the exclusion areas
+        self.exc_areas.clear_shapes()
+
         # tcl needs to be reinitialized, otherwise old shell variables etc  remains
         # tcl needs to be reinitialized, otherwise old shell variables etc  remains
         self.shell.init_tcl()
         self.shell.init_tcl()
 
 

+ 7 - 4
FlatCAMCommon.py

@@ -472,10 +472,7 @@ class ExclusionAreas:
                 data=(curr_pos[0], curr_pos[1]))
                 data=(curr_pos[0], curr_pos[1]))
 
 
     def on_clear_area_click(self):
     def on_clear_area_click(self):
-        self.exclusion_areas_storage.clear()
-        FlatCAMTool.delete_moving_selection_shape(self)
-        self.app.delete_selection_shape()
-        FlatCAMTool.delete_tool_selection_shape(self, shapes_storage=self.exclusion_shapes)
+        self.clear_shapes()
 
 
         # restore the default StyleSheet
         # restore the default StyleSheet
         self.cnc_button.setStyleSheet("")
         self.cnc_button.setStyleSheet("")
@@ -487,3 +484,9 @@ class ExclusionAreas:
                                 }
                                 }
                                 """)
                                 """)
         self.cnc_button.setToolTip('%s' % _("Generate the CNC Job object."))
         self.cnc_button.setToolTip('%s' % _("Generate the CNC Job object."))
+
+    def clear_shapes(self):
+        self.exclusion_areas_storage.clear()
+        FlatCAMTool.delete_moving_selection_shape(self)
+        self.app.delete_selection_shape()
+        FlatCAMTool.delete_tool_selection_shape(self, shapes_storage=self.exclusion_shapes)