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

- more PEP8 changes in Gerber editor

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

+ 4 - 0
README.md

@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
 
 
 =================================================
 =================================================
 
 
+20.05.2019
+
+- more PEP8 changes in Gerber editor
+
 19.05.2019
 19.05.2019
 
 
 - fixed the Circle Steps parameter for both Gerber and Geometry objects not being applied and instead the app internal defaults were used.
 - fixed the Circle Steps parameter for both Gerber and Geometry objects not being applied and instead the app internal defaults were used.

+ 16 - 13
flatcamEditors/FlatCAMGrbEditor.py

@@ -82,7 +82,7 @@ class DrawToolShape(object):
                 return
                 return
         return pts
         return pts
 
 
-    def __init__(self, geo={}):
+    def __init__(self, geo=None):
 
 
         # Shapely type or list of such
         # Shapely type or list of such
         self.geo = geo
         self.geo = geo
@@ -525,11 +525,13 @@ class FCPadArray(FCShapeTool):
                     new_geo_el = dict()
                     new_geo_el = dict()
 
 
                     if 'solid' in geo_el:
                     if 'solid' in geo_el:
-                        new_geo_el['solid'] = affinity.translate(geo_el['solid'], xoff=(dx - self.last_dx),
-                                                                 yoff=(dy - self.last_dy))
+                        new_geo_el['solid'] = affinity.translate(
+                            geo_el['solid'], xoff=(dx - self.last_dx), yoff=(dy - self.last_dy)
+                        )
                     if 'follow' in geo_el:
                     if 'follow' in geo_el:
-                        new_geo_el['follow'] = affinity.translate(geo_el['solid'], xoff=(dx - self.last_dx),
-                                                                 yoff=(dy - self.last_dy))
+                        new_geo_el['follow'] = affinity.translate(
+                            geo_el['solid'], xoff=(dx - self.last_dx), yoff=(dy - self.last_dy)
+                        )
                     geo_el_list.append(new_geo_el)
                     geo_el_list.append(new_geo_el)
 
 
                 else:
                 else:
@@ -582,7 +584,7 @@ class FCPadArray(FCShapeTool):
             center = Point([point_x, point_y])
             center = Point([point_x, point_y])
             new_geo_el['solid'] = center.buffer(self.radius)
             new_geo_el['solid'] = center.buffer(self.radius)
             new_geo_el['follow'] = center
             new_geo_el['follow'] = center
-            return  new_geo_el
+            return new_geo_el
         elif ap_type == 'R':
         elif ap_type == 'R':
             new_geo_el = dict()
             new_geo_el = dict()
 
 
@@ -590,9 +592,9 @@ class FCPadArray(FCShapeTool):
             p2 = (point_x + self.half_width, point_y - self.half_height)
             p2 = (point_x + self.half_width, point_y - self.half_height)
             p3 = (point_x + self.half_width, point_y + self.half_height)
             p3 = (point_x + self.half_width, point_y + self.half_height)
             p4 = (point_x - self.half_width, point_y + self.half_height)
             p4 = (point_x - self.half_width, point_y + self.half_height)
-            new_geo_el['solid'] =  Polygon([p1, p2, p3, p4, p1])
+            new_geo_el['solid'] = Polygon([p1, p2, p3, p4, p1])
             new_geo_el['follow'] = Point([point_x, point_y])
             new_geo_el['follow'] = Point([point_x, point_y])
-            return  new_geo_el
+            return new_geo_el
         elif ap_type == 'O':
         elif ap_type == 'O':
             geo = []
             geo = []
             new_geo_el = dict()
             new_geo_el = dict()
@@ -725,7 +727,7 @@ class FCPoligonize(FCShapeTool):
         self.name = 'poligonize'
         self.name = 'poligonize'
         self.draw_app = draw_app
         self.draw_app = draw_app
 
 
-        self.draw_app.app.inform.emit( _("Select shape(s) and then click ..."))
+        self.draw_app.app.inform.emit(_("Select shape(s) and then click ..."))
         self.draw_app.in_action = True
         self.draw_app.in_action = True
         self.make()
         self.make()
 
 
@@ -748,7 +750,7 @@ class FCPoligonize(FCShapeTool):
                         apid_set.add(apid)
                         apid_set.add(apid)
                         break
                         break
 
 
-        if len (apid_set) > 1:
+        if len(apid_set) > 1:
             self.draw_app.in_action = False
             self.draw_app.in_action = False
             self.complete = True
             self.complete = True
             self.draw_app.app.inform.emit(_("[WARNING_NOTCL] Failed. Poligonize works only on "
             self.draw_app.app.inform.emit(_("[WARNING_NOTCL] Failed. Poligonize works only on "
@@ -849,8 +851,9 @@ class FCRegion(FCShapeTool):
 
 
         try:
         try:
             QtGui.QGuiApplication.restoreOverrideCursor()
             QtGui.QGuiApplication.restoreOverrideCursor()
-        except:
-            pass
+        except Exception as e:
+            log.debug("FlatCAMGrbEditor.FCRegion --> %s" % str(e))
+
         self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero.png'))
         self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero.png'))
         QtGui.QGuiApplication.setOverrideCursor(self.cursor)
         QtGui.QGuiApplication.setOverrideCursor(self.cursor)
 
 
@@ -1863,7 +1866,7 @@ class FCApertureMove(FCShapeTool):
                     self.geometry.append(DrawToolShape(new_geo_el))
                     self.geometry.append(DrawToolShape(new_geo_el))
                     self.current_storage.remove(select_shape)
                     self.current_storage.remove(select_shape)
                     sel_shapes_to_be_deleted.append(select_shape)
                     sel_shapes_to_be_deleted.append(select_shape)
-                    self.draw_app.on_grb_shape_complete(self.current_storage, noplot=True)
+                    self.draw_app.on_grb_shape_complete(self.current_storage, no_plot=True)
                     self.geometry = []
                     self.geometry = []
 
 
             for shp in sel_shapes_to_be_deleted:
             for shp in sel_shapes_to_be_deleted: