- some PEP8 corrections
This commit is contained in:
@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
15.07.2019
|
||||||
|
|
||||||
|
- some PEP8 corrections
|
||||||
|
|
||||||
13.07.2019
|
13.07.2019
|
||||||
|
|
||||||
- fixed a possible issue in Gerber Object class
|
- fixed a possible issue in Gerber Object class
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class ToolCalculator(FlatCAMTool):
|
|||||||
self.layout.addWidget(title_label)
|
self.layout.addWidget(title_label)
|
||||||
|
|
||||||
# #####################
|
# #####################
|
||||||
# ## Units Calculator # ##
|
# ## Units Calculator #
|
||||||
# #####################
|
# #####################
|
||||||
|
|
||||||
self.unists_spacer_label = QtWidgets.QLabel(" ")
|
self.unists_spacer_label = QtWidgets.QLabel(" ")
|
||||||
@@ -75,11 +75,9 @@ class ToolCalculator(FlatCAMTool):
|
|||||||
grid_units_layout.addWidget(self.mm_entry, 1, 0)
|
grid_units_layout.addWidget(self.mm_entry, 1, 0)
|
||||||
grid_units_layout.addWidget(self.inch_entry, 1, 1)
|
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.v_shape_spacer_label = QtWidgets.QLabel(" ")
|
||||||
self.layout.addWidget(self.v_shape_spacer_label)
|
self.layout.addWidget(self.v_shape_spacer_label)
|
||||||
|
|
||||||
@@ -121,7 +119,6 @@ class ToolCalculator(FlatCAMTool):
|
|||||||
"In the CNCJob section it is called >Tool dia<."))
|
"In the CNCJob section it is called >Tool dia<."))
|
||||||
# self.effectiveToolDia_entry.setEnabled(False)
|
# self.effectiveToolDia_entry.setEnabled(False)
|
||||||
|
|
||||||
|
|
||||||
form_layout.addRow(self.tipDia_label, self.tipDia_entry)
|
form_layout.addRow(self.tipDia_label, self.tipDia_entry)
|
||||||
form_layout.addRow(self.tipAngle_label, self.tipAngle_entry)
|
form_layout.addRow(self.tipAngle_label, self.tipAngle_entry)
|
||||||
form_layout.addRow(self.cutDepth_label, self.cutDepth_entry)
|
form_layout.addRow(self.cutDepth_label, self.cutDepth_entry)
|
||||||
@@ -138,10 +135,9 @@ class ToolCalculator(FlatCAMTool):
|
|||||||
|
|
||||||
form_layout.addRow(self.empty_label, self.calculate_vshape_button)
|
form_layout.addRow(self.empty_label, self.calculate_vshape_button)
|
||||||
|
|
||||||
|
# ####################################
|
||||||
################################## ##
|
# ## ElectroPlating Tool Calculator ##
|
||||||
# ## ElectroPlating Tool Calculator # ##
|
# ####################################
|
||||||
################################## ##
|
|
||||||
|
|
||||||
self.plate_spacer_label = QtWidgets.QLabel(" ")
|
self.plate_spacer_label = QtWidgets.QLabel(" ")
|
||||||
self.layout.addWidget(self.plate_spacer_label)
|
self.layout.addWidget(self.plate_spacer_label)
|
||||||
@@ -177,7 +173,6 @@ class ToolCalculator(FlatCAMTool):
|
|||||||
self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
|
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_label = QtWidgets.QLabel(_("Copper Growth:"))
|
||||||
self.growth_entry = FCEntry()
|
self.growth_entry = FCEntry()
|
||||||
# self.growth_entry.setFixedWidth(70)
|
# self.growth_entry.setFixedWidth(70)
|
||||||
@@ -223,6 +218,8 @@ class ToolCalculator(FlatCAMTool):
|
|||||||
|
|
||||||
self.layout.addStretch()
|
self.layout.addStretch()
|
||||||
|
|
||||||
|
self.units = ''
|
||||||
|
|
||||||
# ## Signals
|
# ## Signals
|
||||||
self.cutDepth_entry.textChanged.connect(self.on_calculate_tool_dia)
|
self.cutDepth_entry.textChanged.connect(self.on_calculate_tool_dia)
|
||||||
self.cutDepth_entry.editingFinished.connect(self.on_calculate_tool_dia)
|
self.cutDepth_entry.editingFinished.connect(self.on_calculate_tool_dia)
|
||||||
|
|||||||
@@ -643,7 +643,6 @@ class CutOut(FlatCAMTool):
|
|||||||
geo_obj.solid_geometry = deepcopy(solid_geo)
|
geo_obj.solid_geometry = deepcopy(solid_geo)
|
||||||
geo_obj.options['cnctooldia'] = str(dia)
|
geo_obj.options['cnctooldia'] = str(dia)
|
||||||
|
|
||||||
|
|
||||||
outname = cutout_obj.options["name"] + "_cutout"
|
outname = cutout_obj.options["name"] + "_cutout"
|
||||||
self.app.new_object('geometry', outname, geo_init)
|
self.app.new_object('geometry', outname, geo_init)
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ from PyQt5 import QtCore
|
|||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
import FlatCAMTranslation as fcTranslate
|
import FlatCAMTranslation as fcTranslate
|
||||||
|
import builtins
|
||||||
|
|
||||||
fcTranslate.apply_language('strings')
|
fcTranslate.apply_language('strings')
|
||||||
import builtins
|
|
||||||
if '_' not in builtins.__dict__:
|
if '_' not in builtins.__dict__:
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
@@ -188,7 +188,6 @@ class DblSidedTool(FlatCAMTool):
|
|||||||
self.box_combo.hide()
|
self.box_combo.hide()
|
||||||
self.box_combo_type.hide()
|
self.box_combo_type.hide()
|
||||||
|
|
||||||
|
|
||||||
# ## Alignment holes
|
# ## Alignment holes
|
||||||
self.ah_label = QtWidgets.QLabel("<b>%s</b>" % _('Alignment Drill Coordinates:'))
|
self.ah_label = QtWidgets.QLabel("<b>%s</b>" % _('Alignment Drill Coordinates:'))
|
||||||
self.ah_label.setToolTip(
|
self.ah_label.setToolTip(
|
||||||
@@ -372,7 +371,8 @@ class DblSidedTool(FlatCAMTool):
|
|||||||
# holes = self.alignment_holes.get_value()
|
# holes = self.alignment_holes.get_value()
|
||||||
holes = eval('[{}]'.format(self.alignment_holes.text()))
|
holes = eval('[{}]'.format(self.alignment_holes.text()))
|
||||||
if not holes:
|
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
|
return
|
||||||
|
|
||||||
drills = []
|
drills = []
|
||||||
@@ -553,8 +553,4 @@ class DblSidedTool(FlatCAMTool):
|
|||||||
self.box_combo.setCurrentIndex(0)
|
self.box_combo.setCurrentIndex(0)
|
||||||
self.box_combo_type.setCurrentIndex(0)
|
self.box_combo_type.setCurrentIndex(0)
|
||||||
|
|
||||||
|
|
||||||
self.drill_values = ""
|
self.drill_values = ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ from PyQt5 import QtGui, QtCore, QtWidgets
|
|||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
import FlatCAMTranslation as fcTranslate
|
import FlatCAMTranslation as fcTranslate
|
||||||
|
import builtins
|
||||||
|
|
||||||
fcTranslate.apply_language('strings')
|
fcTranslate.apply_language('strings')
|
||||||
import builtins
|
|
||||||
if '_' not in builtins.__dict__:
|
if '_' not in builtins.__dict__:
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
@@ -221,13 +221,13 @@ class Film(FlatCAMTool):
|
|||||||
def on_film_creation(self):
|
def on_film_creation(self):
|
||||||
try:
|
try:
|
||||||
name = self.tf_object_combo.currentText()
|
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."))
|
self.app.inform.emit(_("[ERROR_NOTCL] No FlatCAM object selected. Load an object for Film and retry."))
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
boxname = self.tf_box_combo.currentText()
|
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."))
|
self.app.inform.emit(_("[ERROR_NOTCL] No FlatCAM object selected. Load an object for Box and retry."))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ from PyQt5 import QtGui, QtWidgets
|
|||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
import FlatCAMTranslation as fcTranslate
|
import FlatCAMTranslation as fcTranslate
|
||||||
|
import builtins
|
||||||
|
|
||||||
fcTranslate.apply_language('strings')
|
fcTranslate.apply_language('strings')
|
||||||
import builtins
|
|
||||||
if '_' not in builtins.__dict__:
|
if '_' not in builtins.__dict__:
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
@@ -191,19 +191,19 @@ class ToolImage(FlatCAMTool):
|
|||||||
mask = []
|
mask = []
|
||||||
self.app.log.debug("on_file_importimage()")
|
self.app.log.debug("on_file_importimage()")
|
||||||
|
|
||||||
filter = "Image Files(*.BMP *.PNG *.JPG *.JPEG);;" \
|
_filter = "Image Files(*.BMP *.PNG *.JPG *.JPEG);;" \
|
||||||
"Bitmap File (*.BMP);;" \
|
"Bitmap File (*.BMP);;" \
|
||||||
"PNG File (*.PNG);;" \
|
"PNG File (*.PNG);;" \
|
||||||
"Jpeg File (*.JPG);;" \
|
"Jpeg File (*.JPG);;" \
|
||||||
"All Files (*.*)"
|
"All Files (*.*)"
|
||||||
try:
|
try:
|
||||||
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Import IMAGE"),
|
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:
|
except TypeError:
|
||||||
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Import IMAGE"), filter=filter)
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Import IMAGE"), filter=filter)
|
||||||
|
|
||||||
filename = str(filename)
|
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()
|
dpi = self.dpi_entry.get_value()
|
||||||
mode = self.image_type.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(),
|
||||||
@@ -213,5 +213,5 @@ class ToolImage(FlatCAMTool):
|
|||||||
self.app.inform.emit(_("Open cancelled."))
|
self.app.inform.emit(_("Open cancelled."))
|
||||||
else:
|
else:
|
||||||
self.app.worker_task.emit({'fcn': self.app.import_image,
|
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")
|
# self.import_svg(filename, "geometry")
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ from math import sqrt
|
|||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
import FlatCAMTranslation as fcTranslate
|
import FlatCAMTranslation as fcTranslate
|
||||||
|
import builtins
|
||||||
|
|
||||||
fcTranslate.apply_language('strings')
|
fcTranslate.apply_language('strings')
|
||||||
import builtins
|
|
||||||
if '_' not in builtins.__dict__:
|
if '_' not in builtins.__dict__:
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
@@ -40,7 +40,6 @@ class Measurement(FlatCAMTool):
|
|||||||
form_layout = QtWidgets.QFormLayout()
|
form_layout = QtWidgets.QFormLayout()
|
||||||
self.layout.addLayout(form_layout)
|
self.layout.addLayout(form_layout)
|
||||||
|
|
||||||
|
|
||||||
self.units_label = QtWidgets.QLabel(_("Units:"))
|
self.units_label = QtWidgets.QLabel(_("Units:"))
|
||||||
self.units_label.setToolTip(_("Those are the units in which the distance is measured."))
|
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]))
|
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.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
|
||||||
self.distance_x_entry.setToolTip(_("This is the distance measured over the X axis."))
|
self.distance_x_entry.setToolTip(_("This is the distance measured over the X axis."))
|
||||||
|
|
||||||
|
|
||||||
self.distance_y_entry = FCEntry()
|
self.distance_y_entry = FCEntry()
|
||||||
self.distance_y_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
|
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.distance_y_entry.setToolTip(_("This is the distance measured over the Y axis."))
|
||||||
|
|
||||||
|
|
||||||
self.total_distance_entry = FCEntry()
|
self.total_distance_entry = FCEntry()
|
||||||
self.total_distance_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
|
self.total_distance_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
|
||||||
self.total_distance_entry.setToolTip(_("This is the point to point Euclidian distance."))
|
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.rel_point2 = None
|
||||||
|
|
||||||
self.active = False
|
self.active = False
|
||||||
|
self.clicked_meas = None
|
||||||
|
self.meas_line = None
|
||||||
|
|
||||||
self.original_call_source = 'app'
|
self.original_call_source = 'app'
|
||||||
|
|
||||||
@@ -312,7 +311,7 @@ class Measurement(FlatCAMTool):
|
|||||||
# update utility geometry
|
# update utility geometry
|
||||||
if len(self.points) == 1:
|
if len(self.points) == 1:
|
||||||
self.utility_geometry(pos=pos)
|
self.utility_geometry(pos=pos)
|
||||||
except:
|
except Exception as e:
|
||||||
self.app.ui.position_label.setText("")
|
self.app.ui.position_label.setText("")
|
||||||
self.app.ui.rel_position_label.setText("")
|
self.app.ui.rel_position_label.setText("")
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ from copy import copy
|
|||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
import FlatCAMTranslation as fcTranslate
|
import FlatCAMTranslation as fcTranslate
|
||||||
|
import builtins
|
||||||
|
|
||||||
fcTranslate.apply_language('strings')
|
fcTranslate.apply_language('strings')
|
||||||
import builtins
|
|
||||||
if '_' not in builtins.__dict__:
|
if '_' not in builtins.__dict__:
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ class ToolMove(FlatCAMTool):
|
|||||||
pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||||
|
|
||||||
# if GRID is active we need to get the snapped positions
|
# 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])
|
pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
|
||||||
else:
|
else:
|
||||||
pos = pos_canvas
|
pos = pos_canvas
|
||||||
@@ -117,7 +117,7 @@ class ToolMove(FlatCAMTool):
|
|||||||
self.delete_shape()
|
self.delete_shape()
|
||||||
|
|
||||||
# if GRID is active we need to get the snapped positions
|
# 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])
|
pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
|
||||||
else:
|
else:
|
||||||
pos = pos_canvas
|
pos = pos_canvas
|
||||||
@@ -143,7 +143,7 @@ class ToolMove(FlatCAMTool):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
sel_obj.replotApertures.emit()
|
sel_obj.replotApertures.emit()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Update the object bounding box options
|
# Update the object bounding box options
|
||||||
@@ -181,7 +181,7 @@ class ToolMove(FlatCAMTool):
|
|||||||
pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||||
|
|
||||||
# if GRID is active we need to get the snapped positions
|
# 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])
|
pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
|
||||||
else:
|
else:
|
||||||
pos = pos_canvas
|
pos = pos_canvas
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import time
|
|||||||
import gettext
|
import gettext
|
||||||
import FlatCAMTranslation as fcTranslate
|
import FlatCAMTranslation as fcTranslate
|
||||||
from shapely.geometry import base
|
from shapely.geometry import base
|
||||||
|
import builtins
|
||||||
|
|
||||||
fcTranslate.apply_language('strings')
|
fcTranslate.apply_language('strings')
|
||||||
import builtins
|
|
||||||
if '_' not in builtins.__dict__:
|
if '_' not in builtins.__dict__:
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
@@ -344,8 +344,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
dias = [float(eval(dia)) for dia in self.app.defaults["tools_ncctools"].split(",") if dia != '']
|
dias = [float(eval(dia)) for dia in self.app.defaults["tools_ncctools"].split(",") if dia != '']
|
||||||
except:
|
except Exception as e:
|
||||||
log.error("At least one tool diameter needed. Verify in Edit -> Preferences -> TOOLS -> NCC Tools.")
|
log.error("At least one tool diameter needed. "
|
||||||
|
"Verify in Edit -> Preferences -> TOOLS -> NCC Tools. %s" % str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
self.tooluid = 0
|
self.tooluid = 0
|
||||||
@@ -393,10 +394,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
for tooluid_key, tooluid_value in self.ncc_tools.items():
|
for tooluid_key, tooluid_value in self.ncc_tools.items():
|
||||||
if float('%.4f' % tooluid_value['tooldia']) == tool_sorted:
|
if float('%.4f' % tooluid_value['tooldia']) == tool_sorted:
|
||||||
tool_id += 1
|
tool_id += 1
|
||||||
id = QtWidgets.QTableWidgetItem('%d' % int(tool_id))
|
id_ = QtWidgets.QTableWidgetItem('%d' % int(tool_id))
|
||||||
id.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
id_.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||||
row_no = tool_id - 1
|
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
|
# 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
|
# There are no drill bits in MM with more than 3 decimals diameter
|
||||||
@@ -486,7 +487,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if tool_dia == 0:
|
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
|
return
|
||||||
|
|
||||||
# construct a list of all 'tooluid' in the self.tools
|
# construct a list of all 'tooluid' in the self.tools
|
||||||
@@ -568,7 +570,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
break
|
break
|
||||||
restore_dia_item = self.tools_table.item(row, 1)
|
restore_dia_item = self.tools_table.item(row, 1)
|
||||||
restore_dia_item.setText(str(old_tool_dia))
|
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()
|
self.build_ui()
|
||||||
|
|
||||||
def on_tool_delete(self, rows_to_delete=None, all=None):
|
def on_tool_delete(self, rows_to_delete=None, all=None):
|
||||||
@@ -662,13 +665,14 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
# Get source object.
|
# Get source object.
|
||||||
try:
|
try:
|
||||||
self.ncc_obj = self.app.collection.get_by_name(self.obj_name)
|
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)
|
self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.obj_name)
|
||||||
return "Could not retrieve object: %s" % self.obj_name
|
return "Could not retrieve object: %s" % self.obj_name
|
||||||
|
|
||||||
# Prepare non-copper polygons
|
# Prepare non-copper polygons
|
||||||
try:
|
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:
|
except AttributeError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] No Gerber file available."))
|
self.app.inform.emit(_("[ERROR_NOTCL] No Gerber file available."))
|
||||||
return
|
return
|
||||||
@@ -679,7 +683,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
empty = MultiPolygon([empty])
|
empty = MultiPolygon([empty])
|
||||||
|
|
||||||
# clear non copper using standard algorithm
|
# clear non copper using standard algorithm
|
||||||
if clearing_method == False:
|
if clearing_method is False:
|
||||||
self.clear_non_copper(
|
self.clear_non_copper(
|
||||||
empty=empty,
|
empty=empty,
|
||||||
over=over,
|
over=over,
|
||||||
@@ -736,7 +740,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
area = empty.buffer(-offset)
|
area = empty.buffer(-offset)
|
||||||
try:
|
try:
|
||||||
area = area.difference(cleared)
|
area = area.difference(cleared)
|
||||||
except:
|
except Exception as e:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Transform area to MultiPolygon
|
# Transform area to MultiPolygon
|
||||||
@@ -758,8 +762,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
overlap=over, contour=contour, connect=connect)
|
overlap=over, contour=contour, connect=connect)
|
||||||
if cp:
|
if cp:
|
||||||
cleared_geo += list(cp.get_objects())
|
cleared_geo += list(cp.get_objects())
|
||||||
except:
|
except Exception as e:
|
||||||
log.warning("Polygon can not be cleared.")
|
log.warning("Polygon can not be cleared. %s" % str(e))
|
||||||
app_obj.poly_not_cleared = True
|
app_obj.poly_not_cleared = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -973,4 +977,3 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||||||
|
|
||||||
def reset_fields(self):
|
def reset_fields(self):
|
||||||
self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user