diff --git a/README.md b/README.md
index aa7353ae..784c6c6f 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
=================================================
+15.07.2019
+
+- some PEP8 corrections
+
13.07.2019
- fixed a possible issue in Gerber Object class
diff --git a/flatcamTools/ToolCalculators.py b/flatcamTools/ToolCalculators.py
index 0b2b87a8..047b3113 100644
--- a/flatcamTools/ToolCalculators.py
+++ b/flatcamTools/ToolCalculators.py
@@ -42,9 +42,9 @@ class ToolCalculator(FlatCAMTool):
""")
self.layout.addWidget(title_label)
- #################### ##
- # ## Units Calculator # ##
- #################### ##
+ # #####################
+ # ## Units Calculator #
+ # #####################
self.unists_spacer_label = QtWidgets.QLabel(" ")
self.layout.addWidget(self.unists_spacer_label)
@@ -53,14 +53,14 @@ class ToolCalculator(FlatCAMTool):
units_label = QtWidgets.QLabel("%s" % self.unitsName)
self.layout.addWidget(units_label)
- #Grid Layout
+ # Grid Layout
grid_units_layout = QtWidgets.QGridLayout()
self.layout.addLayout(grid_units_layout)
inch_label = QtWidgets.QLabel("INCH")
mm_label = QtWidgets.QLabel("MM")
grid_units_layout.addWidget(mm_label, 0, 0)
- grid_units_layout.addWidget( inch_label, 0, 1)
+ grid_units_layout.addWidget(inch_label, 0, 1)
self.inch_entry = FCEntry()
# self.inch_entry.setFixedWidth(70)
@@ -75,11 +75,9 @@ class ToolCalculator(FlatCAMTool):
grid_units_layout.addWidget(self.mm_entry, 1, 0)
grid_units_layout.addWidget(self.inch_entry, 1, 1)
-
- ########################## ##
- # ## V-shape Tool Calculator # ##
- ########################## ##
-
+ # ##############################
+ # ## V-shape Tool Calculator ###
+ # ##############################
self.v_shape_spacer_label = QtWidgets.QLabel(" ")
self.layout.addWidget(self.v_shape_spacer_label)
@@ -96,32 +94,31 @@ class ToolCalculator(FlatCAMTool):
# self.tipDia_entry.setFixedWidth(70)
self.tipDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.tipDia_label.setToolTip(_('This is the diameter of the tool tip.\n'
- 'The manufacturer specifies it.'))
+ 'The manufacturer specifies it.'))
self.tipAngle_label = QtWidgets.QLabel(_("Tip Angle:"))
self.tipAngle_entry = FCEntry()
# self.tipAngle_entry.setFixedWidth(70)
self.tipAngle_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.tipAngle_label.setToolTip(_("This is the angle of the tip of the tool.\n"
- "It is specified by manufacturer."))
+ "It is specified by manufacturer."))
self.cutDepth_label = QtWidgets.QLabel(_("Cut Z:"))
self.cutDepth_entry = FCEntry()
# self.cutDepth_entry.setFixedWidth(70)
self.cutDepth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.cutDepth_label.setToolTip(_("This is the depth to cut into the material.\n"
- "In the CNCJob is the CutZ parameter."))
+ "In the CNCJob is the CutZ parameter."))
self.effectiveToolDia_label = QtWidgets.QLabel(_("Tool Diameter:"))
self.effectiveToolDia_entry = FCEntry()
# self.effectiveToolDia_entry.setFixedWidth(70)
self.effectiveToolDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.effectiveToolDia_label.setToolTip(_("This is the tool diameter to be entered into\n"
- "FlatCAM Gerber section.\n"
- "In the CNCJob section it is called >Tool dia<."))
+ "FlatCAM Gerber section.\n"
+ "In the CNCJob section it is called >Tool dia<."))
# self.effectiveToolDia_entry.setEnabled(False)
-
form_layout.addRow(self.tipDia_label, self.tipDia_entry)
form_layout.addRow(self.tipAngle_label, self.tipAngle_entry)
form_layout.addRow(self.cutDepth_label, self.cutDepth_entry)
@@ -132,16 +129,15 @@ class ToolCalculator(FlatCAMTool):
# self.calculate_button.setFixedWidth(70)
self.calculate_vshape_button.setToolTip(
_("Calculate either the Cut Z or the effective tool diameter,\n "
- "depending on which is desired and which is known. ")
+ "depending on which is desired and which is known. ")
)
self.empty_label = QtWidgets.QLabel(" ")
form_layout.addRow(self.empty_label, self.calculate_vshape_button)
-
- ################################## ##
- # ## ElectroPlating Tool Calculator # ##
- ################################## ##
+ # ####################################
+ # ## ElectroPlating Tool Calculator ##
+ # ####################################
self.plate_spacer_label = QtWidgets.QLabel(" ")
self.layout.addWidget(self.plate_spacer_label)
@@ -150,7 +146,7 @@ class ToolCalculator(FlatCAMTool):
plate_title_label = QtWidgets.QLabel("%s" % self.eplateName)
plate_title_label.setToolTip(
_("This calculator is useful for those who plate the via/pad/drill holes,\n"
- "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.")
+ "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.")
)
self.layout.addWidget(plate_title_label)
@@ -175,15 +171,14 @@ class ToolCalculator(FlatCAMTool):
# self.cdensity_entry.setFixedWidth(70)
self.cdensity_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
- "In Amps per Square Feet ASF."))
-
+ "In Amps per Square Feet ASF."))
self.growth_label = QtWidgets.QLabel(_("Copper Growth:"))
self.growth_entry = FCEntry()
# self.growth_entry.setFixedWidth(70)
self.growth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
- "In microns."))
+ "In microns."))
# self.growth_entry.setEnabled(False)
@@ -192,7 +187,7 @@ class ToolCalculator(FlatCAMTool):
# self.cvaluelabel.setFixedWidth(70)
self.cvalue_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.cvaluelabel.setToolTip(_('This is the current intensity value\n'
- 'to be set on the Power Supply. In Amps.'))
+ 'to be set on the Power Supply. In Amps.'))
self.cvalue_entry.setDisabled(True)
self.timelabel = QtWidgets.QLabel(_("Time:"))
@@ -200,7 +195,7 @@ class ToolCalculator(FlatCAMTool):
# self.timelabel.setFixedWidth(70)
self.time_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.timelabel.setToolTip(_('This is the calculated time required for the procedure.\n'
- 'In minutes.'))
+ 'In minutes.'))
self.time_entry.setDisabled(True)
plate_form_layout.addRow(self.pcblengthlabel, self.pcblength_entry)
@@ -214,8 +209,8 @@ class ToolCalculator(FlatCAMTool):
self.calculate_plate_button = QtWidgets.QPushButton(_("Calculate"))
# self.calculate_button.setFixedWidth(70)
self.calculate_plate_button.setToolTip(
- _("Calculate the current intensity value and the procedure time,\n "
- "depending on the parameters above")
+ _("Calculate the current intensity value and the procedure time,\n"
+ "depending on the parameters above")
)
self.empty_label_2 = QtWidgets.QLabel(" ")
@@ -223,6 +218,8 @@ class ToolCalculator(FlatCAMTool):
self.layout.addStretch()
+ self.units = ''
+
# ## Signals
self.cutDepth_entry.textChanged.connect(self.on_calculate_tool_dia)
self.cutDepth_entry.editingFinished.connect(self.on_calculate_tool_dia)
@@ -305,7 +302,7 @@ class ToolCalculator(FlatCAMTool):
tip_diameter = float(self.tipDia_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
try:
@@ -316,7 +313,7 @@ class ToolCalculator(FlatCAMTool):
half_tip_angle = float(self.tipAngle_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
half_tip_angle /= 2
@@ -328,7 +325,7 @@ class ToolCalculator(FlatCAMTool):
cut_depth = float(self.cutDepth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
tool_diameter = tip_diameter + (2 * cut_depth * math.tan(math.radians(half_tip_angle)))
@@ -343,7 +340,7 @@ class ToolCalculator(FlatCAMTool):
mm_val = float(self.mm_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
self.inch_entry.set_value('%.6f' % (mm_val / 25.4))
@@ -356,7 +353,7 @@ class ToolCalculator(FlatCAMTool):
inch_val = float(self.inch_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
self.mm_entry.set_value('%.6f' % (inch_val * 25.4))
@@ -370,7 +367,7 @@ class ToolCalculator(FlatCAMTool):
length = float(self.pcblength_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
try:
@@ -381,7 +378,7 @@ class ToolCalculator(FlatCAMTool):
width = float(self.pcbwidth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
try:
@@ -392,7 +389,7 @@ class ToolCalculator(FlatCAMTool):
density = float(self.cdensity_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
try:
@@ -403,7 +400,7 @@ class ToolCalculator(FlatCAMTool):
copper = float(self.growth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
calculated_current = (length * width * density) * 0.0021527820833419
@@ -412,4 +409,4 @@ class ToolCalculator(FlatCAMTool):
self.cvalue_entry.set_value('%.2f' % calculated_current)
self.time_entry.set_value('%.1f' % calculated_time)
-# end of file
\ No newline at end of file
+# end of file
diff --git a/flatcamTools/ToolCutOut.py b/flatcamTools/ToolCutOut.py
index 4db51fa7..b014e1bc 100644
--- a/flatcamTools/ToolCutOut.py
+++ b/flatcamTools/ToolCutOut.py
@@ -354,7 +354,7 @@ class CutOut(FlatCAMTool):
dia = float(self.dia.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
- "Add it and retry."))
+ "Add it and retry."))
return
if 0 in {dia}:
@@ -369,7 +369,7 @@ class CutOut(FlatCAMTool):
margin = float(self.margin.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[WARNING_NOTCL] Margin value is missing or wrong format. "
- "Add it and retry."))
+ "Add it and retry."))
return
try:
@@ -380,7 +380,7 @@ class CutOut(FlatCAMTool):
gapsize = float(self.gapsize.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[WARNING_NOTCL] Gap size value is missing or wrong format. "
- "Add it and retry."))
+ "Add it and retry."))
return
try:
@@ -391,7 +391,7 @@ class CutOut(FlatCAMTool):
if gaps not in ['LR', 'TB', '2LR', '2TB', '4', '8']:
self.app.inform.emit(_("[WARNING_NOTCL] Gaps value can be only one of: 'lr', 'tb', '2lr', '2tb', 4 or 8. "
- "Fill in a correct value and retry. "))
+ "Fill in a correct value and retry. "))
return
if cutout_obj.multigeo is True:
@@ -523,7 +523,7 @@ class CutOut(FlatCAMTool):
dia = float(self.dia.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
- "Add it and retry."))
+ "Add it and retry."))
return
if 0 in {dia}:
@@ -538,7 +538,7 @@ class CutOut(FlatCAMTool):
margin = float(self.margin.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[WARNING_NOTCL] Margin value is missing or wrong format. "
- "Add it and retry."))
+ "Add it and retry."))
return
try:
@@ -549,7 +549,7 @@ class CutOut(FlatCAMTool):
gapsize = float(self.gapsize.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[WARNING_NOTCL] Gap size value is missing or wrong format. "
- "Add it and retry."))
+ "Add it and retry."))
return
try:
@@ -560,13 +560,13 @@ class CutOut(FlatCAMTool):
if gaps not in ['LR', 'TB', '2LR', '2TB', '4', '8']:
self.app.inform.emit(_("[WARNING_NOTCL] Gaps value can be only one of: 'lr', 'tb', '2lr', '2tb', 4 or 8. "
- "Fill in a correct value and retry. "))
+ "Fill in a correct value and retry. "))
return
if cutout_obj.multigeo is True:
self.app.inform.emit(_("[ERROR]Cutout operation cannot be done on a multi-geo Geometry.\n"
- "Optionally, this Multi-geo Geometry can be converted to Single-geo Geometry,\n"
- "and after that perform Cutout."))
+ "Optionally, this Multi-geo Geometry can be converted to Single-geo Geometry,\n"
+ "and after that perform Cutout."))
return
# Get min and max data for each object as we just cut rectangles across X or Y
@@ -643,7 +643,6 @@ class CutOut(FlatCAMTool):
geo_obj.solid_geometry = deepcopy(solid_geo)
geo_obj.options['cnctooldia'] = str(dia)
-
outname = cutout_obj.options["name"] + "_cutout"
self.app.new_object('geometry', outname, geo_init)
diff --git a/flatcamTools/ToolDblSided.py b/flatcamTools/ToolDblSided.py
index eb1f698c..804ec491 100644
--- a/flatcamTools/ToolDblSided.py
+++ b/flatcamTools/ToolDblSided.py
@@ -6,9 +6,9 @@ from PyQt5 import QtCore
import gettext
import FlatCAMTranslation as fcTranslate
+import builtins
fcTranslate.apply_language('strings')
-import builtins
if '_' not in builtins.__dict__:
_ = gettext.gettext
@@ -52,8 +52,8 @@ class DblSidedTool(FlatCAMTool):
self.mirror_gerber_button = QtWidgets.QPushButton(_("Mirror"))
self.mirror_gerber_button.setToolTip(
_("Mirrors (flips) the specified object around \n"
- "the specified axis. Does not create a new \n"
- "object, but modifies it.")
+ "the specified axis. Does not create a new \n"
+ "object, but modifies it.")
)
self.mirror_gerber_button.setFixedWidth(60)
@@ -76,8 +76,8 @@ class DblSidedTool(FlatCAMTool):
self.mirror_exc_button = QtWidgets.QPushButton(_("Mirror"))
self.mirror_exc_button.setToolTip(
_("Mirrors (flips) the specified object around \n"
- "the specified axis. Does not create a new \n"
- "object, but modifies it.")
+ "the specified axis. Does not create a new \n"
+ "object, but modifies it.")
)
self.mirror_exc_button.setFixedWidth(60)
@@ -100,8 +100,8 @@ class DblSidedTool(FlatCAMTool):
self.mirror_geo_button = QtWidgets.QPushButton(_("Mirror"))
self.mirror_geo_button.setToolTip(
_("Mirrors (flips) the specified object around \n"
- "the specified axis. Does not create a new \n"
- "object, but modifies it.")
+ "the specified axis. Does not create a new \n"
+ "object, but modifies it.")
)
self.mirror_geo_button.setFixedWidth(60)
@@ -133,8 +133,8 @@ class DblSidedTool(FlatCAMTool):
self.axloc_label = QtWidgets.QLabel(_("Axis Ref:"))
self.axloc_label.setToolTip(
_("The axis should pass through a point or cut\n "
- "a specified box (in a FlatCAM object) through \n"
- "the center.")
+ "a specified box (in a FlatCAM object) through \n"
+ "the center.")
)
# grid_lay.addRow("Axis Location:", self.axis_location)
grid_lay1.addWidget(self.axloc_label, 8, 0)
@@ -152,17 +152,17 @@ class DblSidedTool(FlatCAMTool):
self.pb_label = QtWidgets.QLabel("%s" % _('Point/Box Reference:'))
self.pb_label.setToolTip(
_("If 'Point' is selected above it store the coordinates (x, y) through which\n"
- "the mirroring axis passes.\n"
- "If 'Box' is selected above, select here a FlatCAM object (Gerber, Exc or Geo).\n"
- "Through the center of this object pass the mirroring axis selected above.")
+ "the mirroring axis passes.\n"
+ "If 'Box' is selected above, select here a FlatCAM object (Gerber, Exc or Geo).\n"
+ "Through the center of this object pass the mirroring axis selected above.")
)
self.add_point_button = QtWidgets.QPushButton(_("Add"))
self.add_point_button.setToolTip(
_("Add the coordinates in format (x, y) through which the mirroring axis \n "
- "selected in 'MIRROR AXIS' pass.\n"
- "The (x, y) coordinates are captured by pressing SHIFT key\n"
- "and left mouse button click on canvas or you can enter the coords manually.")
+ "selected in 'MIRROR AXIS' pass.\n"
+ "The (x, y) coordinates are captured by pressing SHIFT key\n"
+ "and left mouse button click on canvas or you can enter the coords manually.")
)
self.add_point_button.setFixedWidth(60)
@@ -188,15 +188,14 @@ class DblSidedTool(FlatCAMTool):
self.box_combo.hide()
self.box_combo_type.hide()
-
# ## Alignment holes
self.ah_label = QtWidgets.QLabel("%s" % _('Alignment Drill Coordinates:'))
self.ah_label.setToolTip(
- _( "Alignment holes (x1, y1), (x2, y2), ... "
- "on one side of the mirror axis. For each set of (x, y) coordinates\n"
- "entered here, a pair of drills will be created:\n\n"
- "- one drill at the coordinates from the field\n"
- "- one drill in mirror position over the axis selected above in the 'Mirror Axis'.")
+ _("Alignment holes (x1, y1), (x2, y2), ... "
+ "on one side of the mirror axis. For each set of (x, y) coordinates\n"
+ "entered here, a pair of drills will be created:\n\n"
+ "- one drill at the coordinates from the field\n"
+ "- one drill in mirror position over the axis selected above in the 'Mirror Axis'.")
)
self.layout.addWidget(self.ah_label)
@@ -208,12 +207,12 @@ class DblSidedTool(FlatCAMTool):
self.add_drill_point_button = QtWidgets.QPushButton(_("Add"))
self.add_drill_point_button.setToolTip(
_("Add alignment drill holes coords in the format: (x1, y1), (x2, y2), ... \n"
- "on one side of the mirror axis.\n\n"
- "The coordinates set can be obtained:\n"
- "- press SHIFT key and left mouse clicking on canvas. Then click Add.\n"
- "- press SHIFT key and left mouse clicking on canvas. Then CTRL+V in the field.\n"
- "- press SHIFT key and left mouse clicking on canvas. Then RMB click in the field and click Paste.\n"
- "- by entering the coords manually in the format: (x1, y1), (x2, y2), ...")
+ "on one side of the mirror axis.\n\n"
+ "The coordinates set can be obtained:\n"
+ "- press SHIFT key and left mouse clicking on canvas. Then click Add.\n"
+ "- press SHIFT key and left mouse clicking on canvas. Then CTRL+V in the field.\n"
+ "- press SHIFT key and left mouse clicking on canvas. Then RMB click in the field and click Paste.\n"
+ "- by entering the coords manually in the format: (x1, y1), (x2, y2), ...")
)
self.add_drill_point_button.setFixedWidth(60)
@@ -224,7 +223,7 @@ class DblSidedTool(FlatCAMTool):
self.dt_label = QtWidgets.QLabel("%s:" % _('Alignment Drill Diameter'))
self.dt_label.setToolTip(
_("Diameter of the drill for the "
- "alignment holes.")
+ "alignment holes.")
)
self.layout.addWidget(self.dt_label)
@@ -235,7 +234,7 @@ class DblSidedTool(FlatCAMTool):
self.dd_label = QtWidgets.QLabel(_("Drill diam.:"))
self.dd_label.setToolTip(
_("Diameter of the drill for the "
- "alignment holes.")
+ "alignment holes.")
)
hlay.addWidget(self.dd_label)
hlay.addWidget(self.drill_dia)
@@ -247,8 +246,8 @@ class DblSidedTool(FlatCAMTool):
self.create_alignment_hole_button = QtWidgets.QPushButton(_("Create Excellon Object"))
self.create_alignment_hole_button.setToolTip(
_("Creates an Excellon Object containing the\n"
- "specified alignment holes and their mirror\n"
- "images.")
+ "specified alignment holes and their mirror\n"
+ "images.")
)
hlay2.addWidget(self.create_alignment_hole_button)
@@ -325,7 +324,7 @@ class DblSidedTool(FlatCAMTool):
px, py = self.point_entry.get_value()
except TypeError:
self.app.inform.emit(_("[WARNING_NOTCL] 'Point' reference is selected and 'Point' coordinates "
- "are missing. Add them and retry."))
+ "are missing. Add them and retry."))
return
else:
selection_index = self.box_combo.currentIndex()
@@ -361,7 +360,7 @@ class DblSidedTool(FlatCAMTool):
self.drill_dia.set_value(dia)
except ValueError:
self.app.inform.emit(_("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
- "Add it and retry."))
+ "Add it and retry."))
return
if dia is '':
@@ -372,7 +371,8 @@ class DblSidedTool(FlatCAMTool):
# holes = self.alignment_holes.get_value()
holes = eval('[{}]'.format(self.alignment_holes.text()))
if not holes:
- self.app.inform.emit(_("[WARNING_NOTCL] There are no Alignment Drill Coordinates to use. Add them and retry."))
+ self.app.inform.emit(_("[WARNING_NOTCL] There are no Alignment Drill Coordinates to use. "
+ "Add them and retry."))
return
drills = []
@@ -418,7 +418,7 @@ class DblSidedTool(FlatCAMTool):
px, py = self.point_entry.get_value()
except TypeError:
self.app.inform.emit(_("[WARNING_NOTCL] 'Point' coordinates missing. "
- "Using Origin (0, 0) as mirroring reference."))
+ "Using Origin (0, 0) as mirroring reference."))
px, py = (0, 0)
else:
@@ -462,7 +462,7 @@ class DblSidedTool(FlatCAMTool):
except Exception as e:
log.debug("DblSidedTool.on_mirror_geo() --> %s" % str(e))
self.app.inform.emit(_("[WARNING_NOTCL] There are no Point coordinates in the Point field. "
- "Add coords and try again ..."))
+ "Add coords and try again ..."))
return
else:
selection_index_box = self.box_combo.currentIndex()
@@ -553,8 +553,4 @@ class DblSidedTool(FlatCAMTool):
self.box_combo.setCurrentIndex(0)
self.box_combo_type.setCurrentIndex(0)
-
self.drill_values = ""
-
-
-
diff --git a/flatcamTools/ToolFilm.py b/flatcamTools/ToolFilm.py
index 400a11dd..41054175 100644
--- a/flatcamTools/ToolFilm.py
+++ b/flatcamTools/ToolFilm.py
@@ -13,9 +13,9 @@ from PyQt5 import QtGui, QtCore, QtWidgets
import gettext
import FlatCAMTranslation as fcTranslate
+import builtins
fcTranslate.apply_language('strings')
-import builtins
if '_' not in builtins.__dict__:
_ = gettext.gettext
@@ -56,9 +56,9 @@ class Film(FlatCAMTool):
self.tf_type_obj_combo_label = QtWidgets.QLabel(_("Object Type:"))
self.tf_type_obj_combo_label.setToolTip(
_("Specify the type of object for which to create the film.\n"
- "The object can be of type: Gerber or Geometry.\n"
- "The selection here decide the type of objects that will be\n"
- "in the Film Object combobox.")
+ "The object can be of type: Gerber or Geometry.\n"
+ "The selection here decide the type of objects that will be\n"
+ "in the Film Object combobox.")
)
tf_form_layout.addRow(self.tf_type_obj_combo_label, self.tf_type_obj_combo)
@@ -89,9 +89,9 @@ class Film(FlatCAMTool):
self.tf_type_box_combo_label = QtWidgets.QLabel(_("Box Type:"))
self.tf_type_box_combo_label.setToolTip(
_("Specify the type of object to be used as an container for\n"
- "film creation. It can be: Gerber or Geometry type."
- "The selection here decide the type of objects that will be\n"
- "in the Box Object combobox.")
+ "film creation. It can be: Gerber or Geometry type."
+ "The selection here decide the type of objects that will be\n"
+ "in the Box Object combobox.")
)
tf_form_layout.addRow(self.tf_type_box_combo_label, self.tf_type_box_combo)
@@ -104,23 +104,23 @@ class Film(FlatCAMTool):
self.tf_box_combo_label = QtWidgets.QLabel(_("Box Object:"))
self.tf_box_combo_label.setToolTip(
_("The actual object that is used a container for the\n "
- "selected object for which we create the film.\n"
- "Usually it is the PCB outline but it can be also the\n"
- "same object for which the film is created.")
+ "selected object for which we create the film.\n"
+ "Usually it is the PCB outline but it can be also the\n"
+ "same object for which the film is created.")
)
tf_form_layout.addRow(self.tf_box_combo_label, self.tf_box_combo)
# Film Type
self.film_type = RadioSet([{'label': 'Positive', 'value': 'pos'},
- {'label': 'Negative', 'value': 'neg'}])
+ {'label': 'Negative', 'value': 'neg'}])
self.film_type_label = QtWidgets.QLabel(_("Film Type:"))
self.film_type_label.setToolTip(
_("Generate a Positive black film or a Negative film.\n"
- "Positive means that it will print the features\n"
- "with black on a white canvas.\n"
- "Negative means that it will print the features\n"
- "with white on a black canvas.\n"
- "The Film format is SVG.")
+ "Positive means that it will print the features\n"
+ "with black on a white canvas.\n"
+ "Negative means that it will print the features\n"
+ "with white on a black canvas.\n"
+ "The Film format is SVG.")
)
tf_form_layout.addRow(self.film_type_label, self.film_type)
@@ -130,13 +130,13 @@ class Film(FlatCAMTool):
self.boundary_label = QtWidgets.QLabel(_("Border:"))
self.boundary_label.setToolTip(
_("Specify a border around the object.\n"
- "Only for negative film.\n"
- "It helps if we use as a Box Object the same \n"
- "object as in Film Object. It will create a thick\n"
- "black bar around the actual print allowing for a\n"
- "better delimitation of the outline features which are of\n"
- "white color like the rest and which may confound with the\n"
- "surroundings if not for this border.")
+ "Only for negative film.\n"
+ "It helps if we use as a Box Object the same \n"
+ "object as in Film Object. It will create a thick\n"
+ "black bar around the actual print allowing for a\n"
+ "better delimitation of the outline features which are of\n"
+ "white color like the rest and which may confound with the\n"
+ "surroundings if not for this border.")
)
tf_form_layout.addRow(self.boundary_label, self.boundary_entry)
@@ -144,8 +144,8 @@ class Film(FlatCAMTool):
self.film_scale_label = QtWidgets.QLabel(_("Scale Stroke:"))
self.film_scale_label.setToolTip(
_("Scale the line stroke thickness of each feature in the SVG file.\n"
- "It means that the line that envelope each SVG feature will be thicker or thinner,\n"
- "therefore the fine features may be more affected by this parameter.")
+ "It means that the line that envelope each SVG feature will be thicker or thinner,\n"
+ "therefore the fine features may be more affected by this parameter.")
)
tf_form_layout.addRow(self.film_scale_label, self.film_scale_entry)
@@ -157,9 +157,9 @@ class Film(FlatCAMTool):
self.film_object_button = QtWidgets.QPushButton(_("Save Film"))
self.film_object_button.setToolTip(
_("Create a Film for the selected object, within\n"
- "the specified box. Does not create a new \n "
- "FlatCAM object, but directly save it in SVG format\n"
- "which can be opened with Inkscape.")
+ "the specified box. Does not create a new \n "
+ "FlatCAM object, but directly save it in SVG format\n"
+ "which can be opened with Inkscape.")
)
hlay.addWidget(self.film_object_button)
@@ -221,13 +221,13 @@ class Film(FlatCAMTool):
def on_film_creation(self):
try:
name = self.tf_object_combo.currentText()
- except:
+ except Exception as e:
self.app.inform.emit(_("[ERROR_NOTCL] No FlatCAM object selected. Load an object for Film and retry."))
return
try:
boxname = self.tf_box_combo.currentText()
- except:
+ except Exception as e:
self.app.inform.emit(_("[ERROR_NOTCL] No FlatCAM object selected. Load an object for Box and retry."))
return
diff --git a/flatcamTools/ToolImage.py b/flatcamTools/ToolImage.py
index a88b82e3..0d6061ae 100644
--- a/flatcamTools/ToolImage.py
+++ b/flatcamTools/ToolImage.py
@@ -13,9 +13,9 @@ from PyQt5 import QtGui, QtWidgets
import gettext
import FlatCAMTranslation as fcTranslate
+import builtins
fcTranslate.apply_language('strings')
-import builtins
if '_' not in builtins.__dict__:
_ = gettext.gettext
@@ -52,8 +52,8 @@ class ToolImage(FlatCAMTool):
self.tf_type_obj_combo_label = QtWidgets.QLabel(_("Object Type:"))
self.tf_type_obj_combo_label.setToolTip(
- _( "Specify the type of object to create from the image.\n"
- "It can be of type: Gerber or Geometry.")
+ _("Specify the type of object to create from the image.\n"
+ "It can be of type: Gerber or Geometry.")
)
ti_form_layout.addRow(self.tf_type_obj_combo_label, self.tf_type_obj_combo)
@@ -62,7 +62,7 @@ class ToolImage(FlatCAMTool):
self.dpi_entry = IntEntry()
self.dpi_label = QtWidgets.QLabel(_("DPI value:"))
self.dpi_label.setToolTip(
- _( "Specify a DPI value for the image.")
+ _("Specify a DPI value for the image.")
)
ti_form_layout.addRow(self.dpi_label, self.dpi_entry)
@@ -77,11 +77,11 @@ class ToolImage(FlatCAMTool):
# Type of image interpretation
self.image_type = RadioSet([{'label': 'B/W', 'value': 'black'},
- {'label': 'Color', 'value': 'color'}])
+ {'label': 'Color', 'value': 'color'}])
self.image_type_label = QtWidgets.QLabel("%s:" % _('Image type'))
self.image_type_label.setToolTip(
_("Choose a method for the image interpretation.\n"
- "B/W means a black & white image. Color means a colored image.")
+ "B/W means a black & white image. Color means a colored image.")
)
ti2_form_layout.addRow(self.image_type_label, self.image_type)
@@ -90,11 +90,11 @@ class ToolImage(FlatCAMTool):
self.mask_bw_label = QtWidgets.QLabel("%s B/W:" % _('Mask value'))
self.mask_bw_label.setToolTip(
_("Mask for monochrome image.\n"
- "Takes values between [0 ... 255].\n"
- "Decides the level of details to include\n"
- "in the resulting geometry.\n"
- "0 means no detail and 255 means everything \n"
- "(which is totally black).")
+ "Takes values between [0 ... 255].\n"
+ "Decides the level of details to include\n"
+ "in the resulting geometry.\n"
+ "0 means no detail and 255 means everything \n"
+ "(which is totally black).")
)
ti2_form_layout.addRow(self.mask_bw_label, self.mask_bw_entry)
@@ -103,9 +103,9 @@ class ToolImage(FlatCAMTool):
self.mask_r_label = QtWidgets.QLabel("%s R:" % _('Mask value'))
self.mask_r_label.setToolTip(
_("Mask for RED color.\n"
- "Takes values between [0 ... 255].\n"
- "Decides the level of details to include\n"
- "in the resulting geometry.")
+ "Takes values between [0 ... 255].\n"
+ "Decides the level of details to include\n"
+ "in the resulting geometry.")
)
ti2_form_layout.addRow(self.mask_r_label, self.mask_r_entry)
@@ -114,9 +114,9 @@ class ToolImage(FlatCAMTool):
self.mask_g_label = QtWidgets.QLabel("%s G:" % _('Mask value'))
self.mask_g_label.setToolTip(
_("Mask for GREEN color.\n"
- "Takes values between [0 ... 255].\n"
- "Decides the level of details to include\n"
- "in the resulting geometry.")
+ "Takes values between [0 ... 255].\n"
+ "Decides the level of details to include\n"
+ "in the resulting geometry.")
)
ti2_form_layout.addRow(self.mask_g_label, self.mask_g_entry)
@@ -125,9 +125,9 @@ class ToolImage(FlatCAMTool):
self.mask_b_label = QtWidgets.QLabel("%s B:" % _('Mask value'))
self.mask_b_label.setToolTip(
_("Mask for BLUE color.\n"
- "Takes values between [0 ... 255].\n"
- "Decides the level of details to include\n"
- "in the resulting geometry.")
+ "Takes values between [0 ... 255].\n"
+ "Decides the level of details to include\n"
+ "in the resulting geometry.")
)
ti2_form_layout.addRow(self.mask_b_label, self.mask_b_entry)
@@ -191,27 +191,27 @@ class ToolImage(FlatCAMTool):
mask = []
self.app.log.debug("on_file_importimage()")
- filter = "Image Files(*.BMP *.PNG *.JPG *.JPEG);;" \
- "Bitmap File (*.BMP);;" \
- "PNG File (*.PNG);;" \
- "Jpeg File (*.JPG);;" \
- "All Files (*.*)"
+ _filter = "Image Files(*.BMP *.PNG *.JPG *.JPEG);;" \
+ "Bitmap File (*.BMP);;" \
+ "PNG File (*.PNG);;" \
+ "Jpeg File (*.JPG);;" \
+ "All Files (*.*)"
try:
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Import IMAGE"),
- directory=self.app.get_last_folder(), filter=filter)
+ directory=self.app.get_last_folder(), filter=_filter)
except TypeError:
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Import IMAGE"), filter=filter)
filename = str(filename)
- type = self.tf_type_obj_combo.get_value().lower()
+ type_obj = self.tf_type_obj_combo.get_value().lower()
dpi = self.dpi_entry.get_value()
mode = self.image_type.get_value()
- mask = [self.mask_bw_entry.get_value(), self.mask_r_entry.get_value(),self.mask_g_entry.get_value(),
+ mask = [self.mask_bw_entry.get_value(), self.mask_r_entry.get_value(), self.mask_g_entry.get_value(),
self.mask_b_entry.get_value()]
if filename == "":
self.app.inform.emit(_("Open cancelled."))
else:
self.app.worker_task.emit({'fcn': self.app.import_image,
- 'params': [filename, type, dpi, mode, mask]})
+ 'params': [filename, type_obj, dpi, mode, mask]})
# self.import_svg(filename, "geometry")
diff --git a/flatcamTools/ToolMeasurement.py b/flatcamTools/ToolMeasurement.py
index 39a4723e..524a9f9f 100644
--- a/flatcamTools/ToolMeasurement.py
+++ b/flatcamTools/ToolMeasurement.py
@@ -14,9 +14,9 @@ from math import sqrt
import gettext
import FlatCAMTranslation as fcTranslate
+import builtins
fcTranslate.apply_language('strings')
-import builtins
if '_' not in builtins.__dict__:
_ = gettext.gettext
@@ -40,7 +40,6 @@ class Measurement(FlatCAMTool):
form_layout = QtWidgets.QFormLayout()
self.layout.addLayout(form_layout)
-
self.units_label = QtWidgets.QLabel(_("Units:"))
self.units_label.setToolTip(_("Those are the units in which the distance is measured."))
self.units_value = QtWidgets.QLabel("%s" % str({'mm': "METRIC (mm)", 'in': "INCH (in)"}[self.units]))
@@ -73,12 +72,10 @@ class Measurement(FlatCAMTool):
self.distance_x_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.distance_x_entry.setToolTip(_("This is the distance measured over the X axis."))
-
self.distance_y_entry = FCEntry()
self.distance_y_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.distance_y_entry.setToolTip(_("This is the distance measured over the Y axis."))
-
self.total_distance_entry = FCEntry()
self.total_distance_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.total_distance_entry.setToolTip(_("This is the point to point Euclidian distance."))
@@ -110,6 +107,8 @@ class Measurement(FlatCAMTool):
self.rel_point2 = None
self.active = False
+ self.clicked_meas = None
+ self.meas_line = None
self.original_call_source = 'app'
@@ -312,7 +311,7 @@ class Measurement(FlatCAMTool):
# update utility geometry
if len(self.points) == 1:
self.utility_geometry(pos=pos)
- except:
+ except Exception as e:
self.app.ui.position_label.setText("")
self.app.ui.rel_position_label.setText("")
diff --git a/flatcamTools/ToolMove.py b/flatcamTools/ToolMove.py
index 6c49afcd..a9957392 100644
--- a/flatcamTools/ToolMove.py
+++ b/flatcamTools/ToolMove.py
@@ -14,9 +14,9 @@ from copy import copy
import gettext
import FlatCAMTranslation as fcTranslate
+import builtins
fcTranslate.apply_language('strings')
-import builtins
if '_' not in builtins.__dict__:
_ = gettext.gettext
@@ -97,7 +97,7 @@ class ToolMove(FlatCAMTool):
pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
# if GRID is active we need to get the snapped positions
- if self.app.grid_status() == True:
+ if self.app.grid_status() is True:
pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
else:
pos = pos_canvas
@@ -117,7 +117,7 @@ class ToolMove(FlatCAMTool):
self.delete_shape()
# if GRID is active we need to get the snapped positions
- if self.app.grid_status() == True:
+ if self.app.grid_status() is True:
pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
else:
pos = pos_canvas
@@ -143,11 +143,11 @@ class ToolMove(FlatCAMTool):
try:
sel_obj.replotApertures.emit()
- except:
+ except Exception as e:
pass
# Update the object bounding box options
- a,b,c,d = sel_obj.bounds()
+ a, b, c, d = sel_obj.bounds()
sel_obj.options['xmin'] = a
sel_obj.options['ymin'] = b
sel_obj.options['xmax'] = c
@@ -181,7 +181,7 @@ class ToolMove(FlatCAMTool):
pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
# if GRID is active we need to get the snapped positions
- if self.app.grid_status() == True:
+ if self.app.grid_status() is True:
pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
else:
pos = pos_canvas
diff --git a/flatcamTools/ToolNonCopperClear.py b/flatcamTools/ToolNonCopperClear.py
index 24734e4a..8d6a3e9e 100644
--- a/flatcamTools/ToolNonCopperClear.py
+++ b/flatcamTools/ToolNonCopperClear.py
@@ -7,16 +7,16 @@
# ########################################################## ##
from FlatCAMTool import FlatCAMTool
-from copy import copy,deepcopy
+from copy import copy, deepcopy
from ObjectCollection import *
import time
import gettext
import FlatCAMTranslation as fcTranslate
from shapely.geometry import base
+import builtins
fcTranslate.apply_language('strings')
-import builtins
if '_' not in builtins.__dict__:
_ = gettext.gettext
@@ -72,7 +72,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.tools_table_label = QtWidgets.QLabel('%s' % _('Tools Table'))
self.tools_table_label.setToolTip(
_("Tools pool from which the algorithm\n"
- "will pick the ones used for copper clearing.")
+ "will pick the ones used for copper clearing.")
)
self.tools_box.addWidget(self.tools_table_label)
@@ -87,33 +87,33 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.tools_table.horizontalHeaderItem(0).setToolTip(
_("This is the Tool Number.\n"
- "Non copper clearing will start with the tool with the biggest \n"
- "diameter, continuing until there are no more tools.\n"
- "Only tools that create NCC clearing geometry will still be present\n"
- "in the resulting geometry. This is because with some tools\n"
- "this function will not be able to create painting geometry.")
+ "Non copper clearing will start with the tool with the biggest \n"
+ "diameter, continuing until there are no more tools.\n"
+ "Only tools that create NCC clearing geometry will still be present\n"
+ "in the resulting geometry. This is because with some tools\n"
+ "this function will not be able to create painting geometry.")
)
self.tools_table.horizontalHeaderItem(1).setToolTip(
_("Tool Diameter. It's value (in current FlatCAM units) \n"
- "is the cut width into the material."))
+ "is the cut width into the material."))
self.tools_table.horizontalHeaderItem(2).setToolTip(
_("The Tool Type (TT) can be:
"
- "- Circular with 1 ... 4 teeth -> it is informative only. Being circular,
"
- "the cut width in material is exactly the tool diameter.
"
- "- Ball -> informative only and make reference to the Ball type endmill.
"
- "- V-Shape -> it will disable de Z-Cut parameter in the resulting geometry UI form "
- "and enable two additional UI form fields in the resulting geometry: V-Tip Dia and "
- "V-Tip Angle. Adjusting those two values will adjust the Z-Cut parameter such "
- "as the cut width into material will be equal with the value in the Tool Diameter "
- "column of this table.
"
- "Choosing the V-Shape Tool Type automatically will select the Operation Type "
- "in the resulting geometry as Isolation."))
+ "- Circular with 1 ... 4 teeth -> it is informative only. Being circular,
"
+ "the cut width in material is exactly the tool diameter.
"
+ "- Ball -> informative only and make reference to the Ball type endmill.
"
+ "- V-Shape -> it will disable de Z-Cut parameter in the resulting geometry UI form "
+ "and enable two additional UI form fields in the resulting geometry: V-Tip Dia and "
+ "V-Tip Angle. Adjusting those two values will adjust the Z-Cut parameter such "
+ "as the cut width into material will be equal with the value in the Tool Diameter "
+ "column of this table.
"
+ "Choosing the V-Shape Tool Type automatically will select the Operation Type "
+ "in the resulting geometry as Isolation."))
self.empty_label = QtWidgets.QLabel('')
self.tools_box.addWidget(self.empty_label)
- #### Add a new Tool ## ##
+ # ### Add a new Tool ####
hlay = QtWidgets.QHBoxLayout()
self.tools_box.addLayout(hlay)
@@ -134,7 +134,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.addtool_btn = QtWidgets.QPushButton(_('Add'))
self.addtool_btn.setToolTip(
_("Add a new tool to the Tool Table\n"
- "with the diameter specified above.")
+ "with the diameter specified above.")
)
# self.copytool_btn = QtWidgets.QPushButton('Copy')
@@ -146,12 +146,12 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.deltool_btn = QtWidgets.QPushButton(_('Delete'))
self.deltool_btn.setToolTip(
_("Delete a selection of tools in the Tool Table\n"
- "by first selecting a row(s) in the Tool Table.")
+ "by first selecting a row(s) in the Tool Table.")
)
grid2.addWidget(self.addtool_btn, 0, 0)
# grid2.addWidget(self.copytool_btn, 0, 1)
- grid2.addWidget(self.deltool_btn, 0,2)
+ grid2.addWidget(self.deltool_btn, 0, 2)
self.empty_label_0 = QtWidgets.QLabel('')
self.tools_box.addWidget(self.empty_label_0)
@@ -165,14 +165,14 @@ class NonCopperClear(FlatCAMTool, Gerber):
nccoverlabel = QtWidgets.QLabel(_('Overlap Rate:'))
nccoverlabel.setToolTip(
_("How much (fraction) of the tool width to overlap each tool pass.\n"
- "Example:\n"
- "A value here of 0.25 means 25% from the tool diameter found above.\n\n"
- "Adjust the value starting with lower values\n"
- "and increasing it if areas that should be cleared are still \n"
- "not cleared.\n"
- "Lower values = faster processing, faster execution on PCB.\n"
- "Higher values = slow processing and slow execution on CNC\n"
- "due of too many paths.")
+ "Example:\n"
+ "A value here of 0.25 means 25% from the tool diameter found above.\n\n"
+ "Adjust the value starting with lower values\n"
+ "and increasing it if areas that should be cleared are still \n"
+ "not cleared.\n"
+ "Lower values = faster processing, faster execution on PCB.\n"
+ "Higher values = slow processing and slow execution on CNC\n"
+ "due of too many paths.")
)
grid3.addWidget(nccoverlabel, 1, 0)
self.ncc_overlap_entry = FCEntry()
@@ -190,9 +190,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
methodlabel = QtWidgets.QLabel(_('Method:'))
methodlabel.setToolTip(
_("Algorithm for non-copper clearing:
"
- "Standard: Fixed step inwards.
"
- "Seed-based: Outwards from seed.
"
- "Line-based: Parallel lines.")
+ "Standard: Fixed step inwards.
"
+ "Seed-based: Outwards from seed.
"
+ "Line-based: Parallel lines.")
)
grid3.addWidget(methodlabel, 3, 0)
self.ncc_method_radio = RadioSet([
@@ -206,7 +206,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
pathconnectlabel = QtWidgets.QLabel(_("Connect:"))
pathconnectlabel.setToolTip(
_("Draw lines between resulting\n"
- "segments to minimize tool lifts.")
+ "segments to minimize tool lifts.")
)
grid3.addWidget(pathconnectlabel, 4, 0)
self.ncc_connect_cb = FCCheckBox()
@@ -215,7 +215,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
contourlabel = QtWidgets.QLabel(_("Contour:"))
contourlabel.setToolTip(
_("Cut around the perimeter of the polygon\n"
- "to trim rough edges.")
+ "to trim rough edges.")
)
grid3.addWidget(contourlabel, 5, 0)
self.ncc_contour_cb = FCCheckBox()
@@ -224,12 +224,12 @@ class NonCopperClear(FlatCAMTool, Gerber):
restlabel = QtWidgets.QLabel(_("Rest M.:"))
restlabel.setToolTip(
_("If checked, use 'rest machining'.\n"
- "Basically it will clear copper outside PCB features,\n"
- "using the biggest tool and continue with the next tools,\n"
- "from bigger to smaller, to clear areas of copper that\n"
- "could not be cleared by previous tool, until there is\n"
- "no more copper to clear or there are no more tools.\n"
- "If not checked, use the standard algorithm.")
+ "Basically it will clear copper outside PCB features,\n"
+ "using the biggest tool and continue with the next tools,\n"
+ "from bigger to smaller, to clear areas of copper that\n"
+ "could not be cleared by previous tool, until there is\n"
+ "no more copper to clear or there are no more tools.\n"
+ "If not checked, use the standard algorithm.")
)
grid3.addWidget(restlabel, 6, 0)
self.ncc_rest_cb = FCCheckBox()
@@ -238,7 +238,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.generate_ncc_button = QtWidgets.QPushButton(_('Generate Geometry'))
self.generate_ncc_button.setToolTip(
_("Create the Geometry Object\n"
- "for non-copper routing.")
+ "for non-copper routing.")
)
self.tools_box.addWidget(self.generate_ncc_button)
@@ -344,8 +344,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
try:
dias = [float(eval(dia)) for dia in self.app.defaults["tools_ncctools"].split(",") if dia != '']
- except:
- log.error("At least one tool diameter needed. Verify in Edit -> Preferences -> TOOLS -> NCC Tools.")
+ except Exception as e:
+ log.error("At least one tool diameter needed. "
+ "Verify in Edit -> Preferences -> TOOLS -> NCC Tools. %s" % str(e))
return
self.tooluid = 0
@@ -393,10 +394,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
for tooluid_key, tooluid_value in self.ncc_tools.items():
if float('%.4f' % tooluid_value['tooldia']) == tool_sorted:
tool_id += 1
- id = QtWidgets.QTableWidgetItem('%d' % int(tool_id))
- id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
+ id_ = QtWidgets.QTableWidgetItem('%d' % int(tool_id))
+ id_.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
row_no = tool_id - 1
- self.tools_table.setItem(row_no, 0, id) # Tool name/id
+ self.tools_table.setItem(row_no, 0, id_) # Tool name/id
# Make sure that the drill diameter when in MM is with no more than 2 decimals
# There are no drill bits in MM with more than 3 decimals diameter
@@ -478,7 +479,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
if tool_dia is None:
self.build_ui()
@@ -486,7 +487,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
return
if tool_dia == 0:
- self.app.inform.emit(_("[WARNING_NOTCL] Please enter a tool diameter with non-zero value, in Float format."))
+ self.app.inform.emit(_("[WARNING_NOTCL] Please enter a tool diameter with non-zero value, "
+ "in Float format."))
return
# construct a list of all 'tooluid' in the self.tools
@@ -568,7 +570,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
break
restore_dia_item = self.tools_table.item(row, 1)
restore_dia_item.setText(str(old_tool_dia))
- self.app.inform.emit(_("[WARNING_NOTCL] Edit cancelled. New diameter value is already in the Tool Table."))
+ self.app.inform.emit(_("[WARNING_NOTCL] Edit cancelled. "
+ "New diameter value is already in the Tool Table."))
self.build_ui()
def on_tool_delete(self, rows_to_delete=None, all=None):
@@ -625,13 +628,13 @@ class NonCopperClear(FlatCAMTool, Gerber):
over = float(self.ncc_overlap_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
over = over if over else self.app.defaults["tools_nccoverlap"]
if over >= 1 or over < 0:
self.app.inform.emit(_("[ERROR_NOTCL] Overlap value must be between "
- "0 (inclusive) and 1 (exclusive), "))
+ "0 (inclusive) and 1 (exclusive), "))
return
try:
@@ -642,7 +645,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
margin = float(self.ncc_margin_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
- "use a number."))
+ "use a number."))
return
margin = margin if margin else self.app.defaults["tools_nccmargin"]
@@ -662,13 +665,14 @@ class NonCopperClear(FlatCAMTool, Gerber):
# Get source object.
try:
self.ncc_obj = self.app.collection.get_by_name(self.obj_name)
- except:
+ except Exception as e:
self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.obj_name)
return "Could not retrieve object: %s" % self.obj_name
# Prepare non-copper polygons
try:
- bounding_box = self.ncc_obj.solid_geometry.envelope.buffer(distance=margin, join_style=base.JOIN_STYLE.mitre)
+ bounding_box = self.ncc_obj.solid_geometry.envelope.buffer(distance=margin,
+ join_style=base.JOIN_STYLE.mitre)
except AttributeError:
self.app.inform.emit(_("[ERROR_NOTCL] No Gerber file available."))
return
@@ -679,7 +683,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
empty = MultiPolygon([empty])
# clear non copper using standard algorithm
- if clearing_method == False:
+ if clearing_method is False:
self.clear_non_copper(
empty=empty,
over=over,
@@ -736,7 +740,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
area = empty.buffer(-offset)
try:
area = area.difference(cleared)
- except:
+ except Exception as e:
continue
# Transform area to MultiPolygon
@@ -758,8 +762,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
overlap=over, contour=contour, connect=connect)
if cp:
cleared_geo += list(cp.get_objects())
- except:
- log.warning("Polygon can not be cleared.")
+ except Exception as e:
+ log.warning("Polygon can not be cleared. %s" % str(e))
app_obj.poly_not_cleared = True
continue
@@ -850,7 +854,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
tool = sorted_tools.pop(0)
self.app.inform.emit(_('[success] Non-Copper Rest Clearing with ToolDia = %s started.') % str(tool))
- tool_used = tool - 1e-12
+ tool_used = tool - 1e-12
cleared_geo[:] = []
# Area to clear
@@ -973,4 +977,3 @@ class NonCopperClear(FlatCAMTool, Gerber):
def reset_fields(self):
self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-