Browse Source

- more PEP8 corrections

Marius Stanciu 6 years ago
parent
commit
6743927eb2
10 changed files with 98 additions and 115 deletions
  1. 0 1
      FlatCAMCommon.py
  2. 72 90
      FlatCAMObj.py
  3. 3 0
      FlatCAMPool.py
  4. 14 14
      FlatCAMPostProc.py
  5. 3 3
      FlatCAMProcess.py
  6. 0 1
      FlatCAMTool.py
  7. 2 4
      FlatCAMTranslation.py
  8. 1 1
      FlatCAMWorker.py
  9. 1 0
      README.md
  10. 2 1
      camlib.py

+ 0 - 1
FlatCAMCommon.py

@@ -46,4 +46,3 @@ class LoudDict(dict):
         """
 
         self.callback = callback
-

+ 72 - 90
FlatCAMObj.py

@@ -35,9 +35,9 @@ class ValidationError(Exception):
 
         self.errors = errors
 
-# ##################################### ##
-# #            FlatCAMObj              # ##
-# ##################################### ##
+# #######################################
+# #            FlatCAMObj              ##
+# #######################################
 
 
 class FlatCAMObj(QtCore.QObject):
@@ -581,7 +581,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
         try:
             # if connected, disconnect the signal from the slot on item_changed as it creates issues
             self.ui.apertures_table.itemChanged.disconnect()
-        except:
+        except Exception as e:
             pass
 
         self.apertures_row = 0
@@ -903,7 +903,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
                 geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
                 geo_obj.solid_geometry = []
                 for i in range(passes):
-                    iso_offset = (((2 * i + 1) / 2.0) * dia) - (i * overlap * dia)
+                    iso_offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia)
 
                     # if milling type is climb then the move is counter-clockwise around features
                     if milling_type == 'cl':
@@ -929,6 +929,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
                         break
                     else:
                         empty_cnt += 1
+
                 if empty_cnt == len(geo_obj.solid_geometry):
                     raise ValidationError("Empty Geometry", None)
                 geo_obj.multigeo = False
@@ -938,7 +939,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
         else:
             for i in range(passes):
 
-                offset = (2 * i + 1) / 2.0 * dia - i * overlap * dia
+                offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia)
                 if passes > 1:
                     if self.iso_type == 0:
                         iso_name = self.options["name"] + "_ext_iso" + str(i + 1)
@@ -1645,7 +1646,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
                 if option is not 'name':
                     try:
                         exc_final.options[option] = exc.options[option]
-                    except:
+                    except Exception as e:
                         exc.app.log.warning("Failed to copy option.", option)
 
             for drill in exc.drills:
@@ -1789,7 +1790,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
         try:
             # if connected, disconnect the signal from the slot on item_changed as it creates issues
             self.ui.tools_table.itemChanged.disconnect()
-        except:
+        except Exception as e:
             pass
 
         n = len(self.tools)
@@ -2074,12 +2075,12 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
         for row in range(self.ui.tools_table.rowCount()):
             try:
                 self.ui.tools_table.cellWidget(row, 5).clicked.disconnect()
-            except:
+            except Exception as e:
                 pass
 
         try:
             self.ui.plot_cb.stateChanged.disconnect()
-        except:
+        except Exception as e:
             pass
 
     def on_tool_offset_edit(self):
@@ -2961,7 +2962,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         })
 
         if "cnctooldia" not in self.options:
-            self.options["cnctooldia"] =  self.app.defaults["geometry_cnctooldia"]
+            self.options["cnctooldia"] = self.app.defaults["geometry_cnctooldia"]
             # try:
             #     self.options["cnctooldia"] = [
             #         float(eval(dia)) for dia in str(self.app.defaults["geometry_cnctooldia"]).split(",")
@@ -3257,7 +3258,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                 self.tools.update({
                     self.tooluid: {
                         'tooldia': float(toold),
-                        'offset': ('Path'),
+                        'offset': 'Path',
                         'offset_value': 0.0,
                         'type': _('Rough'),
                         'tool_type': 'C1',
@@ -3340,7 +3341,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
             tool_offset = self.ui.geo_tools_table.cellWidget(current_row, 2)
             if tool_offset is not None:
                 tool_offset_txt = tool_offset.currentText()
-                if tool_offset_txt == ('Custom'):
+                if tool_offset_txt == 'Custom':
                     self.ui.tool_offset_entry.show()
                     self.ui.tool_offset_lbl.show()
                 else:
@@ -3580,7 +3581,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         # we do this HACK to make sure the tools attribute to be serialized is updated in the self.ser_attrs list
         try:
             self.ser_attrs.remove('tools')
-        except:
+        except Exception as e:
             pass
         self.ser_attrs.append('tools')
 
@@ -3689,7 +3690,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         try:
             self.ser_attrs.remove('tools')
             self.ser_attrs.append('tools')
-        except:
+        except Exception as e:
             pass
 
         self.app.inform.emit(_(
@@ -3723,9 +3724,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                         self.tools = deepcopy(temp_tools)
                         temp_tools.clear()
                     except AttributeError:
-                        self.app.inform.emit(_(
-                            "[WARNING_NOTCL] Failed. Select a tool to delete."
-                        ))
+                        self.app.inform.emit(_("[WARNING_NOTCL] Failed. Select a tool to delete."))
                         self.build_ui()
                         return
                     except Exception as e:
@@ -3733,9 +3732,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                 # deselect the table
                 # self.ui.geo_tools_table.clearSelection()
             else:
-                self.app.inform.emit(_(
-                    "[WARNING_NOTCL] Failed. Select a tool to delete."
-                ))
+                self.app.inform.emit(_("[WARNING_NOTCL] Failed. Select a tool to delete."))
                 self.build_ui()
                 return
         else:
@@ -3752,14 +3749,12 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         # we do this HACK to make sure the tools attribute to be serialized is updated in the self.ser_attrs list
         try:
             self.ser_attrs.remove('tools')
-        except:
+        except Exception as e:
             pass
         self.ser_attrs.append('tools')
 
         self.build_ui()
-        self.app.inform.emit(_(
-            "[success] Tool was deleted in Tool Table."
-        ))
+        self.app.inform.emit(_("[success] Tool was deleted in Tool Table."))
 
         obj_active = self.app.collection.get_active()
         # if the object was MultiGeo and now it has no tool at all (therefore no geometry)
@@ -3778,7 +3773,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                 obj_active.options['ymin'] = ymin
                 obj_active.options['xmax'] = xmax
                 obj_active.options['ymax'] = ymax
-            except:
+            except Exception as e:
                 obj_active.options['xmin'] = 0
                 obj_active.options['ymin'] = 0
                 obj_active.options['xmax'] = 0
@@ -3793,7 +3788,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         if row is None:
             try:
                 current_row = self.ui.geo_tools_table.currentRow()
-            except:
+            except Exception as e:
                 current_row = 0
         else:
             current_row = row
@@ -3889,7 +3884,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                 ))
                 return
 
-
         row = self.ui.geo_tools_table.currentRow()
         tool_uid = int(self.ui.geo_tools_table.item(row, 5).text())
 
@@ -3916,7 +3910,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                 cb_txt = cw.currentText()
                 if cw_col == 2:
                     tooluid_value['offset'] = cb_txt
-                    if cb_txt == ('Custom'):
+                    if cb_txt == 'Custom':
                         self.ui.tool_offset_entry.show()
                         self.ui.tool_offset_lbl.show()
                     else:
@@ -3962,7 +3956,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         widget_changed = self.sender()
         try:
             widget_idx = self.ui.grid3.indexOf(widget_changed)
-        except:
+        except Exception as e:
             return
 
         # those are the indexes for the V-Tip Dia and V-Tip Angle, if edited calculate the new Cut Z
@@ -3997,8 +3991,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         except ValueError:
             # try to convert comma to decimal point. if it's still not working error message and return
             try:
-                offset_value_item = float(self.ui.tool_offset_entry.get_value().replace(',', '.')
-                                     )
+                offset_value_item = float(self.ui.tool_offset_entry.get_value().replace(',', '.'))
             except ValueError:
                 self.app.inform.emit(_(
                     "[ERROR_NOTCL] Wrong value format entered, "
@@ -4090,7 +4083,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                 for tool in self.tools:
                     multigeo_solid_geometry += self.tools[tool]['solid_geometry']
             else:
-                    multigeo_solid_geometry = self.solid_geometry
+                multigeo_solid_geometry = self.solid_geometry
 
             for geo in multigeo_solid_geometry:
                 if type(geo) == list:
@@ -4130,7 +4123,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                         txt = self.ui.geo_tools_table.item(x.row(), column).text()
                     except AttributeError:
                         txt = self.ui.geo_tools_table.cellWidget(x.row(), column).currentText()
-                    except:
+                    except Exception as e:
                         pass
                     r.append(txt)
                 table_tools_items.append(r)
@@ -4365,7 +4358,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                                 endz = data_value
 
                             if data_key == "toolchangez":
-                                toolchangez =data_value
+                                toolchangez = data_value
                             if data_key == "toolchangexy":
                                 toolchangexy = data_value
                             if data_key == "toolchange":
@@ -4398,13 +4391,13 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                             diadict_key: datadict
                         })
 
-                if dia_cnc_dict['offset'] == ('in'):
+                if dia_cnc_dict['offset'] == 'in':
                     tool_offset = -dia_cnc_dict['tooldia'] / 2
                     offset_str = 'inside'
-                elif dia_cnc_dict['offset'].lower() == ('out'):
-                    tool_offset = dia_cnc_dict['tooldia']  / 2
+                elif dia_cnc_dict['offset'].lower() == 'out':
+                    tool_offset = dia_cnc_dict['tooldia'] / 2
                     offset_str = 'outside'
-                elif dia_cnc_dict['offset'].lower() == ('path'):
+                elif dia_cnc_dict['offset'].lower() == 'path':
                     offset_str = 'onpath'
                     tool_offset = 0.0
                 else:
@@ -4414,8 +4407,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                     except ValueError:
                         # try to convert comma to decimal point. if it's still not working error message and return
                         try:
-                            offset_value = float(self.ui.tool_offset_entry.get_value().replace(',', '.')
-                                                 )
+                            offset_value = float(self.ui.tool_offset_entry.get_value().replace(',', '.'))
                         except ValueError:
                             self.app.inform.emit(_(
                                 "[ERROR_NOTCL] Wrong value format entered, "
@@ -4590,7 +4582,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
 
                     if diadict_key == 'data':
                         for data_key, data_value in diadict_value.items():
-                            if data_key ==  "multidepth":
+                            if data_key == "multidepth":
                                 multidepth = data_value
                             if data_key == "depthperpass":
                                 depthpercut = data_value
@@ -4603,7 +4595,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                                 endz = data_value
 
                             if data_key == "toolchangez":
-                                toolchangez =data_value
+                                toolchangez = data_value
                             if data_key == "toolchangexy":
                                 toolchangexy = data_value
                             if data_key == "toolchange":
@@ -4636,13 +4628,13 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                             diadict_key: datadict
                         })
 
-                if dia_cnc_dict['offset'] == ('in'):
+                if dia_cnc_dict['offset'] == 'in':
                     tool_offset = -dia_cnc_dict['tooldia'] / 2
                     offset_str = 'inside'
-                elif dia_cnc_dict['offset'].lower() == ('out'):
-                    tool_offset = dia_cnc_dict['tooldia']  / 2
+                elif dia_cnc_dict['offset'].lower() == 'out':
+                    tool_offset = dia_cnc_dict['tooldia'] / 2
                     offset_str = 'outside'
-                elif dia_cnc_dict['offset'].lower() == ('path'):
+                elif dia_cnc_dict['offset'].lower() == 'path':
                     offset_str = 'onpath'
                     tool_offset = 0.0
                 else:
@@ -4652,23 +4644,17 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                     except ValueError:
                         # try to convert comma to decimal point. if it's still not working error message and return
                         try:
-                            offset_value = float(self.ui.tool_offset_entry.get_value().replace(',', '.')
-                                                  )
+                            offset_value = float(self.ui.tool_offset_entry.get_value().replace(',', '.'))
                         except ValueError:
-                            self.app.inform.emit(_(
-                                "[ERROR_NOTCL] Wrong value format entered, "
-                                "use a number."
-                            ))
+                            self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
+                                                   "use a number."))
                             return
                     if offset_value:
                         tool_offset = float(offset_value)
                     else:
-                        self.app.inform.emit(
-                            _(
-                                "[WARNING] Tool Offset is selected in Tool Table but no value is provided.\n"
-                                "Add a Tool Offset or change the Offset Type."
-                            )
-                        )
+                        self.app.inform.emit(_(
+                            "[WARNING] Tool Offset is selected in Tool Table but no value is provided.\n"
+                            "Add a Tool Offset or change the Offset Type."))
                         return
                 dia_cnc_dict.update({
                     'offset_value': tool_offset
@@ -4913,7 +4899,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
 
         try:
             xfactor = float(xfactor)
-        except:
+        except Exception as e:
             self.app.inform.emit(_(
                 "[ERROR_NOTCL] Scale factor has to be a number: integer or float."))
             return
@@ -4923,10 +4909,8 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         else:
             try:
                 yfactor = float(yfactor)
-            except:
-                self.app.inform.emit(_(
-                    "[ERROR_NOTCL] Scale factor has to be a number: integer or float."
-                ))
+            except Exception as e:
+                self.app.inform.emit(_("[ERROR_NOTCL] Scale factor has to be a number: integer or float."))
                 return
 
         if point is None:
@@ -4948,19 +4932,19 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         # self.app.inform.emit("[success] Geometry Scale done.")
 
         def scale_recursion(geom):
-            if type(geom) == list:
-                geoms=list()
+            if type(geom) is list:
+                geoms = list()
                 for local_geom in geom:
                     geoms.append(scale_recursion(local_geom))
                 return geoms
             else:
-                return  affinity.scale(geom, xfactor, yfactor, origin=(px, py))
+                return affinity.scale(geom, xfactor, yfactor, origin=(px, py))
 
         if self.multigeo is True:
             for tool in self.tools:
                 self.tools[tool]['solid_geometry'] = scale_recursion(self.tools[tool]['solid_geometry'])
         else:
-            self.solid_geometry=scale_recursion(self.solid_geometry)
+            self.solid_geometry = scale_recursion(self.solid_geometry)
 
         self.app.inform.emit(_(
             "[success] Geometry Scale done."
@@ -4986,22 +4970,20 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
             return
 
         def translate_recursion(geom):
-            if type(geom) == list:
-                geoms=list()
+            if type(geom) is list:
+                geoms = list()
                 for local_geom in geom:
                     geoms.append(translate_recursion(local_geom))
                 return geoms
             else:
-                return  affinity.translate(geom, xoff=dx, yoff=dy)
+                return affinity.translate(geom, xoff=dx, yoff=dy)
 
         if self.multigeo is True:
             for tool in self.tools:
                 self.tools[tool]['solid_geometry'] = translate_recursion(self.tools[tool]['solid_geometry'])
         else:
-            self.solid_geometry=translate_recursion(self.solid_geometry)
-        self.app.inform.emit(_(
-            "[success] Geometry Offset done."
-        ))
+            self.solid_geometry = translate_recursion(self.solid_geometry)
+        self.app.inform.emit(_("[success] Geometry Offset done."))
 
     def convert_units(self, units):
         self.ui_disconnect()
@@ -5065,8 +5047,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                         except ValueError:
                             # try to convert comma to decimal point. if it's still not working error message and return
                             try:
-                                custom_offset = float(self.ui.tool_offset_entry.get_value().replace(',', '.')
-                                )
+                                custom_offset = float(self.ui.tool_offset_entry.get_value().replace(',', '.'))
                             except ValueError:
                                 self.app.inform.emit(_(
                                     "[ERROR_NOTCL] Wrong value format entered, "
@@ -5147,7 +5128,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         try:
             # plot solid geometries found as members of self.tools attribute dict
             # for MultiGeo
-            if self.multigeo == True: # geo multi tool usage
+            if self.multigeo is True:  # geo multi tool usage
                 for tooluid_key in self.tools:
                     solid_geometry = self.tools[tooluid_key]['solid_geometry']
                     self.plot_element(solid_geometry, visible=visible)
@@ -5181,9 +5162,9 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
     def on_plot_cb_click_table(self):
         # self.ui.cnc_tools_table.cellWidget(row, 2).widget().setCheckState(QtCore.Qt.Unchecked)
         self.ui_disconnect()
-        cw = self.sender()
-        cw_index = self.ui.geo_tools_table.indexAt(cw.pos())
-        cw_row = cw_index.row()
+        # cw = self.sender()
+        # cw_index = self.ui.geo_tools_table.indexAt(cw.pos())
+        # cw_row = cw_index.row()
         check_row = 0
 
         self.shapes.clear(update=True)
@@ -5259,7 +5240,8 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
                            'tool_type': 'C1',
                            'data': {} # a dict to hold the parameters
                            'gcode': "" # a string with the actual GCODE
-                           'gcode_parsed': {} # dictionary holding the CNCJob geometry and type of geometry (cut or move)
+                           'gcode_parsed': {} # dictionary holding the CNCJob geometry and type of geometry 
+                           (cut or move)
                            'solid_geometry': []
                            },
                            ...
@@ -5521,7 +5503,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
             self.ui.cnc_tools_table.cellWidget(row, 6).clicked.disconnect(self.on_plot_cb_click_table)
         try:
             self.ui.plot_cb.stateChanged.disconnect(self.on_plot_cb_click)
-        except:
+        except Exception as e:
             pass
 
     def on_updateplot_button_click(self, *args):
@@ -5733,13 +5715,13 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
                 if self.cnc_tools[key]['data']['ppname_g'] == 'hpgl':
                     hpgl = True
                     break
-        except:
+        except Exception as e:
             try:
                 for key in self.cnc_tools:
                     if self.cnc_tools[key]['data']['ppname_e'] == 'Roland_MDX_20':
                         roland = True
                         break
-            except:
+            except Exception as e:
                 pass
 
         # do not add gcode_header when using the Roland postprocessor, add it for every other postprocessor
@@ -5848,7 +5830,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
                     ))
 
     def get_gcode(self, preamble='', postamble=''):
-        #we need this to be able get_gcode separatelly for shell command export_gcode
+        # we need this to be able get_gcode separatelly for shell command export_gcode
         return preamble + '\n' + self.gcode + "\n" + postamble
 
     def get_svg(self):
@@ -5875,9 +5857,9 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
     def on_plot_cb_click_table(self):
         # self.ui.cnc_tools_table.cellWidget(row, 2).widget().setCheckState(QtCore.Qt.Unchecked)
         self.ui_disconnect()
-        cw = self.sender()
-        cw_index = self.ui.cnc_tools_table.indexAt(cw.pos())
-        cw_row = cw_index.row()
+        # cw = self.sender()
+        # cw_index = self.ui.cnc_tools_table.indexAt(cw.pos())
+        # cw_row = cw_index.row()
 
         kind = self.ui.cncplot_method_combo.get_value()
 
@@ -5920,7 +5902,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
         visible = visible if visible else self.options['plot']
 
         try:
-            if self.multitool is False: # single tool usage
+            if self.multitool is False:  # single tool usage
                 self.plot2(tooldia=float(self.options["tooldia"]), obj=self, visible=visible, kind=kind)
             else:
                 # multiple tools usage

+ 3 - 0
FlatCAMPool.py

@@ -2,16 +2,19 @@ from PyQt5 import QtCore
 from multiprocessing import Pool
 import dill
 
+
 def run_dill_encoded(what):
     fun, args = dill.loads(what)
     print("load", fun, args)
     return fun(*args)
 
+
 def apply_async(pool, fun, args):
     print("...", fun, args)
     print("dumps", dill.dumps((fun, args)))
     return pool.map_async(run_dill_encoded, (dill.dumps((fun, args)),))
 
+
 def func1():
     print("func")
 

+ 14 - 14
FlatCAMPostProc.py

@@ -1,10 +1,10 @@
-# ########################################################## ##
+# ##########################################################
 # FlatCAM: 2D Post-processing for Manufacturing            #
 # http://flatcam.org                                       #
 # File Author: Matthieu Berthomé                           #
 # Date: 5/26/2017                                          #
 # MIT Licence                                              #
-# ########################################################## ##
+# ##########################################################
 
 from importlib.machinery import SourceFileLoader
 import os
@@ -12,19 +12,19 @@ from abc import ABCMeta, abstractmethod
 from datetime import datetime
 import math
 
-#module-root dictionary of postprocessors
+# module-root dictionary of postprocessors
 import FlatCAMApp
 
 postprocessors = {}
 
 
 class ABCPostProcRegister(ABCMeta):
-    #handles postprocessors registration on instantation
+    # handles postprocessors registration on instantation
     def __new__(cls, clsname, bases, attrs):
         newclass = super(ABCPostProcRegister, cls).__new__(cls, clsname, bases, attrs)
         if object not in bases:
             if newclass.__name__ in postprocessors:
-                FlatCAMApp.App.log.warning('Postprocessor %s has been overriden'%(newclass.__name__))
+                FlatCAMApp.App.log.warning('Postprocessor %s has been overriden' % newclass.__name__)
             postprocessors[newclass.__name__] = newclass()  # here is your register function
         return newclass
 
@@ -67,11 +67,11 @@ class FlatCAMPostProc(object, metaclass=ABCPostProcRegister):
         pass
 
     @abstractmethod
-    def spindle_code(self,p):
+    def spindle_code(self, p):
         pass
 
     @abstractmethod
-    def spindle_stop_code(self,p):
+    def spindle_stop_code(self, p):
         pass
 
 
@@ -121,32 +121,32 @@ class FlatCAMPostProc_Tools(object, metaclass=ABCPostProcRegister):
         pass
 
     @abstractmethod
-    def feedrate_z_dispense_code(self,p):
+    def feedrate_z_dispense_code(self, p):
         pass
 
     @abstractmethod
-    def spindle_fwd_code(self,p):
+    def spindle_fwd_code(self, p):
         pass
 
     @abstractmethod
-    def spindle_rev_code(self,p):
+    def spindle_rev_code(self, p):
         pass
 
     @abstractmethod
-    def spindle_off_code(self,p):
+    def spindle_off_code(self, p):
         pass
 
     @abstractmethod
-    def dwell_fwd_code(self,p):
+    def dwell_fwd_code(self, p):
         pass
 
     @abstractmethod
-    def dwell_rev_code(self,p):
+    def dwell_rev_code(self, p):
         pass
 
 
 def load_postprocessors(app):
-    postprocessors_path_search = [os.path.join(app.data_path,'postprocessors','*.py'),
+    postprocessors_path_search = [os.path.join(app.data_path, 'postprocessors', '*.py'),
                                   os.path.join('postprocessors', '*.py')]
     import glob
     for path_search in postprocessors_path_search:

+ 3 - 3
FlatCAMProcess.py

@@ -1,10 +1,10 @@
-# ########################################################## ##
+# ##########################################################
 # FlatCAM: 2D Post-processing for Manufacturing            #
 # http://flatcam.org                                       #
 # Author: Juan Pablo Caram (c)                             #
 # Date: 2/5/2014                                           #
 # MIT Licence                                              #
-# ########################################################## ##
+# ##########################################################
 
 from flatcamGUI.FlatCAMGUI import FlatCAMActivityView
 from PyQt5 import QtCore
@@ -153,4 +153,4 @@ class FCVisibleProcessContainer(QtCore.QObject, FCProcessContainer):
             self.view.set_busy(self.procs[0]().status_msg())
 
         else:
-            self.view.set_busy("%d processes running." % len(self.procs))
+            self.view.set_busy("%d processes running." % len(self.procs))

+ 0 - 1
FlatCAMTool.py

@@ -90,4 +90,3 @@ class FlatCAMTool(QtWidgets.QWidget):
         self.app.ui.tool_scroll_area.widget().setObjectName(self.toolName)
 
         self.show()
-

+ 2 - 4
FlatCAMTranslation.py

@@ -87,8 +87,8 @@ def on_language_apply_click(app, restart=False):
         msgbox.setInformativeText("Are you sure do you want to change the current language to %s?" % name.capitalize())
         msgbox.setWindowTitle("Apply Language ...")
         msgbox.setWindowIcon(QtGui.QIcon('share/language32.png'))
-        bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
-        bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
+        bt_yes = msgbox.addButton('Yes', QtWidgets.QMessageBox.YesRole)
+        bt_no = msgbox.addButton('No', QtWidgets.QMessageBox.NoRole)
 
         msgbox.setDefaultButton(bt_yes)
         msgbox.exec_()
@@ -156,5 +156,3 @@ def restart_program(app):
     app.save_defaults()
     python = sys.executable
     os.execl(python, python, *sys.argv)
-
-

+ 1 - 1
FlatCAMWorker.py

@@ -36,7 +36,7 @@ class Worker(QtCore.QObject):
                 import pydevd
                 pydevd.settrace(suspend=False, trace_only_current_thread=True)
             except ImportError:
-                self.pydevd_failed=True
+                self.pydevd_failed = True
 
     def run(self):
 

+ 1 - 0
README.md

@@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
 
 - PEP8 correction in flatcamTools
 - merged the Brazilian-portuguese language from a pull request made by Carlos Stein
+- more PEP8 corrections
 
 15.07.2019
 

+ 2 - 1
camlib.py

@@ -7691,6 +7691,7 @@ def three_point_circle(p1, p2, p3):
 def distance(pt1, pt2):
     return sqrt((pt1[0] - pt2[0]) ** 2 + (pt1[1] - pt2[1]) ** 2)
 
+
 def distance_euclidian(x1, y1, x2, y2):
     return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
 
@@ -7792,7 +7793,7 @@ class FlatCAMRTreeStorage(FlatCAMRTree):
         # super(FlatCAMRTreeStorage, self).insert(idx, obj)
         super().insert(idx, obj)
 
-    #@profile
+    # @profile
     def remove(self, obj):
         # See note about self.indexes in insert().
         # objidx = self.indexes[obj]