- PEP8 correction in flatcamTools
- merged the Brazilian-portuguese language from a pull request made by Carlos Stein
This commit is contained in:
parent
d34a17a81d
commit
e6153298bc
@ -9,6 +9,11 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
16.07.2019
|
||||||
|
|
||||||
|
- PEP8 correction in flatcamTools
|
||||||
|
- merged the Brazilian-portuguese language from a pull request made by Carlos Stein
|
||||||
|
|
||||||
15.07.2019
|
15.07.2019
|
||||||
|
|
||||||
- some PEP8 corrections
|
- some PEP8 corrections
|
||||||
|
@ -207,8 +207,8 @@ class ToolPDF(FlatCAMTool):
|
|||||||
while True:
|
while True:
|
||||||
self.parsing_promises.remove(short_name)
|
self.parsing_promises.remove(short_name)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
log.debug("ToolPDF.open_pdf() --> %s" % str(e))
|
||||||
self.app.inform.emit(_("[success] Opened: %s") % filename)
|
self.app.inform.emit(_("[success] Opened: %s") % filename)
|
||||||
|
|
||||||
def layer_rendering_as_excellon(self, filename, ap_dict, layer_nr):
|
def layer_rendering_as_excellon(self, filename, ap_dict, layer_nr):
|
||||||
@ -264,8 +264,8 @@ class ToolPDF(FlatCAMTool):
|
|||||||
|
|
||||||
with self.app.proc_container.new(_("Rendering PDF layer #%d ...") % int(layer_nr)):
|
with self.app.proc_container.new(_("Rendering PDF layer #%d ...") % int(layer_nr)):
|
||||||
|
|
||||||
ret = self.app.new_object("excellon", outname, obj_init, autoselected=False)
|
ret_val = self.app.new_object("excellon", outname, obj_init, autoselected=False)
|
||||||
if ret == 'fail':
|
if ret_val == 'fail':
|
||||||
self.app.inform.emit(_('[ERROR_NOTCL] Open PDF file failed.'))
|
self.app.inform.emit(_('[ERROR_NOTCL] Open PDF file failed.'))
|
||||||
return
|
return
|
||||||
# Register recent file
|
# Register recent file
|
||||||
@ -300,7 +300,7 @@ class ToolPDF(FlatCAMTool):
|
|||||||
global_clear_geo.append(geo_el['clear'])
|
global_clear_geo.append(geo_el['clear'])
|
||||||
|
|
||||||
if global_clear_geo:
|
if global_clear_geo:
|
||||||
solid= []
|
solid = []
|
||||||
for apid in grb_obj.apertures:
|
for apid in grb_obj.apertures:
|
||||||
if 'geometry' in grb_obj.apertures[apid]:
|
if 'geometry' in grb_obj.apertures[apid]:
|
||||||
for elem in grb_obj.apertures[apid]['geometry']:
|
for elem in grb_obj.apertures[apid]['geometry']:
|
||||||
@ -360,7 +360,7 @@ class ToolPDF(FlatCAMTool):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.check_thread.stop()
|
self.check_thread.stop()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.check_thread.setInterval(check_period)
|
self.check_thread.setInterval(check_period)
|
||||||
@ -458,7 +458,7 @@ class ToolPDF(FlatCAMTool):
|
|||||||
|
|
||||||
# on stroke color change we create a new apertures dictionary and store the old one in a storage from where
|
# on stroke color change we create a new apertures dictionary and store the old one in a storage from where
|
||||||
# it will be transformed into Gerber object
|
# it will be transformed into Gerber object
|
||||||
old_color = [None, None ,None]
|
old_color = [None, None, None]
|
||||||
|
|
||||||
# signal that we have clear geometry and the geometry will be added to a special layer_nr = 0
|
# signal that we have clear geometry and the geometry will be added to a special layer_nr = 0
|
||||||
flag_clear_geo = False
|
flag_clear_geo = False
|
||||||
@ -681,10 +681,8 @@ class ToolPDF(FlatCAMTool):
|
|||||||
current_subpath = 'rectangle'
|
current_subpath = 'rectangle'
|
||||||
x = (float(match.group(1)) + offset_geo[0]) * self.point_to_unit_factor * scale_geo[0]
|
x = (float(match.group(1)) + offset_geo[0]) * self.point_to_unit_factor * scale_geo[0]
|
||||||
y = (float(match.group(2)) + offset_geo[1]) * self.point_to_unit_factor * scale_geo[1]
|
y = (float(match.group(2)) + offset_geo[1]) * self.point_to_unit_factor * scale_geo[1]
|
||||||
width = (float(match.group(3)) + offset_geo[0]) * \
|
width = (float(match.group(3)) + offset_geo[0]) * self.point_to_unit_factor * scale_geo[0]
|
||||||
self.point_to_unit_factor * scale_geo[0]
|
height = (float(match.group(4)) + offset_geo[1]) * self.point_to_unit_factor * scale_geo[1]
|
||||||
height = (float(match.group(4)) + offset_geo[1]) * \
|
|
||||||
self.point_to_unit_factor * scale_geo[1]
|
|
||||||
pt1 = (x, y)
|
pt1 = (x, y)
|
||||||
pt2 = (x+width, y)
|
pt2 = (x+width, y)
|
||||||
pt3 = (x+width, y+height)
|
pt3 = (x+width, y+height)
|
||||||
@ -758,7 +756,8 @@ class ToolPDF(FlatCAMTool):
|
|||||||
for subp in path['lines']:
|
for subp in path['lines']:
|
||||||
geo = copy(subp)
|
geo = copy(subp)
|
||||||
try:
|
try:
|
||||||
geo = LineString(geo).buffer((float(applied_size) / 2), resolution=self.step_per_circles)
|
geo = LineString(geo).buffer((float(applied_size) / 2),
|
||||||
|
resolution=self.step_per_circles)
|
||||||
path_geo.append(geo)
|
path_geo.append(geo)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
# ########################################################## ##
|
# ########################################################## ##
|
||||||
|
|
||||||
from FlatCAMTool import FlatCAMTool
|
from FlatCAMTool import FlatCAMTool
|
||||||
from copy import copy,deepcopy
|
from copy import copy, deepcopy
|
||||||
from ObjectCollection import *
|
from ObjectCollection import *
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -65,11 +65,11 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
form_layout.addRow(self.object_label, self.object_combo)
|
form_layout.addRow(self.object_label, self.object_combo)
|
||||||
form_layout.addRow(e_lab_0)
|
form_layout.addRow(e_lab_0)
|
||||||
|
|
||||||
#### Tools ## ##
|
# ### Tools ## ##
|
||||||
self.tools_table_label = QtWidgets.QLabel('<b>%s</b>' % _('Tools Table'))
|
self.tools_table_label = QtWidgets.QLabel('<b>%s</b>' % _('Tools Table'))
|
||||||
self.tools_table_label.setToolTip(
|
self.tools_table_label.setToolTip(
|
||||||
_("Tools pool from which the algorithm\n"
|
_("Tools pool from which the algorithm\n"
|
||||||
"will pick the ones used for painting.")
|
"will pick the ones used for painting.")
|
||||||
)
|
)
|
||||||
self.tools_box.addWidget(self.tools_table_label)
|
self.tools_box.addWidget(self.tools_table_label)
|
||||||
|
|
||||||
@ -84,33 +84,33 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
|
|
||||||
self.tools_table.horizontalHeaderItem(0).setToolTip(
|
self.tools_table.horizontalHeaderItem(0).setToolTip(
|
||||||
_("This is the Tool Number.\n"
|
_("This is the Tool Number.\n"
|
||||||
"Painting will start with the tool with the biggest diameter,\n"
|
"Painting will start with the tool with the biggest diameter,\n"
|
||||||
"continuing until there are no more tools.\n"
|
"continuing until there are no more tools.\n"
|
||||||
"Only tools that create painting geometry will still be present\n"
|
"Only tools that create painting geometry will still be present\n"
|
||||||
"in the resulting geometry. This is because with some tools\n"
|
"in the resulting geometry. This is because with some tools\n"
|
||||||
"this function will not be able to create painting geometry.")
|
"this function will not be able to create painting geometry.")
|
||||||
)
|
)
|
||||||
self.tools_table.horizontalHeaderItem(1).setToolTip(
|
self.tools_table.horizontalHeaderItem(1).setToolTip(
|
||||||
_("Tool Diameter. It's value (in current FlatCAM units) \n"
|
_("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(
|
self.tools_table.horizontalHeaderItem(2).setToolTip(
|
||||||
_("The Tool Type (TT) can be:<BR>"
|
_("The Tool Type (TT) can be:<BR>"
|
||||||
"- <B>Circular</B> with 1 ... 4 teeth -> it is informative only. Being circular, <BR>"
|
"- <B>Circular</B> with 1 ... 4 teeth -> it is informative only. Being circular, <BR>"
|
||||||
"the cut width in material is exactly the tool diameter.<BR>"
|
"the cut width in material is exactly the tool diameter.<BR>"
|
||||||
"- <B>Ball</B> -> informative only and make reference to the Ball type endmill.<BR>"
|
"- <B>Ball</B> -> informative only and make reference to the Ball type endmill.<BR>"
|
||||||
"- <B>V-Shape</B> -> it will disable de Z-Cut parameter in the resulting geometry UI form "
|
"- <B>V-Shape</B> -> 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 "
|
"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 "
|
"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 "
|
"as the cut width into material will be equal with the value in the Tool Diameter "
|
||||||
"column of this table.<BR>"
|
"column of this table.<BR>"
|
||||||
"Choosing the <B>V-Shape</B> Tool Type automatically will select the Operation Type "
|
"Choosing the <B>V-Shape</B> Tool Type automatically will select the Operation Type "
|
||||||
"in the resulting geometry as Isolation."))
|
"in the resulting geometry as Isolation."))
|
||||||
|
|
||||||
self.empty_label = QtWidgets.QLabel('')
|
self.empty_label = QtWidgets.QLabel('')
|
||||||
self.tools_box.addWidget(self.empty_label)
|
self.tools_box.addWidget(self.empty_label)
|
||||||
|
|
||||||
#### Add a new Tool ## ##
|
# ### Add a new Tool ## ##
|
||||||
hlay = QtWidgets.QHBoxLayout()
|
hlay = QtWidgets.QHBoxLayout()
|
||||||
self.tools_box.addLayout(hlay)
|
self.tools_box.addLayout(hlay)
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.addtool_btn = QtWidgets.QPushButton(_('Add'))
|
self.addtool_btn = QtWidgets.QPushButton(_('Add'))
|
||||||
self.addtool_btn.setToolTip(
|
self.addtool_btn.setToolTip(
|
||||||
_("Add a new tool to the Tool Table\n"
|
_("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')
|
# self.copytool_btn = QtWidgets.QPushButton('Copy')
|
||||||
@ -143,12 +143,12 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.deltool_btn = QtWidgets.QPushButton(_('Delete'))
|
self.deltool_btn = QtWidgets.QPushButton(_('Delete'))
|
||||||
self.deltool_btn.setToolTip(
|
self.deltool_btn.setToolTip(
|
||||||
_("Delete a selection of tools in the Tool Table\n"
|
_("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.addtool_btn, 0, 0)
|
||||||
# grid2.addWidget(self.copytool_btn, 0, 1)
|
# 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.empty_label_0 = QtWidgets.QLabel('')
|
||||||
self.tools_box.addWidget(self.empty_label_0)
|
self.tools_box.addWidget(self.empty_label_0)
|
||||||
@ -177,8 +177,8 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
marginlabel = QtWidgets.QLabel(_('Margin:'))
|
marginlabel = QtWidgets.QLabel(_('Margin:'))
|
||||||
marginlabel.setToolTip(
|
marginlabel.setToolTip(
|
||||||
_("Distance by which to avoid\n"
|
_("Distance by which to avoid\n"
|
||||||
"the edges of the polygon to\n"
|
"the edges of the polygon to\n"
|
||||||
"be painted.")
|
"be painted.")
|
||||||
)
|
)
|
||||||
grid3.addWidget(marginlabel, 2, 0)
|
grid3.addWidget(marginlabel, 2, 0)
|
||||||
self.paintmargin_entry = FCEntry()
|
self.paintmargin_entry = FCEntry()
|
||||||
@ -188,9 +188,9 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
methodlabel = QtWidgets.QLabel(_('Method:'))
|
methodlabel = QtWidgets.QLabel(_('Method:'))
|
||||||
methodlabel.setToolTip(
|
methodlabel.setToolTip(
|
||||||
_("Algorithm for non-copper clearing:<BR>"
|
_("Algorithm for non-copper clearing:<BR>"
|
||||||
"<B>Standard</B>: Fixed step inwards.<BR>"
|
"<B>Standard</B>: Fixed step inwards.<BR>"
|
||||||
"<B>Seed-based</B>: Outwards from seed.<BR>"
|
"<B>Seed-based</B>: Outwards from seed.<BR>"
|
||||||
"<B>Line-based</B>: Parallel lines.")
|
"<B>Line-based</B>: Parallel lines.")
|
||||||
)
|
)
|
||||||
grid3.addWidget(methodlabel, 3, 0)
|
grid3.addWidget(methodlabel, 3, 0)
|
||||||
self.paintmethod_combo = RadioSet([
|
self.paintmethod_combo = RadioSet([
|
||||||
@ -204,7 +204,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
pathconnectlabel = QtWidgets.QLabel(_("Connect:"))
|
pathconnectlabel = QtWidgets.QLabel(_("Connect:"))
|
||||||
pathconnectlabel.setToolTip(
|
pathconnectlabel.setToolTip(
|
||||||
_("Draw lines between resulting\n"
|
_("Draw lines between resulting\n"
|
||||||
"segments to minimize tool lifts.")
|
"segments to minimize tool lifts.")
|
||||||
)
|
)
|
||||||
grid3.addWidget(pathconnectlabel, 4, 0)
|
grid3.addWidget(pathconnectlabel, 4, 0)
|
||||||
self.pathconnect_cb = FCCheckBox()
|
self.pathconnect_cb = FCCheckBox()
|
||||||
@ -213,7 +213,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
contourlabel = QtWidgets.QLabel(_("Contour:"))
|
contourlabel = QtWidgets.QLabel(_("Contour:"))
|
||||||
contourlabel.setToolTip(
|
contourlabel.setToolTip(
|
||||||
_("Cut around the perimeter of the polygon\n"
|
_("Cut around the perimeter of the polygon\n"
|
||||||
"to trim rough edges.")
|
"to trim rough edges.")
|
||||||
)
|
)
|
||||||
grid3.addWidget(contourlabel, 5, 0)
|
grid3.addWidget(contourlabel, 5, 0)
|
||||||
self.paintcontour_cb = FCCheckBox()
|
self.paintcontour_cb = FCCheckBox()
|
||||||
@ -222,12 +222,12 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
restlabel = QtWidgets.QLabel(_("Rest M.:"))
|
restlabel = QtWidgets.QLabel(_("Rest M.:"))
|
||||||
restlabel.setToolTip(
|
restlabel.setToolTip(
|
||||||
_("If checked, use 'rest machining'.\n"
|
_("If checked, use 'rest machining'.\n"
|
||||||
"Basically it will clear copper outside PCB features,\n"
|
"Basically it will clear copper outside PCB features,\n"
|
||||||
"using the biggest tool and continue with the next tools,\n"
|
"using the biggest tool and continue with the next tools,\n"
|
||||||
"from bigger to smaller, to clear areas of copper that\n"
|
"from bigger to smaller, to clear areas of copper that\n"
|
||||||
"could not be cleared by previous tool, until there is\n"
|
"could not be cleared by previous tool, until there is\n"
|
||||||
"no more copper to clear or there are no more tools.\n\n"
|
"no more copper to clear or there are no more tools.\n\n"
|
||||||
"If not checked, use the standard algorithm.")
|
"If not checked, use the standard algorithm.")
|
||||||
)
|
)
|
||||||
grid3.addWidget(restlabel, 6, 0)
|
grid3.addWidget(restlabel, 6, 0)
|
||||||
self.rest_cb = FCCheckBox()
|
self.rest_cb = FCCheckBox()
|
||||||
@ -237,9 +237,9 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
selectlabel = QtWidgets.QLabel(_('Selection:'))
|
selectlabel = QtWidgets.QLabel(_('Selection:'))
|
||||||
selectlabel.setToolTip(
|
selectlabel.setToolTip(
|
||||||
_("How to select the polygons to paint.<BR>"
|
_("How to select the polygons to paint.<BR>"
|
||||||
"Options:<BR>"
|
"Options:<BR>"
|
||||||
"- <B>Single</B>: left mouse click on the polygon to be painted.<BR>"
|
"- <B>Single</B>: left mouse click on the polygon to be painted.<BR>"
|
||||||
"- <B>All</B>: paint all polygons.")
|
"- <B>All</B>: paint all polygons.")
|
||||||
)
|
)
|
||||||
grid3.addWidget(selectlabel, 7, 0)
|
grid3.addWidget(selectlabel, 7, 0)
|
||||||
# grid3 = QtWidgets.QGridLayout()
|
# grid3 = QtWidgets.QGridLayout()
|
||||||
@ -254,10 +254,10 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.generate_paint_button = QtWidgets.QPushButton(_('Create Paint Geometry'))
|
self.generate_paint_button = QtWidgets.QPushButton(_('Create Paint Geometry'))
|
||||||
self.generate_paint_button.setToolTip(
|
self.generate_paint_button.setToolTip(
|
||||||
_("After clicking here, click inside<BR>"
|
_("After clicking here, click inside<BR>"
|
||||||
"the polygon you wish to be painted if <B>Single</B> is selected.<BR>"
|
"the polygon you wish to be painted if <B>Single</B> is selected.<BR>"
|
||||||
"If <B>All</B> is selected then the Paint will start after click.<BR>"
|
"If <B>All</B> is selected then the Paint will start after click.<BR>"
|
||||||
"A new Geometry object with the tool<BR>"
|
"A new Geometry object with the tool<BR>"
|
||||||
"paths will be created.")
|
"paths will be created.")
|
||||||
)
|
)
|
||||||
self.tools_box.addWidget(self.generate_paint_button)
|
self.tools_box.addWidget(self.generate_paint_button)
|
||||||
|
|
||||||
@ -314,7 +314,6 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.generate_paint_button.clicked.connect(self.on_paint_button_click)
|
self.generate_paint_button.clicked.connect(self.on_paint_button_click)
|
||||||
self.selectmethod_combo.activated_custom.connect(self.on_radio_selection)
|
self.selectmethod_combo.activated_custom.connect(self.on_radio_selection)
|
||||||
|
|
||||||
|
|
||||||
def install(self, icon=None, separator=None, **kwargs):
|
def install(self, icon=None, separator=None, **kwargs):
|
||||||
FlatCAMTool.install(self, icon, separator, shortcut='ALT+P', **kwargs)
|
FlatCAMTool.install(self, icon, separator, shortcut='ALT+P', **kwargs)
|
||||||
|
|
||||||
@ -430,7 +429,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.on_tool_add(self.app.defaults["tools_painttooldia"], muted=True)
|
self.on_tool_add(self.app.defaults["tools_painttooldia"], muted=True)
|
||||||
|
|
||||||
# if the Paint Method is "Single" disable the tool table context menu
|
# if the Paint Method is "Single" disable the tool table context menu
|
||||||
if self.default_data["selectmethod"] == "single":
|
if self.default_data["selectmethod"] == "single":
|
||||||
self.tools_table.setContextMenuPolicy(Qt.NoContextMenu)
|
self.tools_table.setContextMenuPolicy(Qt.NoContextMenu)
|
||||||
|
|
||||||
def build_ui(self):
|
def build_ui(self):
|
||||||
@ -522,8 +521,8 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.tools_table.itemChanged.disconnect()
|
self.tools_table.itemChanged.disconnect()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
log.debug("ToolPaint.on_tool_add() --> %s" % str(e))
|
||||||
|
|
||||||
if dia:
|
if dia:
|
||||||
tool_dia = dia
|
tool_dia = dia
|
||||||
@ -586,10 +585,12 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.build_ui()
|
self.build_ui()
|
||||||
|
|
||||||
def on_tool_edit(self):
|
def on_tool_edit(self):
|
||||||
|
old_tool_dia = ''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.tools_table.itemChanged.disconnect()
|
self.tools_table.itemChanged.disconnect()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
log.debug("ToolPaint.on_tool_edit() --> %s" % str(e))
|
||||||
|
|
||||||
tool_dias = []
|
tool_dias = []
|
||||||
for k, v in self.paint_tools.items():
|
for k, v in self.paint_tools.items():
|
||||||
@ -624,7 +625,8 @@ class ToolPaint(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_copy(self, all=None):
|
# def on_tool_copy(self, all=None):
|
||||||
@ -685,7 +687,8 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
def on_tool_delete(self, rows_to_delete=None, all=None):
|
def on_tool_delete(self, rows_to_delete=None, all=None):
|
||||||
try:
|
try:
|
||||||
self.tools_table.itemChanged.disconnect()
|
self.tools_table.itemChanged.disconnect()
|
||||||
except:
|
except Exception as e:
|
||||||
|
log.debug("ToolPaint.on_tool_delete() --> %s" % str(e))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
deleted_tools_list = []
|
deleted_tools_list = []
|
||||||
@ -741,12 +744,12 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
overlap = float(self.paintoverlap_entry.get_value().replace(',', '.'))
|
overlap = float(self.paintoverlap_entry.get_value().replace(',', '.'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
|
||||||
"use a number."))
|
"use a number."))
|
||||||
return
|
return
|
||||||
|
|
||||||
if overlap >= 1 or overlap < 0:
|
if overlap >= 1 or overlap < 0:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Overlap value must be between "
|
self.app.inform.emit(_("[ERROR_NOTCL] Overlap value must be between "
|
||||||
"0 (inclusive) and 1 (exclusive), "))
|
"0 (inclusive) and 1 (exclusive), "))
|
||||||
return
|
return
|
||||||
|
|
||||||
self.app.inform.emit(_("[WARNING_NOTCL] Click inside the desired polygon."))
|
self.app.inform.emit(_("[WARNING_NOTCL] Click inside the desired polygon."))
|
||||||
@ -760,7 +763,8 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
# Get source object.
|
# Get source object.
|
||||||
try:
|
try:
|
||||||
self.paint_obj = self.app.collection.get_by_name(str(self.obj_name))
|
self.paint_obj = self.app.collection.get_by_name(str(self.obj_name))
|
||||||
except:
|
except Exception as e:
|
||||||
|
log.debug("ToolPaint.on_paint_button_click() --> %s" % str(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
|
return
|
||||||
|
|
||||||
@ -774,7 +778,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.app.inform.emit(_("[ERROR_NOTCL] Can't do Paint on MultiGeo geometries ..."))
|
self.app.inform.emit(_("[ERROR_NOTCL] Can't do Paint on MultiGeo geometries ..."))
|
||||||
return 'Fail'
|
return 'Fail'
|
||||||
|
|
||||||
o_name = '%s_multitool_paint' % (self.obj_name)
|
o_name = '%s_multitool_paint' % self.obj_name
|
||||||
|
|
||||||
if select_method == "all":
|
if select_method == "all":
|
||||||
self.paint_poly_all(self.paint_obj,
|
self.paint_poly_all(self.paint_obj,
|
||||||
@ -811,15 +815,13 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
self.app.plotcanvas.vis_disconnect('mouse_press', self.app.on_mouse_click_over_plot)
|
self.app.plotcanvas.vis_disconnect('mouse_press', self.app.on_mouse_click_over_plot)
|
||||||
self.app.plotcanvas.vis_connect('mouse_press', doit)
|
self.app.plotcanvas.vis_connect('mouse_press', doit)
|
||||||
|
|
||||||
def paint_poly(self, obj, inside_pt, tooldia, overlap,
|
def paint_poly(self, obj, inside_pt, tooldia, overlap, outname=None, connect=True, contour=True):
|
||||||
outname=None, connect=True,
|
|
||||||
contour=True):
|
|
||||||
"""
|
"""
|
||||||
Paints a polygon selected by clicking on its interior.
|
Paints a polygon selected by clicking on its interior.
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
* The margin is taken directly from the form.
|
* The margin is taken directly from the form.
|
||||||
|
:param obj: painted object
|
||||||
:param inside_pt: [x, y]
|
:param inside_pt: [x, y]
|
||||||
:param tooldia: Diameter of the painting tool
|
:param tooldia: Diameter of the painting tool
|
||||||
:param overlap: Overlap of the tool between passes.
|
:param overlap: Overlap of the tool between passes.
|
||||||
@ -864,34 +866,34 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
def paint_p(polyg):
|
def paint_p(polyg):
|
||||||
if paint_method == "seed":
|
if paint_method == "seed":
|
||||||
# Type(cp) == FlatCAMRTreeStorage | None
|
# Type(cp) == FlatCAMRTreeStorage | None
|
||||||
cp = self.clear_polygon2(polyg,
|
cpoly = self.clear_polygon2(polyg,
|
||||||
tooldia=tooldia,
|
tooldia=tooldia,
|
||||||
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
||||||
overlap=overlap,
|
overlap=overlap,
|
||||||
contour=contour,
|
contour=contour,
|
||||||
connect=connect)
|
connect=connect)
|
||||||
|
|
||||||
elif paint_method == "lines":
|
elif paint_method == "lines":
|
||||||
# Type(cp) == FlatCAMRTreeStorage | None
|
# Type(cp) == FlatCAMRTreeStorage | None
|
||||||
cp = self.clear_polygon3(polyg,
|
cpoly = self.clear_polygon3(polyg,
|
||||||
tooldia=tooldia,
|
tooldia=tooldia,
|
||||||
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
||||||
overlap=overlap,
|
overlap=overlap,
|
||||||
contour=contour,
|
contour=contour,
|
||||||
connect=connect)
|
connect=connect)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Type(cp) == FlatCAMRTreeStorage | None
|
# Type(cp) == FlatCAMRTreeStorage | None
|
||||||
cp = self.clear_polygon(polyg,
|
cpoly = self.clear_polygon(polyg,
|
||||||
tooldia=tooldia,
|
tooldia=tooldia,
|
||||||
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
||||||
overlap=overlap,
|
overlap=overlap,
|
||||||
contour=contour,
|
contour=contour,
|
||||||
connect=connect)
|
connect=connect)
|
||||||
|
|
||||||
if cp is not None:
|
if cpoly is not None:
|
||||||
geo_obj.solid_geometry += list(cp.get_objects())
|
geo_obj.solid_geometry += list(cpoly.get_objects())
|
||||||
return cp
|
return cpoly
|
||||||
else:
|
else:
|
||||||
self.app.inform.emit(_('[ERROR_NOTCL] Geometry could not be painted completely'))
|
self.app.inform.emit(_('[ERROR_NOTCL] Geometry could not be painted completely'))
|
||||||
return None
|
return None
|
||||||
@ -975,12 +977,11 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
# Background
|
# Background
|
||||||
self.app.worker_task.emit({'fcn': job_thread, 'params': [self.app]})
|
self.app.worker_task.emit({'fcn': job_thread, 'params': [self.app]})
|
||||||
|
|
||||||
def paint_poly_all(self, obj, overlap, outname=None,
|
def paint_poly_all(self, obj, overlap, outname=None, connect=True, contour=True):
|
||||||
connect=True, contour=True):
|
|
||||||
"""
|
"""
|
||||||
Paints all polygons in this object.
|
Paints all polygons in this object.
|
||||||
|
|
||||||
:param tooldia:
|
:param obj: painted object
|
||||||
:param overlap:
|
:param overlap:
|
||||||
:param outname:
|
:param outname:
|
||||||
:param connect: Connect lines to avoid tool lifts.
|
:param connect: Connect lines to avoid tool lifts.
|
||||||
@ -1055,6 +1056,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
def gen_paintarea(geo_obj, app_obj):
|
def gen_paintarea(geo_obj, app_obj):
|
||||||
assert isinstance(geo_obj, FlatCAMGeometry), \
|
assert isinstance(geo_obj, FlatCAMGeometry), \
|
||||||
"Initializer expected a FlatCAMGeometry, got %s" % type(geo_obj)
|
"Initializer expected a FlatCAMGeometry, got %s" % type(geo_obj)
|
||||||
|
tool_dia = None
|
||||||
|
|
||||||
sorted_tools = []
|
sorted_tools = []
|
||||||
for row in range(self.tools_table.rowCount()):
|
for row in range(self.tools_table.rowCount()):
|
||||||
@ -1083,7 +1085,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
|
|
||||||
for geo in recurse(obj.solid_geometry):
|
for geo in recurse(obj.solid_geometry):
|
||||||
try:
|
try:
|
||||||
#Polygons are the only really paintable geometries, lines in theory have no area to be painted
|
# Polygons are the only really paintable geometries, lines in theory have no area to be painted
|
||||||
if not isinstance(geo, Polygon):
|
if not isinstance(geo, Polygon):
|
||||||
continue
|
continue
|
||||||
poly_buf = geo.buffer(-paint_margin)
|
poly_buf = geo.buffer(-paint_margin)
|
||||||
@ -1109,11 +1111,11 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
else:
|
else:
|
||||||
# Type(cp) == FlatCAMRTreeStorage | None
|
# Type(cp) == FlatCAMRTreeStorage | None
|
||||||
cp = self.clear_polygon(poly_buf,
|
cp = self.clear_polygon(poly_buf,
|
||||||
tooldia=tool_dia,
|
tooldia=tool_dia,
|
||||||
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
||||||
overlap=over,
|
overlap=over,
|
||||||
contour=cont,
|
contour=cont,
|
||||||
connect=conn)
|
connect=conn)
|
||||||
|
|
||||||
if cp is not None:
|
if cp is not None:
|
||||||
total_geometry += list(cp.get_objects())
|
total_geometry += list(cp.get_objects())
|
||||||
@ -1121,7 +1123,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
log.debug("Could not Paint the polygons. %s" % str(e))
|
log.debug("Could not Paint the polygons. %s" % str(e))
|
||||||
self.app.inform.emit(
|
self.app.inform.emit(
|
||||||
_("[ERROR] Could not do Paint All. Try a different combination of parameters. "
|
_("[ERROR] Could not do Paint All. Try a different combination of parameters. "
|
||||||
"Or a different Method of paint\n%s") % str(e))
|
"Or a different Method of paint\n%s") % str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
# add the solid_geometry to the current too in self.paint_tools dictionary and then reset the
|
# add the solid_geometry to the current too in self.paint_tools dictionary and then reset the
|
||||||
@ -1160,6 +1162,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
assert isinstance(geo_obj, FlatCAMGeometry), \
|
assert isinstance(geo_obj, FlatCAMGeometry), \
|
||||||
"Initializer expected a FlatCAMGeometry, got %s" % type(geo_obj)
|
"Initializer expected a FlatCAMGeometry, got %s" % type(geo_obj)
|
||||||
|
|
||||||
|
tool_dia = None
|
||||||
sorted_tools = []
|
sorted_tools = []
|
||||||
for row in range(self.tools_table.rowCount()):
|
for row in range(self.tools_table.rowCount()):
|
||||||
sorted_tools.append(float(self.tools_table.item(row, 1).text()))
|
sorted_tools.append(float(self.tools_table.item(row, 1).text()))
|
||||||
@ -1184,12 +1187,13 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
try:
|
try:
|
||||||
geo = Polygon(geo) if not isinstance(geo, Polygon) else geo
|
geo = Polygon(geo) if not isinstance(geo, Polygon) else geo
|
||||||
poly_buf = geo.buffer(-paint_margin)
|
poly_buf = geo.buffer(-paint_margin)
|
||||||
|
cp = None
|
||||||
|
|
||||||
if paint_method == "standard":
|
if paint_method == "standard":
|
||||||
# Type(cp) == FlatCAMRTreeStorage | None
|
# Type(cp) == FlatCAMRTreeStorage | None
|
||||||
cp = self.clear_polygon(poly_buf, tooldia=tool_dia,
|
cp = self.clear_polygon(poly_buf, tooldia=tool_dia,
|
||||||
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
||||||
overlap=over, contour=cont, connect=conn)
|
overlap=over, contour=cont, connect=conn)
|
||||||
|
|
||||||
elif paint_method == "seed":
|
elif paint_method == "seed":
|
||||||
# Type(cp) == FlatCAMRTreeStorage | None
|
# Type(cp) == FlatCAMRTreeStorage | None
|
||||||
@ -1200,8 +1204,8 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
elif paint_method == "lines":
|
elif paint_method == "lines":
|
||||||
# Type(cp) == FlatCAMRTreeStorage | None
|
# Type(cp) == FlatCAMRTreeStorage | None
|
||||||
cp = self.clear_polygon3(poly_buf, tooldia=tool_dia,
|
cp = self.clear_polygon3(poly_buf, tooldia=tool_dia,
|
||||||
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
steps_per_circle=self.app.defaults["geometry_circle_steps"],
|
||||||
overlap=over, contour=cont, connect=conn)
|
overlap=over, contour=cont, connect=conn)
|
||||||
|
|
||||||
if cp is not None:
|
if cp is not None:
|
||||||
cleared_geo += list(cp.get_objects())
|
cleared_geo += list(cp.get_objects())
|
||||||
@ -1210,7 +1214,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
log.debug("Could not Paint the polygons. %s" % str(e))
|
log.debug("Could not Paint the polygons. %s" % str(e))
|
||||||
self.app.inform.emit(
|
self.app.inform.emit(
|
||||||
_("[ERROR] Could not do Paint All. Try a different combination of parameters. "
|
_("[ERROR] Could not do Paint All. Try a different combination of parameters. "
|
||||||
"Or a different Method of paint\n%s") % str(e))
|
"Or a different Method of paint\n%s") % str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
# find the tooluid associated with the current tool_dia so we know where to add the tool solid_geometry
|
# find the tooluid associated with the current tool_dia so we know where to add the tool solid_geometry
|
||||||
@ -1240,8 +1244,8 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||||||
has_solid_geo += 1
|
has_solid_geo += 1
|
||||||
if has_solid_geo == 0:
|
if has_solid_geo == 0:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] There is no Painting Geometry in the file.\n"
|
self.app.inform.emit(_("[ERROR_NOTCL] There is no Painting Geometry in the file.\n"
|
||||||
"Usually it means that the tool diameter is too big for the painted geometry.\n"
|
"Usually it means that the tool diameter is too big for the painted geometry.\n"
|
||||||
"Change the painting parameters and try again."))
|
"Change the painting parameters and try again."))
|
||||||
return
|
return
|
||||||
|
|
||||||
# Experimental...
|
# Experimental...
|
||||||
|
@ -18,9 +18,9 @@ from io import StringIO
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -56,9 +56,8 @@ class PcbWizard(FlatCAMTool):
|
|||||||
|
|
||||||
self.excellon_label = QtWidgets.QLabel(_("Excellon file:"))
|
self.excellon_label = QtWidgets.QLabel(_("Excellon file:"))
|
||||||
self.excellon_label.setToolTip(
|
self.excellon_label.setToolTip(
|
||||||
_( "Load the Excellon file.\n"
|
_("Load the Excellon file.\n"
|
||||||
"Usually it has a .DRL extension")
|
"Usually it has a .DRL extension")
|
||||||
|
|
||||||
)
|
)
|
||||||
self.excellon_brn = FCButton(_("Open"))
|
self.excellon_brn = FCButton(_("Open"))
|
||||||
form_layout.addRow(self.excellon_label, self.excellon_brn)
|
form_layout.addRow(self.excellon_label, self.excellon_brn)
|
||||||
@ -66,7 +65,6 @@ class PcbWizard(FlatCAMTool):
|
|||||||
self.inf_label = QtWidgets.QLabel(_("INF file:"))
|
self.inf_label = QtWidgets.QLabel(_("INF file:"))
|
||||||
self.inf_label.setToolTip(
|
self.inf_label.setToolTip(
|
||||||
_("Load the INF file.")
|
_("Load the INF file.")
|
||||||
|
|
||||||
)
|
)
|
||||||
self.inf_btn = FCButton(_("Open"))
|
self.inf_btn = FCButton(_("Open"))
|
||||||
form_layout.addRow(self.inf_label, self.inf_btn)
|
form_layout.addRow(self.inf_label, self.inf_btn)
|
||||||
@ -96,7 +94,7 @@ class PcbWizard(FlatCAMTool):
|
|||||||
self.int_entry.set_range(1, 10)
|
self.int_entry.set_range(1, 10)
|
||||||
self.int_label = QtWidgets.QLabel(_("Int. digits:"))
|
self.int_label = QtWidgets.QLabel(_("Int. digits:"))
|
||||||
self.int_label.setToolTip(
|
self.int_label.setToolTip(
|
||||||
_( "The number of digits for the integral part of the coordinates.")
|
_("The number of digits for the integral part of the coordinates.")
|
||||||
)
|
)
|
||||||
form_layout1.addRow(self.int_label, self.int_entry)
|
form_layout1.addRow(self.int_label, self.int_entry)
|
||||||
|
|
||||||
@ -283,18 +281,17 @@ class PcbWizard(FlatCAMTool):
|
|||||||
"""
|
"""
|
||||||
self.app.log.debug("on_load_excellon_click()")
|
self.app.log.debug("on_load_excellon_click()")
|
||||||
|
|
||||||
filter = "Excellon Files(*.DRL *.DRD *.TXT);;All Files (*.*)"
|
_filter = "Excellon Files(*.DRL *.DRD *.TXT);;All Files (*.*)"
|
||||||
try:
|
try:
|
||||||
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Load PcbWizard Excellon file"),
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Load PcbWizard Excellon file"),
|
||||||
directory=self.app.get_last_folder(),
|
directory=self.app.get_last_folder(),
|
||||||
filter=filter)
|
filter=_filter)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Load PcbWizard Excellon file"),
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Load PcbWizard Excellon file"),
|
||||||
filter=filter)
|
filter=_filter)
|
||||||
|
|
||||||
filename = str(filename)
|
filename = str(filename)
|
||||||
|
|
||||||
|
|
||||||
if filename == "":
|
if filename == "":
|
||||||
self.app.inform.emit(_("Open cancelled."))
|
self.app.inform.emit(_("Open cancelled."))
|
||||||
else:
|
else:
|
||||||
@ -307,14 +304,14 @@ class PcbWizard(FlatCAMTool):
|
|||||||
"""
|
"""
|
||||||
self.app.log.debug("on_load_inf_click()")
|
self.app.log.debug("on_load_inf_click()")
|
||||||
|
|
||||||
filter = "INF Files(*.INF);;All Files (*.*)"
|
_filter = "INF Files(*.INF);;All Files (*.*)"
|
||||||
try:
|
try:
|
||||||
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Load PcbWizard INF file"),
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Load PcbWizard INF file"),
|
||||||
directory=self.app.get_last_folder(),
|
directory=self.app.get_last_folder(),
|
||||||
filter=filter)
|
filter=_filter)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Load PcbWizard INF file"),
|
filename, _f = QtWidgets.QFileDialog.getOpenFileName(caption=_("Load PcbWizard INF file"),
|
||||||
filter=filter)
|
filter=_filter)
|
||||||
|
|
||||||
filename = str(filename)
|
filename = str(filename)
|
||||||
|
|
||||||
@ -338,7 +335,7 @@ class PcbWizard(FlatCAMTool):
|
|||||||
|
|
||||||
match = tool_re.search(eline)
|
match = tool_re.search(eline)
|
||||||
if match:
|
if match:
|
||||||
tool =int( match.group(1))
|
tool = int(match.group(1))
|
||||||
dia = float(match.group(2))
|
dia = float(match.group(2))
|
||||||
# if dia < 0.1:
|
# if dia < 0.1:
|
||||||
# # most likely the file is in INCH
|
# # most likely the file is in INCH
|
||||||
@ -396,7 +393,7 @@ class PcbWizard(FlatCAMTool):
|
|||||||
(str(self.app.version), str(self.app.version_date))
|
(str(self.app.version), str(self.app.version_date))
|
||||||
header += ';Created on : %s' % time_str + '\n'
|
header += ';Created on : %s' % time_str + '\n'
|
||||||
header += ';FILE_FORMAT={integral}:{fractional}\n'.format(integral=self.integral,
|
header += ';FILE_FORMAT={integral}:{fractional}\n'.format(integral=self.integral,
|
||||||
fractional=self.fractional)
|
fractional=self.fractional)
|
||||||
header += '{units},{zeros}\n'.format(units=self.units, zeros=self.zeros)
|
header += '{units},{zeros}\n'.format(units=self.units, zeros=self.zeros)
|
||||||
for k, v in self.tools_from_inf.items():
|
for k, v in self.tools_from_inf.items():
|
||||||
header += 'T{tool}C{dia}\n'.format(tool=int(k), dia=float(v))
|
header += 'T{tool}C{dia}\n'.format(tool=int(k), dia=float(v))
|
||||||
@ -425,7 +422,8 @@ class PcbWizard(FlatCAMTool):
|
|||||||
app_obj.log.debug("Could not import Excellon object.")
|
app_obj.log.debug("Could not import Excellon object.")
|
||||||
app_obj.progress.emit(0)
|
app_obj.progress.emit(0)
|
||||||
return "fail"
|
return "fail"
|
||||||
except:
|
except Exception as e:
|
||||||
|
app_obj.log.debug("PcbWizard.on_import_excellon().obj_init() %s" % str(e))
|
||||||
msg = _("[ERROR_NOTCL] An internal error has occurred. See shell.\n")
|
msg = _("[ERROR_NOTCL] An internal error has occurred. See shell.\n")
|
||||||
msg += app_obj.traceback.format_exc()
|
msg += app_obj.traceback.format_exc()
|
||||||
app_obj.inform.emit(msg)
|
app_obj.inform.emit(msg)
|
||||||
@ -449,8 +447,8 @@ class PcbWizard(FlatCAMTool):
|
|||||||
# Object name
|
# Object name
|
||||||
name = self.outname
|
name = self.outname
|
||||||
|
|
||||||
ret = self.app.new_object("excellon", name, obj_init, autoselected=False)
|
ret_val = self.app.new_object("excellon", name, obj_init, autoselected=False)
|
||||||
if ret == 'fail':
|
if ret_val == 'fail':
|
||||||
self.app.inform.emit(_('[ERROR_NOTCL] Import Excellon file failed.'))
|
self.app.inform.emit(_('[ERROR_NOTCL] Import Excellon file failed.'))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@ from FlatCAMObj import *
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class Properties(FlatCAMTool):
|
|||||||
self.properties_box.addWidget(title_label)
|
self.properties_box.addWidget(title_label)
|
||||||
|
|
||||||
# self.layout.setMargin(0) # PyQt4
|
# self.layout.setMargin(0) # PyQt4
|
||||||
self.properties_box.setContentsMargins(0, 0, 0, 0) # PyQt5
|
self.properties_box.setContentsMargins(0, 0, 0, 0) # PyQt5
|
||||||
|
|
||||||
self.vlay = QtWidgets.QVBoxLayout()
|
self.vlay = QtWidgets.QVBoxLayout()
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ class Properties(FlatCAMTool):
|
|||||||
self.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Expanding)
|
self.treeWidget.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
|
||||||
self.vlay.addWidget(self.treeWidget)
|
self.vlay.addWidget(self.treeWidget)
|
||||||
self.vlay.setStretch(0,0)
|
self.vlay.setStretch(0, 0)
|
||||||
|
|
||||||
def run(self, toggle=True):
|
def run(self, toggle=True):
|
||||||
self.app.report_usage("ToolProperties()")
|
self.app.report_usage("ToolProperties()")
|
||||||
@ -130,9 +130,14 @@ class Properties(FlatCAMTool):
|
|||||||
|
|
||||||
self.addChild(obj_type, ['Object Type:', ('%s' % (obj.kind.capitalize()))], True)
|
self.addChild(obj_type, ['Object Type:', ('%s' % (obj.kind.capitalize()))], True)
|
||||||
try:
|
try:
|
||||||
self.addChild(obj_type, ['Geo Type:', ('%s' % ({False: "Single-Geo", True: "Multi-Geo"}[obj.multigeo]))], True)
|
self.addChild(obj_type,
|
||||||
|
['Geo Type:',
|
||||||
|
('%s' % ({False: "Single-Geo", True: "Multi-Geo"}[obj.multigeo]))
|
||||||
|
],
|
||||||
|
True
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
log.debug("Properties.addItems() --> %s" % str(e))
|
||||||
|
|
||||||
self.addChild(obj_name, [obj.options['name']])
|
self.addChild(obj_name, [obj.options['name']])
|
||||||
|
|
||||||
@ -163,7 +168,10 @@ class Properties(FlatCAMTool):
|
|||||||
'in': 'Inch',
|
'in': 'Inch',
|
||||||
'mm': 'Metric'
|
'mm': 'Metric'
|
||||||
}
|
}
|
||||||
[str(self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().lower())]], True)
|
[str(self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().lower())]
|
||||||
|
],
|
||||||
|
True
|
||||||
|
)
|
||||||
|
|
||||||
for option in obj.options:
|
for option in obj.options:
|
||||||
if option is 'name':
|
if option is 'name':
|
||||||
|
@ -15,9 +15,9 @@ import html
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ from io import StringIO
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -66,11 +66,11 @@ class SolderPaste(FlatCAMTool):
|
|||||||
)
|
)
|
||||||
obj_form_layout.addRow(self.object_label, self.obj_combo)
|
obj_form_layout.addRow(self.object_label, self.obj_combo)
|
||||||
|
|
||||||
#### Tools ## ##
|
# ### Tools ## ##
|
||||||
self.tools_table_label = QtWidgets.QLabel('<b>%s</b>' % _('Tools Table'))
|
self.tools_table_label = QtWidgets.QLabel('<b>%s</b>' % _('Tools Table'))
|
||||||
self.tools_table_label.setToolTip(
|
self.tools_table_label.setToolTip(
|
||||||
_("Tools pool from which the algorithm\n"
|
_("Tools pool from which the algorithm\n"
|
||||||
"will pick the ones used for dispensing solder paste.")
|
"will pick the ones used for dispensing solder paste.")
|
||||||
)
|
)
|
||||||
self.layout.addWidget(self.tools_table_label)
|
self.layout.addWidget(self.tools_table_label)
|
||||||
|
|
||||||
@ -85,16 +85,16 @@ class SolderPaste(FlatCAMTool):
|
|||||||
|
|
||||||
self.tools_table.horizontalHeaderItem(0).setToolTip(
|
self.tools_table.horizontalHeaderItem(0).setToolTip(
|
||||||
_("This is the Tool Number.\n"
|
_("This is the Tool Number.\n"
|
||||||
"The solder dispensing will start with the tool with the biggest \n"
|
"The solder dispensing will start with the tool with the biggest \n"
|
||||||
"diameter, continuing until there are no more Nozzle tools.\n"
|
"diameter, continuing until there are no more Nozzle tools.\n"
|
||||||
"If there are no longer tools but there are still pads not covered\n "
|
"If there are no longer tools but there are still pads not covered\n "
|
||||||
"with solder paste, the app will issue a warning message box.")
|
"with solder paste, the app will issue a warning message box.")
|
||||||
)
|
)
|
||||||
self.tools_table.horizontalHeaderItem(1).setToolTip(
|
self.tools_table.horizontalHeaderItem(1).setToolTip(
|
||||||
_( "Nozzle tool Diameter. It's value (in current FlatCAM units)\n"
|
_("Nozzle tool Diameter. It's value (in current FlatCAM units)\n"
|
||||||
"is the width of the solder paste dispensed."))
|
"is the width of the solder paste dispensed."))
|
||||||
|
|
||||||
#### Add a new Tool ## ##
|
# ### Add a new Tool ## ##
|
||||||
hlay_tools = QtWidgets.QHBoxLayout()
|
hlay_tools = QtWidgets.QHBoxLayout()
|
||||||
self.layout.addLayout(hlay_tools)
|
self.layout.addLayout(hlay_tools)
|
||||||
|
|
||||||
@ -115,13 +115,13 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.addtool_btn = QtWidgets.QPushButton(_('Add'))
|
self.addtool_btn = QtWidgets.QPushButton(_('Add'))
|
||||||
self.addtool_btn.setToolTip(
|
self.addtool_btn.setToolTip(
|
||||||
_("Add a new nozzle tool to the Tool Table\n"
|
_("Add a new nozzle tool to the Tool Table\n"
|
||||||
"with the diameter specified above.")
|
"with the diameter specified above.")
|
||||||
)
|
)
|
||||||
|
|
||||||
self.deltool_btn = QtWidgets.QPushButton(_('Delete'))
|
self.deltool_btn = QtWidgets.QPushButton(_('Delete'))
|
||||||
self.deltool_btn.setToolTip(
|
self.deltool_btn.setToolTip(
|
||||||
_( "Delete a selection of tools in the Tool Table\n"
|
_("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.")
|
||||||
)
|
)
|
||||||
|
|
||||||
self.soldergeo_btn = QtWidgets.QPushButton(_("Generate Geo"))
|
self.soldergeo_btn = QtWidgets.QPushButton(_("Generate Geo"))
|
||||||
@ -142,10 +142,10 @@ class SolderPaste(FlatCAMTool):
|
|||||||
step1_lbl = QtWidgets.QLabel("<b>%s:</b>" % _('STEP 1:'))
|
step1_lbl = QtWidgets.QLabel("<b>%s:</b>" % _('STEP 1:'))
|
||||||
step1_lbl.setToolTip(
|
step1_lbl.setToolTip(
|
||||||
_("First step is to select a number of nozzle tools for usage\n"
|
_("First step is to select a number of nozzle tools for usage\n"
|
||||||
"and then optionally modify the GCode parameters bellow.")
|
"and then optionally modify the GCode parameters bellow.")
|
||||||
)
|
)
|
||||||
step1_description_lbl = QtWidgets.QLabel(_("Select tools.\n"
|
step1_description_lbl = QtWidgets.QLabel(_("Select tools.\n"
|
||||||
"Modify parameters."))
|
"Modify parameters."))
|
||||||
|
|
||||||
grid0_1.addWidget(step1_lbl, 0, 0, alignment=Qt.AlignTop)
|
grid0_1.addWidget(step1_lbl, 0, 0, alignment=Qt.AlignTop)
|
||||||
grid0_1.addWidget(step1_description_lbl, 0, 2, alignment=Qt.AlignBottom)
|
grid0_1.addWidget(step1_description_lbl, 0, 2, alignment=Qt.AlignBottom)
|
||||||
@ -174,7 +174,6 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.z_dispense_label = QtWidgets.QLabel(_("Z Dispense:"))
|
self.z_dispense_label = QtWidgets.QLabel(_("Z Dispense:"))
|
||||||
self.z_dispense_label.setToolTip(
|
self.z_dispense_label.setToolTip(
|
||||||
_("The height (Z) when doing solder paste dispensing.")
|
_("The height (Z) when doing solder paste dispensing.")
|
||||||
|
|
||||||
)
|
)
|
||||||
self.gcode_form_layout.addRow(self.z_dispense_label, self.z_dispense_entry)
|
self.gcode_form_layout.addRow(self.z_dispense_label, self.z_dispense_entry)
|
||||||
|
|
||||||
@ -190,8 +189,8 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.z_travel_entry = FCEntry()
|
self.z_travel_entry = FCEntry()
|
||||||
self.z_travel_label = QtWidgets.QLabel(_("Z Travel:"))
|
self.z_travel_label = QtWidgets.QLabel(_("Z Travel:"))
|
||||||
self.z_travel_label.setToolTip(
|
self.z_travel_label.setToolTip(
|
||||||
_( "The height (Z) for travel between pads\n"
|
_("The height (Z) for travel between pads\n"
|
||||||
"(without dispensing solder paste).")
|
"(without dispensing solder paste).")
|
||||||
)
|
)
|
||||||
self.gcode_form_layout.addRow(self.z_travel_label, self.z_travel_entry)
|
self.gcode_form_layout.addRow(self.z_travel_label, self.z_travel_entry)
|
||||||
|
|
||||||
@ -199,7 +198,7 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.z_toolchange_entry = FCEntry()
|
self.z_toolchange_entry = FCEntry()
|
||||||
self.z_toolchange_label = QtWidgets.QLabel(_("Z Toolchange:"))
|
self.z_toolchange_label = QtWidgets.QLabel(_("Z Toolchange:"))
|
||||||
self.z_toolchange_label.setToolTip(
|
self.z_toolchange_label.setToolTip(
|
||||||
_( "The height (Z) for tool (nozzle) change.")
|
_("The height (Z) for tool (nozzle) change.")
|
||||||
)
|
)
|
||||||
self.gcode_form_layout.addRow(self.z_toolchange_label, self.z_toolchange_entry)
|
self.gcode_form_layout.addRow(self.z_toolchange_label, self.z_toolchange_entry)
|
||||||
|
|
||||||
@ -208,7 +207,7 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.xy_toolchange_label = QtWidgets.QLabel(_("XY Toolchange:"))
|
self.xy_toolchange_label = QtWidgets.QLabel(_("XY Toolchange:"))
|
||||||
self.xy_toolchange_label.setToolTip(
|
self.xy_toolchange_label.setToolTip(
|
||||||
_("The X,Y location for tool (nozzle) change.\n"
|
_("The X,Y location for tool (nozzle) change.\n"
|
||||||
"The format is (x, y) where x and y are real numbers.")
|
"The format is (x, y) where x and y are real numbers.")
|
||||||
)
|
)
|
||||||
self.gcode_form_layout.addRow(self.xy_toolchange_label, self.xy_toolchange_entry)
|
self.gcode_form_layout.addRow(self.xy_toolchange_label, self.xy_toolchange_entry)
|
||||||
|
|
||||||
@ -216,7 +215,7 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.frxy_entry = FCEntry()
|
self.frxy_entry = FCEntry()
|
||||||
self.frxy_label = QtWidgets.QLabel(_("Feedrate X-Y:"))
|
self.frxy_label = QtWidgets.QLabel(_("Feedrate X-Y:"))
|
||||||
self.frxy_label.setToolTip(
|
self.frxy_label.setToolTip(
|
||||||
_( "Feedrate (speed) while moving on the X-Y plane.")
|
_("Feedrate (speed) while moving on the X-Y plane.")
|
||||||
)
|
)
|
||||||
self.gcode_form_layout.addRow(self.frxy_label, self.frxy_entry)
|
self.gcode_form_layout.addRow(self.frxy_label, self.frxy_entry)
|
||||||
|
|
||||||
@ -225,7 +224,7 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.frz_label = QtWidgets.QLabel(_("Feedrate Z:"))
|
self.frz_label = QtWidgets.QLabel(_("Feedrate Z:"))
|
||||||
self.frz_label.setToolTip(
|
self.frz_label.setToolTip(
|
||||||
_("Feedrate (speed) while moving vertically\n"
|
_("Feedrate (speed) while moving vertically\n"
|
||||||
"(on Z plane).")
|
"(on Z plane).")
|
||||||
)
|
)
|
||||||
self.gcode_form_layout.addRow(self.frz_label, self.frz_entry)
|
self.gcode_form_layout.addRow(self.frz_label, self.frz_entry)
|
||||||
|
|
||||||
@ -233,8 +232,8 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.frz_dispense_entry = FCEntry()
|
self.frz_dispense_entry = FCEntry()
|
||||||
self.frz_dispense_label = QtWidgets.QLabel(_("Feedrate Z Dispense:"))
|
self.frz_dispense_label = QtWidgets.QLabel(_("Feedrate Z Dispense:"))
|
||||||
self.frz_dispense_label.setToolTip(
|
self.frz_dispense_label.setToolTip(
|
||||||
_( "Feedrate (speed) while moving up vertically\n"
|
_("Feedrate (speed) while moving up vertically\n"
|
||||||
" to Dispense position (on Z plane).")
|
" to Dispense position (on Z plane).")
|
||||||
)
|
)
|
||||||
self.gcode_form_layout.addRow(self.frz_dispense_label, self.frz_dispense_entry)
|
self.gcode_form_layout.addRow(self.frz_dispense_label, self.frz_dispense_entry)
|
||||||
|
|
||||||
@ -242,8 +241,8 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.speedfwd_entry = FCEntry()
|
self.speedfwd_entry = FCEntry()
|
||||||
self.speedfwd_label = QtWidgets.QLabel(_("Spindle Speed FWD:"))
|
self.speedfwd_label = QtWidgets.QLabel(_("Spindle Speed FWD:"))
|
||||||
self.speedfwd_label.setToolTip(
|
self.speedfwd_label.setToolTip(
|
||||||
_( "The dispenser speed while pushing solder paste\n"
|
_("The dispenser speed while pushing solder paste\n"
|
||||||
"through the dispenser nozzle.")
|
"through the dispenser nozzle.")
|
||||||
)
|
)
|
||||||
self.gcode_form_layout.addRow(self.speedfwd_label, self.speedfwd_entry)
|
self.gcode_form_layout.addRow(self.speedfwd_label, self.speedfwd_entry)
|
||||||
|
|
||||||
@ -259,8 +258,8 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.speedrev_entry = FCEntry()
|
self.speedrev_entry = FCEntry()
|
||||||
self.speedrev_label = QtWidgets.QLabel(_("Spindle Speed REV:"))
|
self.speedrev_label = QtWidgets.QLabel(_("Spindle Speed REV:"))
|
||||||
self.speedrev_label.setToolTip(
|
self.speedrev_label.setToolTip(
|
||||||
_( "The dispenser speed while retracting solder paste\n"
|
_("The dispenser speed while retracting solder paste\n"
|
||||||
"through the dispenser nozzle.")
|
"through the dispenser nozzle.")
|
||||||
)
|
)
|
||||||
self.gcode_form_layout.addRow(self.speedrev_label, self.speedrev_entry)
|
self.gcode_form_layout.addRow(self.speedrev_label, self.speedrev_entry)
|
||||||
|
|
||||||
@ -269,7 +268,7 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.dwellrev_label = QtWidgets.QLabel(_("Dwell REV:"))
|
self.dwellrev_label = QtWidgets.QLabel(_("Dwell REV:"))
|
||||||
self.dwellrev_label.setToolTip(
|
self.dwellrev_label.setToolTip(
|
||||||
_("Pause after solder paste dispenser retracted,\n"
|
_("Pause after solder paste dispenser retracted,\n"
|
||||||
"to allow pressure equilibrium.")
|
"to allow pressure equilibrium.")
|
||||||
)
|
)
|
||||||
self.gcode_form_layout.addRow(self.dwellrev_label, self.dwellrev_entry)
|
self.gcode_form_layout.addRow(self.dwellrev_label, self.dwellrev_entry)
|
||||||
|
|
||||||
@ -289,8 +288,8 @@ class SolderPaste(FlatCAMTool):
|
|||||||
|
|
||||||
self.solder_gcode_btn = QtWidgets.QPushButton(_("Generate GCode"))
|
self.solder_gcode_btn = QtWidgets.QPushButton(_("Generate GCode"))
|
||||||
self.solder_gcode_btn.setToolTip(
|
self.solder_gcode_btn.setToolTip(
|
||||||
_( "Generate GCode for Solder Paste dispensing\n"
|
_("Generate GCode for Solder Paste dispensing\n"
|
||||||
"on PCB pads.")
|
"on PCB pads.")
|
||||||
)
|
)
|
||||||
|
|
||||||
self.generation_frame = QtWidgets.QFrame()
|
self.generation_frame = QtWidgets.QFrame()
|
||||||
@ -300,7 +299,6 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.generation_box.setContentsMargins(0, 0, 0, 0)
|
self.generation_box.setContentsMargins(0, 0, 0, 0)
|
||||||
self.generation_frame.setLayout(self.generation_box)
|
self.generation_frame.setLayout(self.generation_box)
|
||||||
|
|
||||||
|
|
||||||
# ## Buttons
|
# ## Buttons
|
||||||
grid2 = QtWidgets.QGridLayout()
|
grid2 = QtWidgets.QGridLayout()
|
||||||
self.generation_box.addLayout(grid2)
|
self.generation_box.addLayout(grid2)
|
||||||
@ -308,7 +306,7 @@ class SolderPaste(FlatCAMTool):
|
|||||||
step2_lbl = QtWidgets.QLabel("<b>%s</b>" % _('STEP 2:'))
|
step2_lbl = QtWidgets.QLabel("<b>%s</b>" % _('STEP 2:'))
|
||||||
step2_lbl.setToolTip(
|
step2_lbl.setToolTip(
|
||||||
_("Second step is to create a solder paste dispensing\n"
|
_("Second step is to create a solder paste dispensing\n"
|
||||||
"geometry out of an Solder Paste Mask Gerber file.")
|
"geometry out of an Solder Paste Mask Gerber file.")
|
||||||
)
|
)
|
||||||
grid2.addWidget(step2_lbl, 0, 0)
|
grid2.addWidget(step2_lbl, 0, 0)
|
||||||
grid2.addWidget(self.soldergeo_btn, 0, 2)
|
grid2.addWidget(self.soldergeo_btn, 0, 2)
|
||||||
@ -325,9 +323,9 @@ class SolderPaste(FlatCAMTool):
|
|||||||
|
|
||||||
self.geo_object_label = QtWidgets.QLabel(_("Geo Result:"))
|
self.geo_object_label = QtWidgets.QLabel(_("Geo Result:"))
|
||||||
self.geo_object_label.setToolTip(
|
self.geo_object_label.setToolTip(
|
||||||
_( "Geometry Solder Paste object.\n"
|
_("Geometry Solder Paste object.\n"
|
||||||
"The name of the object has to end in:\n"
|
"The name of the object has to end in:\n"
|
||||||
"'_solderpaste' as a protection.")
|
"'_solderpaste' as a protection.")
|
||||||
)
|
)
|
||||||
geo_form_layout.addRow(self.geo_object_label, self.geo_obj_combo)
|
geo_form_layout.addRow(self.geo_object_label, self.geo_obj_combo)
|
||||||
|
|
||||||
@ -336,11 +334,11 @@ class SolderPaste(FlatCAMTool):
|
|||||||
|
|
||||||
step3_lbl = QtWidgets.QLabel("<b>%s</b>" % _('STEP 3:'))
|
step3_lbl = QtWidgets.QLabel("<b>%s</b>" % _('STEP 3:'))
|
||||||
step3_lbl.setToolTip(
|
step3_lbl.setToolTip(
|
||||||
_( "Third step is to select a solder paste dispensing geometry,\n"
|
_("Third step is to select a solder paste dispensing geometry,\n"
|
||||||
"and then generate a CNCJob object.\n\n"
|
"and then generate a CNCJob object.\n\n"
|
||||||
"REMEMBER: if you want to create a CNCJob with new parameters,\n"
|
"REMEMBER: if you want to create a CNCJob with new parameters,\n"
|
||||||
"first you need to generate a geometry with those new params,\n"
|
"first you need to generate a geometry with those new params,\n"
|
||||||
"and only after that you can generate an updated CNCJob.")
|
"and only after that you can generate an updated CNCJob.")
|
||||||
)
|
)
|
||||||
|
|
||||||
grid3.addWidget(step3_lbl, 0, 0)
|
grid3.addWidget(step3_lbl, 0, 0)
|
||||||
@ -358,10 +356,10 @@ class SolderPaste(FlatCAMTool):
|
|||||||
|
|
||||||
self.cnc_object_label = QtWidgets.QLabel(_("CNC Result:"))
|
self.cnc_object_label = QtWidgets.QLabel(_("CNC Result:"))
|
||||||
self.cnc_object_label.setToolTip(
|
self.cnc_object_label.setToolTip(
|
||||||
_( "CNCJob Solder paste object.\n"
|
_("CNCJob Solder paste object.\n"
|
||||||
"In order to enable the GCode save section,\n"
|
"In order to enable the GCode save section,\n"
|
||||||
"the name of the object has to end in:\n"
|
"the name of the object has to end in:\n"
|
||||||
"'_solderpaste' as a protection.")
|
"'_solderpaste' as a protection.")
|
||||||
)
|
)
|
||||||
cnc_form_layout.addRow(self.cnc_object_label, self.cnc_obj_combo)
|
cnc_form_layout.addRow(self.cnc_object_label, self.cnc_obj_combo)
|
||||||
|
|
||||||
@ -371,19 +369,19 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.solder_gcode_view_btn = QtWidgets.QPushButton(_("View GCode"))
|
self.solder_gcode_view_btn = QtWidgets.QPushButton(_("View GCode"))
|
||||||
self.solder_gcode_view_btn.setToolTip(
|
self.solder_gcode_view_btn.setToolTip(
|
||||||
_("View the generated GCode for Solder Paste dispensing\n"
|
_("View the generated GCode for Solder Paste dispensing\n"
|
||||||
"on PCB pads.")
|
"on PCB pads.")
|
||||||
)
|
)
|
||||||
|
|
||||||
self.solder_gcode_save_btn = QtWidgets.QPushButton(_("Save GCode"))
|
self.solder_gcode_save_btn = QtWidgets.QPushButton(_("Save GCode"))
|
||||||
self.solder_gcode_save_btn.setToolTip(
|
self.solder_gcode_save_btn.setToolTip(
|
||||||
_( "Save the generated GCode for Solder Paste dispensing\n"
|
_("Save the generated GCode for Solder Paste dispensing\n"
|
||||||
"on PCB pads, to a file.")
|
"on PCB pads, to a file.")
|
||||||
)
|
)
|
||||||
|
|
||||||
step4_lbl = QtWidgets.QLabel("<b>%s</b>" % _('STEP 4:'))
|
step4_lbl = QtWidgets.QLabel("<b>%s</b>" % _('STEP 4:'))
|
||||||
step4_lbl.setToolTip(
|
step4_lbl.setToolTip(
|
||||||
_( "Fourth step (and last) is to select a CNCJob made from \n"
|
_("Fourth step (and last) is to select a CNCJob made from \n"
|
||||||
"a solder paste dispensing geometry, and then view/save it's GCode.")
|
"a solder paste dispensing geometry, and then view/save it's GCode.")
|
||||||
)
|
)
|
||||||
|
|
||||||
grid4.addWidget(step4_lbl, 0, 0)
|
grid4.addWidget(step4_lbl, 0, 0)
|
||||||
@ -402,6 +400,7 @@ class SolderPaste(FlatCAMTool):
|
|||||||
self.form_fields = {}
|
self.form_fields = {}
|
||||||
|
|
||||||
self.units = ''
|
self.units = ''
|
||||||
|
self.name = ""
|
||||||
|
|
||||||
# this will be used in the combobox context menu, for delete entry
|
# this will be used in the combobox context menu, for delete entry
|
||||||
self.obj_to_be_deleted_name = ''
|
self.obj_to_be_deleted_name = ''
|
||||||
@ -607,7 +606,6 @@ class SolderPaste(FlatCAMTool):
|
|||||||
if current_row < 0:
|
if current_row < 0:
|
||||||
current_row = 0
|
current_row = 0
|
||||||
|
|
||||||
|
|
||||||
# populate the form with the data from the tool associated with the row parameter
|
# populate the form with the data from the tool associated with the row parameter
|
||||||
try:
|
try:
|
||||||
tooluid = int(self.tools_table.item(current_row, 2).text())
|
tooluid = int(self.tools_table.item(current_row, 2).text())
|
||||||
@ -754,7 +752,7 @@ class SolderPaste(FlatCAMTool):
|
|||||||
tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
|
tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
|
||||||
"use a number."))
|
"use a number."))
|
||||||
return
|
return
|
||||||
if tool_dia is None:
|
if tool_dia is None:
|
||||||
self.build_ui()
|
self.build_ui()
|
||||||
@ -762,7 +760,8 @@ class SolderPaste(FlatCAMTool):
|
|||||||
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.tooltable_tools
|
# construct a list of all 'tooluid' in the self.tooltable_tools
|
||||||
@ -825,7 +824,7 @@ class SolderPaste(FlatCAMTool):
|
|||||||
new_tool_dia = float(self.tools_table.item(row, 1).text().replace(',', '.'))
|
new_tool_dia = float(self.tools_table.item(row, 1).text().replace(',', '.'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
|
||||||
"use a number."))
|
"use a number."))
|
||||||
return
|
return
|
||||||
|
|
||||||
tooluid = int(self.tools_table.item(row, 2).text())
|
tooluid = int(self.tools_table.item(row, 2).text())
|
||||||
@ -844,7 +843,8 @@ class SolderPaste(FlatCAMTool):
|
|||||||
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):
|
||||||
@ -964,6 +964,7 @@ class SolderPaste(FlatCAMTool):
|
|||||||
|
|
||||||
:param name: the outname for the resulting geometry object
|
:param name: the outname for the resulting geometry object
|
||||||
:param work_object: the source Gerber object from which the geometry is created
|
:param work_object: the source Gerber object from which the geometry is created
|
||||||
|
:param use_thread: use thread, True or False
|
||||||
:return: a Geometry type object
|
:return: a Geometry type object
|
||||||
"""
|
"""
|
||||||
proc = self.app.proc_container.new(_("Creating Solder Paste dispensing geometry."))
|
proc = self.app.proc_container.new(_("Creating Solder Paste dispensing geometry."))
|
||||||
@ -1030,8 +1031,8 @@ class SolderPaste(FlatCAMTool):
|
|||||||
|
|
||||||
for tool in sorted_tools:
|
for tool in sorted_tools:
|
||||||
offset = tool / 2
|
offset = tool / 2
|
||||||
for uid, v in self.tooltable_tools.items():
|
for uid, vl in self.tooltable_tools.items():
|
||||||
if float('%.4f' % float(v['tooldia'])) == tool:
|
if float('%.4f' % float(vl['tooldia'])) == tool:
|
||||||
tooluid = int(uid)
|
tooluid = int(uid)
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -1064,19 +1065,19 @@ class SolderPaste(FlatCAMTool):
|
|||||||
round_diag_2 = round(diag_2_intersect.length, 2)
|
round_diag_2 = round(diag_2_intersect.length, 2)
|
||||||
|
|
||||||
if round_diag_1 == round_diag_2:
|
if round_diag_1 == round_diag_2:
|
||||||
l = distance((x_min, y_min), (x_max, y_min))
|
length = distance((x_min, y_min), (x_max, y_min))
|
||||||
h = distance((x_min, y_min), (x_min, y_max))
|
h = distance((x_min, y_min), (x_min, y_max))
|
||||||
|
|
||||||
if offset >= l / 2 or offset >= h / 2:
|
if offset >= length / 2 or offset >= h / 2:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if l > h:
|
if length > h:
|
||||||
h_half = h / 2
|
h_half = h / 2
|
||||||
start = [x_min, (y_min + h_half)]
|
start = [x_min, (y_min + h_half)]
|
||||||
stop = [(x_min + l), (y_min + h_half)]
|
stop = [(x_min + length), (y_min + h_half)]
|
||||||
geo = LineString([start, stop])
|
geo = LineString([start, stop])
|
||||||
else:
|
else:
|
||||||
l_half = l / 2
|
l_half = length / 2
|
||||||
start = [(x_min + l_half), y_min]
|
start = [(x_min + l_half), y_min]
|
||||||
stop = [(x_min + l_half), (y_min + h)]
|
stop = [(x_min + l_half), (y_min + h)]
|
||||||
geo = LineString([start, stop])
|
geo = LineString([start, stop])
|
||||||
@ -1151,7 +1152,8 @@ class SolderPaste(FlatCAMTool):
|
|||||||
return 'fail'
|
return 'fail'
|
||||||
|
|
||||||
if obj.special_group != 'solder_paste_tool':
|
if obj.special_group != 'solder_paste_tool':
|
||||||
self.app.inform.emit(_("[WARNING_NOTCL] This Geometry can't be processed. NOT a solder_paste_tool geometry."))
|
self.app.inform.emit(_("[WARNING_NOTCL] This Geometry can't be processed. "
|
||||||
|
"NOT a solder_paste_tool geometry."))
|
||||||
return 'fail'
|
return 'fail'
|
||||||
|
|
||||||
a = 0
|
a = 0
|
||||||
@ -1314,7 +1316,8 @@ class SolderPaste(FlatCAMTool):
|
|||||||
# then append the text from GCode to the text editor
|
# then append the text from GCode to the text editor
|
||||||
try:
|
try:
|
||||||
lines = StringIO(gcode)
|
lines = StringIO(gcode)
|
||||||
except:
|
except Exception as e:
|
||||||
|
log.debug("ToolSolderpaste.on_view_gcode() --> %s" % str(e))
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] No Gcode in the object..."))
|
self.app.inform.emit(_("[ERROR_NOTCL] No Gcode in the object..."))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -155,7 +155,6 @@ class ToolSub(FlatCAMTool):
|
|||||||
self.sub_follow_union = None
|
self.sub_follow_union = None
|
||||||
self.sub_clear_union = None
|
self.sub_clear_union = None
|
||||||
|
|
||||||
|
|
||||||
self.sub_grb_obj = None
|
self.sub_grb_obj = None
|
||||||
self.sub_grb_obj_name = None
|
self.sub_grb_obj_name = None
|
||||||
self.target_grb_obj = None
|
self.target_grb_obj = None
|
||||||
@ -172,16 +171,18 @@ class ToolSub(FlatCAMTool):
|
|||||||
# store here the options from target_obj
|
# store here the options from target_obj
|
||||||
self.target_options = {}
|
self.target_options = {}
|
||||||
|
|
||||||
|
self.sub_union = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.intersect_btn.clicked.disconnect(self.on_grb_intersection_click)
|
self.intersect_btn.clicked.disconnect(self.on_grb_intersection_click)
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
log.debug("ToolSub.__init__() --> %s" % str(e))
|
||||||
self.intersect_btn.clicked.connect(self.on_grb_intersection_click)
|
self.intersect_btn.clicked.connect(self.on_grb_intersection_click)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.intersect_geo_btn.clicked.disconnect()
|
self.intersect_geo_btn.clicked.disconnect()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
log.debug("ToolSub.__init__() --> %s" % str(e))
|
||||||
self.intersect_geo_btn.clicked.connect(self.on_geo_intersection_click)
|
self.intersect_geo_btn.clicked.connect(self.on_geo_intersection_click)
|
||||||
|
|
||||||
def install(self, icon=None, separator=None, **kwargs):
|
def install(self, icon=None, separator=None, **kwargs):
|
||||||
@ -233,7 +234,8 @@ class ToolSub(FlatCAMTool):
|
|||||||
# Get source object.
|
# Get source object.
|
||||||
try:
|
try:
|
||||||
self.target_grb_obj = self.app.collection.get_by_name(self.target_grb_obj_name)
|
self.target_grb_obj = self.app.collection.get_by_name(self.target_grb_obj_name)
|
||||||
except:
|
except Exception as e:
|
||||||
|
log.debug("ToolSub.on_grb_intersection_click() --> %s" % str(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.target_grb_obj_name
|
return "Could not retrieve object: %s" % self.target_grb_obj_name
|
||||||
|
|
||||||
@ -245,7 +247,8 @@ class ToolSub(FlatCAMTool):
|
|||||||
# Get source object.
|
# Get source object.
|
||||||
try:
|
try:
|
||||||
self.sub_grb_obj = self.app.collection.get_by_name(self.sub_grb_obj_name)
|
self.sub_grb_obj = self.app.collection.get_by_name(self.sub_grb_obj_name)
|
||||||
except:
|
except Exception as e:
|
||||||
|
log.debug("ToolSub.on_grb_intersection_click() --> %s" % str(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.sub_grb_obj_name
|
return "Could not retrieve object: %s" % self.sub_grb_obj_name
|
||||||
|
|
||||||
@ -424,7 +427,8 @@ class ToolSub(FlatCAMTool):
|
|||||||
# Get source object.
|
# Get source object.
|
||||||
try:
|
try:
|
||||||
self.target_geo_obj = self.app.collection.get_by_name(self.target_geo_obj_name)
|
self.target_geo_obj = self.app.collection.get_by_name(self.target_geo_obj_name)
|
||||||
except:
|
except Exception as e:
|
||||||
|
log.debug("ToolSub.on_geo_intersection_click() --> %s" % str(e))
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.target_geo_obj_name)
|
self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.target_geo_obj_name)
|
||||||
return "Could not retrieve object: %s" % self.target_grb_obj_name
|
return "Could not retrieve object: %s" % self.target_grb_obj_name
|
||||||
|
|
||||||
@ -436,7 +440,8 @@ class ToolSub(FlatCAMTool):
|
|||||||
# Get source object.
|
# Get source object.
|
||||||
try:
|
try:
|
||||||
self.sub_geo_obj = self.app.collection.get_by_name(self.sub_geo_obj_name)
|
self.sub_geo_obj = self.app.collection.get_by_name(self.sub_geo_obj_name)
|
||||||
except:
|
except Exception as e:
|
||||||
|
log.debug("ToolSub.on_geo_intersection_click() --> %s" % str(e))
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.sub_geo_obj_name)
|
self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.sub_geo_obj_name)
|
||||||
return "Could not retrieve object: %s" % self.sub_geo_obj_name
|
return "Could not retrieve object: %s" % self.sub_geo_obj_name
|
||||||
|
|
||||||
@ -533,8 +538,8 @@ class ToolSub(FlatCAMTool):
|
|||||||
geo_obj.tools = deepcopy(self.new_tools)
|
geo_obj.tools = deepcopy(self.new_tools)
|
||||||
for tool in geo_obj.tools:
|
for tool in geo_obj.tools:
|
||||||
geo_obj.tools[tool]['solid_geometry'] = deepcopy(self.new_solid_geometry)
|
geo_obj.tools[tool]['solid_geometry'] = deepcopy(self.new_solid_geometry)
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
log.debug("ToolSub.new_geo_object() --> %s" % str(e))
|
||||||
|
|
||||||
with self.app.proc_container.new(_("Generating new object ...")):
|
with self.app.proc_container.new(_("Generating new object ...")):
|
||||||
ret = self.app.new_object('geometry', outname, obj_init, autoselected=False)
|
ret = self.app.new_object('geometry', outname, obj_init, autoselected=False)
|
||||||
@ -584,7 +589,6 @@ class ToolSub(FlatCAMTool):
|
|||||||
"""
|
"""
|
||||||
# log.debug("checking parsing --> %s" % str(self.parsing_promises))
|
# log.debug("checking parsing --> %s" % str(self.parsing_promises))
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not self.promises:
|
if not self.promises:
|
||||||
self.check_thread.stop()
|
self.check_thread.stop()
|
||||||
@ -614,4 +618,6 @@ class ToolSub(FlatCAMTool):
|
|||||||
self.sub_gerber_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
self.sub_gerber_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
||||||
|
|
||||||
self.target_geo_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
|
self.target_geo_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
|
||||||
self.sub_geo_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
|
self.sub_geo_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
|
||||||
|
|
||||||
|
# end of file
|
||||||
|
@ -11,9 +11,9 @@ from FlatCAMObj import *
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -68,9 +68,9 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.rotate_label = QtWidgets.QLabel(_("Angle:"))
|
self.rotate_label = QtWidgets.QLabel(_("Angle:"))
|
||||||
self.rotate_label.setToolTip(
|
self.rotate_label.setToolTip(
|
||||||
_("Angle for Rotation action, in degrees.\n"
|
_("Angle for Rotation action, in degrees.\n"
|
||||||
"Float number between -360 and 359.\n"
|
"Float number between -360 and 359.\n"
|
||||||
"Positive numbers for CW motion.\n"
|
"Positive numbers for CW motion.\n"
|
||||||
"Negative numbers for CCW motion.")
|
"Negative numbers for CCW motion.")
|
||||||
)
|
)
|
||||||
self.rotate_label.setFixedWidth(70)
|
self.rotate_label.setFixedWidth(70)
|
||||||
|
|
||||||
@ -82,8 +82,8 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.rotate_button.set_value(_("Rotate"))
|
self.rotate_button.set_value(_("Rotate"))
|
||||||
self.rotate_button.setToolTip(
|
self.rotate_button.setToolTip(
|
||||||
_("Rotate the selected object(s).\n"
|
_("Rotate the selected object(s).\n"
|
||||||
"The point of reference is the middle of\n"
|
"The point of reference is the middle of\n"
|
||||||
"the bounding box for all selected objects.")
|
"the bounding box for all selected objects.")
|
||||||
)
|
)
|
||||||
self.rotate_button.setFixedWidth(90)
|
self.rotate_button.setFixedWidth(90)
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.skewx_label = QtWidgets.QLabel(_("Angle X:"))
|
self.skewx_label = QtWidgets.QLabel(_("Angle X:"))
|
||||||
self.skewx_label.setToolTip(
|
self.skewx_label.setToolTip(
|
||||||
_("Angle for Skew action, in degrees.\n"
|
_("Angle for Skew action, in degrees.\n"
|
||||||
"Float number between -360 and 359.")
|
"Float number between -360 and 359.")
|
||||||
)
|
)
|
||||||
self.skewx_label.setFixedWidth(70)
|
self.skewx_label.setFixedWidth(70)
|
||||||
self.skewx_entry = FCEntry()
|
self.skewx_entry = FCEntry()
|
||||||
@ -118,14 +118,14 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.skewx_button.set_value(_("Skew X"))
|
self.skewx_button.set_value(_("Skew X"))
|
||||||
self.skewx_button.setToolTip(
|
self.skewx_button.setToolTip(
|
||||||
_("Skew/shear the selected object(s).\n"
|
_("Skew/shear the selected object(s).\n"
|
||||||
"The point of reference is the middle of\n"
|
"The point of reference is the middle of\n"
|
||||||
"the bounding box for all selected objects."))
|
"the bounding box for all selected objects."))
|
||||||
self.skewx_button.setFixedWidth(90)
|
self.skewx_button.setFixedWidth(90)
|
||||||
|
|
||||||
self.skewy_label = QtWidgets.QLabel(_("Angle Y:"))
|
self.skewy_label = QtWidgets.QLabel(_("Angle Y:"))
|
||||||
self.skewy_label.setToolTip(
|
self.skewy_label.setToolTip(
|
||||||
_("Angle for Skew action, in degrees.\n"
|
_("Angle for Skew action, in degrees.\n"
|
||||||
"Float number between -360 and 359.")
|
"Float number between -360 and 359.")
|
||||||
)
|
)
|
||||||
self.skewy_label.setFixedWidth(70)
|
self.skewy_label.setFixedWidth(70)
|
||||||
self.skewy_entry = FCEntry()
|
self.skewy_entry = FCEntry()
|
||||||
@ -136,8 +136,8 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.skewy_button.set_value(_("Skew Y"))
|
self.skewy_button.set_value(_("Skew Y"))
|
||||||
self.skewy_button.setToolTip(
|
self.skewy_button.setToolTip(
|
||||||
_("Skew/shear the selected object(s).\n"
|
_("Skew/shear the selected object(s).\n"
|
||||||
"The point of reference is the middle of\n"
|
"The point of reference is the middle of\n"
|
||||||
"the bounding box for all selected objects."))
|
"the bounding box for all selected objects."))
|
||||||
self.skewy_button.setFixedWidth(90)
|
self.skewy_button.setFixedWidth(90)
|
||||||
|
|
||||||
form1_child_1.addWidget(self.skewx_entry)
|
form1_child_1.addWidget(self.skewx_entry)
|
||||||
@ -174,8 +174,8 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.scalex_button.set_value(_("Scale X"))
|
self.scalex_button.set_value(_("Scale X"))
|
||||||
self.scalex_button.setToolTip(
|
self.scalex_button.setToolTip(
|
||||||
_("Scale the selected object(s).\n"
|
_("Scale the selected object(s).\n"
|
||||||
"The point of reference depends on \n"
|
"The point of reference depends on \n"
|
||||||
"the Scale reference checkbox state."))
|
"the Scale reference checkbox state."))
|
||||||
self.scalex_button.setFixedWidth(90)
|
self.scalex_button.setFixedWidth(90)
|
||||||
|
|
||||||
self.scaley_label = QtWidgets.QLabel(_("Factor Y:"))
|
self.scaley_label = QtWidgets.QLabel(_("Factor Y:"))
|
||||||
@ -191,8 +191,8 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.scaley_button.set_value(_("Scale Y"))
|
self.scaley_button.set_value(_("Scale Y"))
|
||||||
self.scaley_button.setToolTip(
|
self.scaley_button.setToolTip(
|
||||||
_("Scale the selected object(s).\n"
|
_("Scale the selected object(s).\n"
|
||||||
"The point of reference depends on \n"
|
"The point of reference depends on \n"
|
||||||
"the Scale reference checkbox state."))
|
"the Scale reference checkbox state."))
|
||||||
self.scaley_button.setFixedWidth(90)
|
self.scaley_button.setFixedWidth(90)
|
||||||
|
|
||||||
self.scale_link_cb = FCCheckBox()
|
self.scale_link_cb = FCCheckBox()
|
||||||
@ -200,7 +200,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.scale_link_cb.setText(_("Link"))
|
self.scale_link_cb.setText(_("Link"))
|
||||||
self.scale_link_cb.setToolTip(
|
self.scale_link_cb.setToolTip(
|
||||||
_("Scale the selected object(s)\n"
|
_("Scale the selected object(s)\n"
|
||||||
"using the Scale Factor X for both axis."))
|
"using the Scale Factor X for both axis."))
|
||||||
self.scale_link_cb.setFixedWidth(70)
|
self.scale_link_cb.setFixedWidth(70)
|
||||||
|
|
||||||
self.scale_zero_ref_cb = FCCheckBox()
|
self.scale_zero_ref_cb = FCCheckBox()
|
||||||
@ -208,9 +208,9 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.scale_zero_ref_cb.setText(_("Scale Reference"))
|
self.scale_zero_ref_cb.setText(_("Scale Reference"))
|
||||||
self.scale_zero_ref_cb.setToolTip(
|
self.scale_zero_ref_cb.setToolTip(
|
||||||
_("Scale the selected object(s)\n"
|
_("Scale the selected object(s)\n"
|
||||||
"using the origin reference when checked,\n"
|
"using the origin reference when checked,\n"
|
||||||
"and the center of the biggest bounding box\n"
|
"and the center of the biggest bounding box\n"
|
||||||
"of the selected objects when unchecked."))
|
"of the selected objects when unchecked."))
|
||||||
|
|
||||||
form2_child_1.addWidget(self.scalex_entry)
|
form2_child_1.addWidget(self.scalex_entry)
|
||||||
form2_child_1.addWidget(self.scalex_button)
|
form2_child_1.addWidget(self.scalex_button)
|
||||||
@ -248,8 +248,8 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.offx_button.set_value(_("Offset X"))
|
self.offx_button.set_value(_("Offset X"))
|
||||||
self.offx_button.setToolTip(
|
self.offx_button.setToolTip(
|
||||||
_("Offset the selected object(s).\n"
|
_("Offset the selected object(s).\n"
|
||||||
"The point of reference is the middle of\n"
|
"The point of reference is the middle of\n"
|
||||||
"the bounding box for all selected objects.\n"))
|
"the bounding box for all selected objects.\n"))
|
||||||
self.offx_button.setFixedWidth(90)
|
self.offx_button.setFixedWidth(90)
|
||||||
|
|
||||||
self.offy_label = QtWidgets.QLabel(_("Value Y:"))
|
self.offy_label = QtWidgets.QLabel(_("Value Y:"))
|
||||||
@ -265,8 +265,8 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.offy_button.set_value(_("Offset Y"))
|
self.offy_button.set_value(_("Offset Y"))
|
||||||
self.offy_button.setToolTip(
|
self.offy_button.setToolTip(
|
||||||
_("Offset the selected object(s).\n"
|
_("Offset the selected object(s).\n"
|
||||||
"The point of reference is the middle of\n"
|
"The point of reference is the middle of\n"
|
||||||
"the bounding box for all selected objects.\n"))
|
"the bounding box for all selected objects.\n"))
|
||||||
self.offy_button.setFixedWidth(90)
|
self.offy_button.setFixedWidth(90)
|
||||||
|
|
||||||
form3_child_1.addWidget(self.offx_entry)
|
form3_child_1.addWidget(self.offx_entry)
|
||||||
@ -295,7 +295,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.flipx_button.set_value(_("Flip on X"))
|
self.flipx_button.set_value(_("Flip on X"))
|
||||||
self.flipx_button.setToolTip(
|
self.flipx_button.setToolTip(
|
||||||
_("Flip the selected object(s) over the X axis.\n"
|
_("Flip the selected object(s) over the X axis.\n"
|
||||||
"Does not create a new object.\n ")
|
"Does not create a new object.\n ")
|
||||||
)
|
)
|
||||||
self.flipx_button.setFixedWidth(100)
|
self.flipx_button.setFixedWidth(100)
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.flipy_button.set_value(_("Flip on Y"))
|
self.flipy_button.set_value(_("Flip on Y"))
|
||||||
self.flipy_button.setToolTip(
|
self.flipy_button.setToolTip(
|
||||||
_("Flip the selected object(s) over the X axis.\n"
|
_("Flip the selected object(s) over the X axis.\n"
|
||||||
"Does not create a new object.\n ")
|
"Does not create a new object.\n ")
|
||||||
)
|
)
|
||||||
self.flipy_button.setFixedWidth(90)
|
self.flipy_button.setFixedWidth(90)
|
||||||
|
|
||||||
@ -312,21 +312,21 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.flip_ref_cb.setText(_("Ref Pt"))
|
self.flip_ref_cb.setText(_("Ref Pt"))
|
||||||
self.flip_ref_cb.setToolTip(
|
self.flip_ref_cb.setToolTip(
|
||||||
_("Flip the selected object(s)\n"
|
_("Flip the selected object(s)\n"
|
||||||
"around the point in Point Entry Field.\n"
|
"around the point in Point Entry Field.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"The point coordinates can be captured by\n"
|
"The point coordinates can be captured by\n"
|
||||||
"left click on canvas together with pressing\n"
|
"left click on canvas together with pressing\n"
|
||||||
"SHIFT key. \n"
|
"SHIFT key. \n"
|
||||||
"Then click Add button to insert coordinates.\n"
|
"Then click Add button to insert coordinates.\n"
|
||||||
"Or enter the coords in format (x, y) in the\n"
|
"Or enter the coords in format (x, y) in the\n"
|
||||||
"Point Entry field and click Flip on X(Y)"))
|
"Point Entry field and click Flip on X(Y)"))
|
||||||
self.flip_ref_cb.setFixedWidth(70)
|
self.flip_ref_cb.setFixedWidth(70)
|
||||||
|
|
||||||
self.flip_ref_label = QtWidgets.QLabel(_("Point:"))
|
self.flip_ref_label = QtWidgets.QLabel(_("Point:"))
|
||||||
self.flip_ref_label.setToolTip(
|
self.flip_ref_label.setToolTip(
|
||||||
_("Coordinates in format (x, y) used as reference for mirroring.\n"
|
_("Coordinates in format (x, y) used as reference for mirroring.\n"
|
||||||
"The 'x' in (x, y) will be used when using Flip on X and\n"
|
"The 'x' in (x, y) will be used when using Flip on X and\n"
|
||||||
"the 'y' in (x, y) will be used when using Flip on Y and")
|
"the 'y' in (x, y) will be used when using Flip on Y and")
|
||||||
)
|
)
|
||||||
self.flip_ref_label.setFixedWidth(70)
|
self.flip_ref_label.setFixedWidth(70)
|
||||||
self.flip_ref_entry = EvalEntry2("(0, 0)")
|
self.flip_ref_entry = EvalEntry2("(0, 0)")
|
||||||
@ -337,8 +337,8 @@ class ToolTransform(FlatCAMTool):
|
|||||||
self.flip_ref_button.set_value(_("Add"))
|
self.flip_ref_button.set_value(_("Add"))
|
||||||
self.flip_ref_button.setToolTip(
|
self.flip_ref_button.setToolTip(
|
||||||
_("The point coordinates can be captured by\n"
|
_("The point coordinates can be captured by\n"
|
||||||
"left click on canvas together with pressing\n"
|
"left click on canvas together with pressing\n"
|
||||||
"SHIFT key. Then click Add button to insert."))
|
"SHIFT key. Then click Add button to insert."))
|
||||||
self.flip_ref_button.setFixedWidth(90)
|
self.flip_ref_button.setFixedWidth(90)
|
||||||
|
|
||||||
form4_child_hlay.addStretch()
|
form4_child_hlay.addStretch()
|
||||||
@ -350,8 +350,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
|
|
||||||
form4_layout.addRow(self.flip_ref_cb)
|
form4_layout.addRow(self.flip_ref_cb)
|
||||||
form4_layout.addRow(self.flip_ref_label, form4_child_1)
|
form4_layout.addRow(self.flip_ref_label, form4_child_1)
|
||||||
self.ois_flip = OptionalInputSection(self.flip_ref_cb,
|
self.ois_flip = OptionalInputSection(self.flip_ref_cb, [self.flip_ref_entry, self.flip_ref_button], logic=True)
|
||||||
[self.flip_ref_entry, self.flip_ref_button], logic=True)
|
|
||||||
|
|
||||||
self.transform_lay.addStretch()
|
self.transform_lay.addStretch()
|
||||||
|
|
||||||
@ -455,7 +454,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
if self.app.defaults["tools_transform_mirror_point"]:
|
if self.app.defaults["tools_transform_mirror_point"]:
|
||||||
self.flip_ref_entry.set_value(self.app.defaults["tools_transform_mirror_point"])
|
self.flip_ref_entry.set_value(self.app.defaults["tools_transform_mirror_point"])
|
||||||
else:
|
else:
|
||||||
self.flip_ref_entry.set_value((0,0))
|
self.flip_ref_entry.set_value((0, 0))
|
||||||
|
|
||||||
def on_rotate(self):
|
def on_rotate(self):
|
||||||
try:
|
try:
|
||||||
@ -466,10 +465,10 @@ class ToolTransform(FlatCAMTool):
|
|||||||
value = float(self.rotate_entry.get_value().replace(',', '.'))
|
value = float(self.rotate_entry.get_value().replace(',', '.'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Rotate, "
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Rotate, "
|
||||||
"use a number."))
|
"use a number."))
|
||||||
return
|
return
|
||||||
self.app.worker_task.emit({'fcn': self.on_rotate_action,
|
self.app.worker_task.emit({'fcn': self.on_rotate_action,
|
||||||
'params': [value]})
|
'params': [value]})
|
||||||
# self.on_rotate_action(value)
|
# self.on_rotate_action(value)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -500,7 +499,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
value = float(self.skewx_entry.get_value().replace(',', '.'))
|
value = float(self.skewx_entry.get_value().replace(',', '.'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Skew X, "
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Skew X, "
|
||||||
"use a number."))
|
"use a number."))
|
||||||
return
|
return
|
||||||
|
|
||||||
# self.on_skew("X", value)
|
# self.on_skew("X", value)
|
||||||
@ -518,7 +517,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
value = float(self.skewy_entry.get_value().replace(',', '.'))
|
value = float(self.skewy_entry.get_value().replace(',', '.'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Skew Y, "
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Skew Y, "
|
||||||
"use a number."))
|
"use a number."))
|
||||||
return
|
return
|
||||||
|
|
||||||
# self.on_skew("Y", value)
|
# self.on_skew("Y", value)
|
||||||
@ -536,7 +535,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
xvalue = float(self.scalex_entry.get_value().replace(',', '.'))
|
xvalue = float(self.scalex_entry.get_value().replace(',', '.'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Scale X, "
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Scale X, "
|
||||||
"use a number."))
|
"use a number."))
|
||||||
return
|
return
|
||||||
|
|
||||||
# scaling to zero has no sense so we remove it, because scaling with 1 does nothing
|
# scaling to zero has no sense so we remove it, because scaling with 1 does nothing
|
||||||
@ -570,7 +569,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
yvalue = float(self.scaley_entry.get_value().replace(',', '.'))
|
yvalue = float(self.scaley_entry.get_value().replace(',', '.'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Scale Y, "
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Scale Y, "
|
||||||
"use a number."))
|
"use a number."))
|
||||||
return
|
return
|
||||||
|
|
||||||
# scaling to zero has no sense so we remove it, because scaling with 1 does nothing
|
# scaling to zero has no sense so we remove it, because scaling with 1 does nothing
|
||||||
@ -599,7 +598,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
value = float(self.offx_entry.get_value().replace(',', '.'))
|
value = float(self.offx_entry.get_value().replace(',', '.'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Offset X, "
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Offset X, "
|
||||||
"use a number."))
|
"use a number."))
|
||||||
return
|
return
|
||||||
|
|
||||||
# self.on_offset("X", value)
|
# self.on_offset("X", value)
|
||||||
@ -617,7 +616,7 @@ class ToolTransform(FlatCAMTool):
|
|||||||
value = float(self.offy_entry.get_value().replace(',', '.'))
|
value = float(self.offy_entry.get_value().replace(',', '.'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Offset Y, "
|
self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered for Offset Y, "
|
||||||
"use a number."))
|
"use a number."))
|
||||||
return
|
return
|
||||||
|
|
||||||
# self.on_offset("Y", value)
|
# self.on_offset("Y", value)
|
||||||
|
Loading…
Reference in New Issue
Block a user