- remade the Tool Calculators to use the QSpinBox in order to simplify the user interaction and remove possible errors

- remade: Tool Cutout, Tool 2Sided, Tool Image, Panelize Tool, NCC Tool, Paint Tool  to use the QSpinBox GUI elements
This commit is contained in:
Marius Stanciu 2019-10-05 17:08:51 +03:00 committed by Marius
parent 9e83528448
commit 4a5e08feea
11 changed files with 159 additions and 362 deletions

View File

@ -2979,6 +2979,7 @@ class App(QtCore.QObject):
self.image_tool = ToolImage(self)
self.image_tool.install(icon=QtGui.QIcon('share/image32.png'), pos=self.ui.menufileimport,
separator=True)
self.pcb_wizard_tool = PcbWizard(self)
self.pcb_wizard_tool.install(icon=QtGui.QIcon('share/drill32.png'), pos=self.ui.menufileimport)

View File

@ -10,6 +10,11 @@ CAD program, and create G-Code for Isolation routing.
=================================================
5.10.2019
- remade the Tool Calculators to use the QSpinBox in order to simplify the user interaction and remove possible errors
- remade: Tool Cutout, Tool 2Sided, Tool Image, Panelize Tool, NCC Tool, Paint Tool to use the QSpinBox GUI elements
4.10.2019
- updated the Film Tool and added the ability to generate Punched Positive films (holes in the pads) when a Gerber file is the film's source. The punch holes source can be either an Excellon file or the pads center

View File

@ -30,6 +30,7 @@ class ToolCalculator(FlatCAMTool):
FlatCAMTool.__init__(self, app)
self.app = app
self.decimals = 6
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
@ -63,13 +64,14 @@ class ToolCalculator(FlatCAMTool):
grid_units_layout.addWidget(inch_label, 0, 1)
self.inch_entry = FCEntry()
# self.inch_entry.setFixedWidth(70)
self.inch_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
# self.inch_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.inch_entry.setToolTip(_("Here you enter the value to be converted from INCH to MM"))
self.mm_entry = FCEntry()
# self.mm_entry.setFixedWidth(130)
self.mm_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
# self.mm_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.mm_entry.setToolTip(_("Here you enter the value to be converted from MM to INCH"))
grid_units_layout.addWidget(self.mm_entry, 1, 0)
@ -90,31 +92,35 @@ class ToolCalculator(FlatCAMTool):
self.layout.addLayout(form_layout)
self.tipDia_label = QtWidgets.QLabel('%s:' % _("Tip Diameter"))
self.tipDia_entry = FCEntry()
# self.tipDia_entry.setFixedWidth(70)
self.tipDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.tipDia_entry = FCDoubleSpinner()
self.tipDia_entry.set_precision(self.decimals)
# self.tipDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.tipDia_label.setToolTip(
_("This is the tool tip diameter.\n"
"It is specified by manufacturer.")
)
self.tipAngle_label = QtWidgets.QLabel('%s:' % _("Tip Angle"))
self.tipAngle_entry = FCEntry()
# self.tipAngle_entry.setFixedWidth(70)
self.tipAngle_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.tipAngle_entry = FCSpinner()
# self.tipAngle_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.tipAngle_label.setToolTip(_("This is the angle of the tip of the tool.\n"
"It is specified by manufacturer."))
self.cutDepth_label = QtWidgets.QLabel('%s:' % _("Cut Z"))
self.cutDepth_entry = FCEntry()
# self.cutDepth_entry.setFixedWidth(70)
self.cutDepth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.cutDepth_entry = FCDoubleSpinner()
self.cutDepth_entry.setMinimum(-1e10) # to allow negative numbers without actually adding a real limit
self.cutDepth_entry.set_precision(self.decimals)
# self.cutDepth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.cutDepth_label.setToolTip(_("This is the depth to cut into the material.\n"
"In the CNCJob is the CutZ parameter."))
self.effectiveToolDia_label = QtWidgets.QLabel('%s:' % _("Tool Diameter"))
self.effectiveToolDia_entry = FCEntry()
# self.effectiveToolDia_entry.setFixedWidth(70)
self.effectiveToolDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.effectiveToolDia_entry = FCDoubleSpinner()
self.effectiveToolDia_entry.set_precision(self.decimals)
# self.effectiveToolDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.effectiveToolDia_label.setToolTip(_("This is the tool diameter to be entered into\n"
"FlatCAM Gerber section.\n"
"In the CNCJob section it is called >Tool dia<."))
@ -132,9 +138,8 @@ class ToolCalculator(FlatCAMTool):
_("Calculate either the Cut Z or the effective tool diameter,\n "
"depending on which is desired and which is known. ")
)
self.empty_label = QtWidgets.QLabel(" ")
form_layout.addRow(self.empty_label, self.calculate_vshape_button)
self.layout.addWidget(self.calculate_vshape_button)
# ####################################
# ## ElectroPlating Tool Calculator ##
@ -156,48 +161,54 @@ class ToolCalculator(FlatCAMTool):
self.layout.addLayout(plate_form_layout)
self.pcblengthlabel = QtWidgets.QLabel('%s:' % _("Board Length"))
self.pcblength_entry = FCEntry()
# self.pcblengthlabel.setFixedWidth(70)
self.pcblength_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.pcblength_entry = FCDoubleSpinner()
self.pcblength_entry.set_precision(self.decimals)
# self.pcblength_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
self.pcbwidthlabel = QtWidgets.QLabel('%s:' % _("Board Width"))
self.pcbwidth_entry = FCEntry()
# self.pcbwidthlabel.setFixedWidth(70)
self.pcbwidth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.pcbwidth_entry = FCDoubleSpinner()
self.pcbwidth_entry.set_precision(self.decimals)
# self.pcbwidth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
self.cdensity_label = QtWidgets.QLabel('%s:' % _("Current Density"))
self.cdensity_entry = FCEntry()
# self.cdensity_entry.setFixedWidth(70)
self.cdensity_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.cdensity_entry = FCDoubleSpinner()
self.cdensity_entry.set_precision(self.decimals)
# self.cdensity_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
"In Amps per Square Feet ASF."))
self.growth_label = QtWidgets.QLabel('%s:' % _("Copper Growth"))
self.growth_entry = FCEntry()
# self.growth_entry.setFixedWidth(70)
self.growth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.growth_entry = FCDoubleSpinner()
self.growth_entry.set_precision(self.decimals)
# self.growth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
"In microns."))
# self.growth_entry.setEnabled(False)
self.cvaluelabel = QtWidgets.QLabel('%s:' % _("Current Value"))
self.cvalue_entry = FCEntry()
# self.cvaluelabel.setFixedWidth(70)
self.cvalue_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.cvalue_entry = FCDoubleSpinner()
self.cvalue_entry.set_precision(self.decimals)
# self.cvalue_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.cvaluelabel.setToolTip(_('This is the current intensity value\n'
'to be set on the Power Supply. In Amps.'))
self.cvalue_entry.setDisabled(True)
self.cvalue_entry.setReadOnly(True)
self.timelabel = QtWidgets.QLabel('%s:' % _("Time"))
self.time_entry = FCEntry()
# self.timelabel.setFixedWidth(70)
self.time_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.time_entry = FCDoubleSpinner()
self.time_entry.set_precision(self.decimals)
# self.time_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.timelabel.setToolTip(_('This is the calculated time required for the procedure.\n'
'In minutes.'))
self.time_entry.setDisabled(True)
self.time_entry.setReadOnly(True)
plate_form_layout.addRow(self.pcblengthlabel, self.pcblength_entry)
plate_form_layout.addRow(self.pcbwidthlabel, self.pcbwidth_entry)
@ -213,16 +224,14 @@ class ToolCalculator(FlatCAMTool):
_("Calculate the current intensity value and the procedure time,\n"
"depending on the parameters above")
)
self.empty_label_2 = QtWidgets.QLabel(" ")
plate_form_layout.addRow(self.empty_label_2, self.calculate_plate_button)
self.layout.addWidget(self.calculate_plate_button)
self.layout.addStretch()
self.units = ''
# ## Signals
self.cutDepth_entry.textChanged.connect(self.on_calculate_tool_dia)
self.cutDepth_entry.valueChanged.connect(self.on_calculate_tool_dia)
self.cutDepth_entry.editingFinished.connect(self.on_calculate_tool_dia)
self.tipDia_entry.editingFinished.connect(self.on_calculate_tool_dia)
self.tipAngle_entry.editingFinished.connect(self.on_calculate_tool_dia)
@ -268,8 +277,8 @@ class ToolCalculator(FlatCAMTool):
self.units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().upper()
# ## Initialize form
self.mm_entry.set_value('0')
self.inch_entry.set_value('0')
self.mm_entry.set_value('%.*f' % (self.decimals, 0))
self.inch_entry.set_value('%.*f' % (self.decimals, 0))
length = self.app.defaults["tools_calc_electro_length"]
width = self.app.defaults["tools_calc_electro_width"]
@ -300,114 +309,30 @@ class ToolCalculator(FlatCAMTool):
# effective_diameter = tip_diameter + (2 * part_of_real_dia_left_side)
# effective diameter = tip_diameter + (2 * depth_of_cut * tangent(half_tip_angle))
try:
tip_diameter = float(self.tipDia_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
tip_diameter = float(self.tipDia_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
tip_diameter = float(self.tipDia_entry.get_value())
try:
half_tip_angle = float(self.tipAngle_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
half_tip_angle = float(self.tipAngle_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
half_tip_angle = float(self.tipAngle_entry.get_value())
half_tip_angle /= 2
try:
cut_depth = float(self.cutDepth_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
cut_depth = float(self.cutDepth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
cut_depth = float(self.cutDepth_entry.get_value())
cut_depth = -cut_depth if cut_depth < 0 else cut_depth
tool_diameter = tip_diameter + (2 * cut_depth * math.tan(math.radians(half_tip_angle)))
self.effectiveToolDia_entry.set_value("%.4f" % tool_diameter)
self.effectiveToolDia_entry.set_value("%.*f" % (self.decimals, tool_diameter))
def on_calculate_inch_units(self):
try:
mm_val = float(self.mm_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
mm_val = float(self.mm_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
self.inch_entry.set_value('%.6f' % (mm_val / 25.4))
mm_val = float(self.mm_entry.get_value())
self.inch_entry.set_value('%.*f' % (self.decimals,(mm_val / 25.4)))
def on_calculate_mm_units(self):
try:
inch_val = float(self.inch_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
inch_val = float(self.inch_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
self.mm_entry.set_value('%.6f' % (inch_val * 25.4))
inch_val = float(self.inch_entry.get_value())
self.mm_entry.set_value('%.*f' % (self.decimals,(inch_val * 25.4)))
def on_calculate_eplate(self):
try:
length = float(self.pcblength_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
length = float(self.pcblength_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
try:
width = float(self.pcbwidth_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
width = float(self.pcbwidth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
try:
density = float(self.cdensity_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
density = float(self.cdensity_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
try:
copper = float(self.growth_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
copper = float(self.growth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
length = float(self.pcblength_entry.get_value())
width = float(self.pcbwidth_entry.get_value())
density = float(self.cdensity_entry.get_value())
copper = float(self.growth_entry.get_value())
calculated_current = (length * width * density) * 0.0021527820833419
calculated_time = copper * 2.142857142857143 * float(20 / density)

View File

@ -22,6 +22,7 @@ class CutOut(FlatCAMTool):
self.app = app
self.canvas = app.plotcanvas
self.decimals = 4
# Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
@ -87,7 +88,9 @@ class CutOut(FlatCAMTool):
form_layout.addRow(self.kindlabel, self.obj_kind_combo)
# Tool Diameter
self.dia = FCEntry()
self.dia = FCDoubleSpinner()
self.dia.set_precision(self.decimals)
self.dia_label = QtWidgets.QLabel('%s:' % _("Tool dia"))
self.dia_label.setToolTip(
_("Diameter of the tool used to cutout\n"
@ -96,7 +99,9 @@ class CutOut(FlatCAMTool):
form_layout.addRow(self.dia_label, self.dia)
# Margin
self.margin = FCEntry()
self.margin = FCDoubleSpinner()
self.margin.set_precision(self.decimals)
self.margin_label = QtWidgets.QLabel('%s:' % _("Margin:"))
self.margin_label.setToolTip(
_("Margin over bounds. A positive value here\n"
@ -106,7 +111,9 @@ class CutOut(FlatCAMTool):
form_layout.addRow(self.margin_label, self.margin)
# Gapsize
self.gapsize = FCEntry()
self.gapsize = FCDoubleSpinner()
self.gapsize.set_precision(self.decimals)
self.gapsize_label = QtWidgets.QLabel('%s:' % _("Gap size:"))
self.gapsize_label.setToolTip(
_("The size of the bridge gaps in the cutout\n"
@ -381,17 +388,7 @@ class CutOut(FlatCAMTool):
_("There is no object selected for Cutout.\nSelect one and try again."))
return
try:
dia = float(self.dia.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
dia = float(self.dia.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Tool diameter value is missing or wrong format. Add it and retry."))
return
dia = float(self.dia.get_value())
if 0 in {dia}:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Tool Diameter is zero value. Change it to a positive real number."))
@ -402,27 +399,8 @@ class CutOut(FlatCAMTool):
except ValueError:
return
try:
margin = float(self.margin.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
margin = float(self.margin.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Margin value is missing or wrong format. Add it and retry."))
return
try:
gapsize = float(self.gapsize.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
gapsize = float(self.gapsize.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Gap size value is missing or wrong format. Add it and retry."))
return
margin = float(self.margin.get_value())
gapsize = float(self.gapsize.get_value())
try:
gaps = self.gaps.get_value()
@ -579,17 +557,7 @@ class CutOut(FlatCAMTool):
if cutout_obj is None:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Object not found"), str(name)))
try:
dia = float(self.dia.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
dia = float(self.dia.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Tool diameter value is missing or wrong format. Add it and retry."))
return
dia = float(self.dia.get_value())
if 0 in {dia}:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Tool Diameter is zero value. Change it to a positive real number."))
@ -600,27 +568,8 @@ class CutOut(FlatCAMTool):
except ValueError:
return
try:
margin = float(self.margin.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
margin = float(self.margin.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Margin value is missing or wrong format. Add it and retry."))
return
try:
gapsize = float(self.gapsize.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
gapsize = float(self.gapsize.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Gap size value is missing or wrong format. Add it and retry."))
return
margin = float(self.margin.get_value())
gapsize = float(self.gapsize.get_value())
try:
gaps = self.gaps.get_value()
@ -749,32 +698,13 @@ class CutOut(FlatCAMTool):
self.app.inform.emit(_("Click on the selected geometry object perimeter to create a bridge gap ..."))
self.app.geo_editor.tool_shape.enabled = True
try:
self.cutting_dia = float(self.dia.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
self.cutting_dia = float(self.dia.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Tool diameter value is missing or wrong format. Add it and retry."))
return
self.cutting_dia = float(self.dia.get_value())
if 0 in {self.cutting_dia}:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Tool Diameter is zero value. Change it to a positive real number."))
return "Tool Diameter is zero value. Change it to a positive real number."
try:
self.cutting_gapsize = float(self.gapsize.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
self.cutting_gapsize = float(self.gapsize.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Gap size value is missing or wrong format. Add it and retry."))
return
self.cutting_gapsize = float(self.gapsize.get_value())
name = self.man_object_combo.currentText()
# Get Geometry source object to be used as target for Manual adding Gaps
@ -800,7 +730,6 @@ class CutOut(FlatCAMTool):
self.mm = self.app.plotcanvas.graph_event_connect('mouse_move', self.on_mouse_move)
self.mr = self.app.plotcanvas.graph_event_connect('mouse_release', self.on_mouse_click_release)
def on_manual_cutout(self, click_pos):
name = self.man_object_combo.currentText()
@ -851,17 +780,7 @@ class CutOut(FlatCAMTool):
"Select a Gerber file and try again."))
return
try:
dia = float(self.dia.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
dia = float(self.dia.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Tool diameter value is missing or wrong format. Add it and retry."))
return
dia = float(self.dia.get_value())
if 0 in {dia}:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Tool Diameter is zero value. Change it to a positive real number."))
@ -872,17 +791,7 @@ class CutOut(FlatCAMTool):
except ValueError:
return
try:
margin = float(self.margin.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
margin = float(self.margin.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[WARNING_NOTCL] %s' %
_("Margin value is missing or wrong format. Add it and retry."))
return
margin = float(self.margin.get_value())
convex_box = self.convex_box.get_value()
def geo_init(geo_obj, app_obj):

View File

@ -19,6 +19,7 @@ class DblSidedTool(FlatCAMTool):
def __init__(self, app):
FlatCAMTool.__init__(self, app)
self.decimals = 4
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
@ -219,25 +220,30 @@ class DblSidedTool(FlatCAMTool):
grid_lay3.addWidget(self.alignment_holes, 0, 0)
grid_lay3.addWidget(self.add_drill_point_button, 0, 1)
grid0 = QtWidgets.QGridLayout()
self.layout.addLayout(grid0)
grid0.setColumnStretch(0, 0)
grid0.setColumnStretch(1, 1)
# ## Drill diameter for alignment holes
self.dt_label = QtWidgets.QLabel("<b>%s:</b>" % _('Alignment Drill Diameter'))
self.dt_label.setToolTip(
_("Diameter of the drill for the "
"alignment holes.")
)
self.layout.addWidget(self.dt_label)
grid0.addWidget(self.dt_label, 0, 0, 1, 2)
hlay = QtWidgets.QHBoxLayout()
self.layout.addLayout(hlay)
# Drill diameter value
self.drill_dia = FCDoubleSpinner()
self.drill_dia.set_precision(self.decimals)
self.drill_dia = FCEntry()
self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
self.dd_label.setToolTip(
_("Diameter of the drill for the "
"alignment holes.")
)
hlay.addWidget(self.dd_label)
hlay.addWidget(self.drill_dia)
grid0.addWidget(self.dd_label, 1, 0)
grid0.addWidget(self.drill_dia, 1, 1)
hlay2 = QtWidgets.QHBoxLayout()
self.layout.addLayout(hlay2)

View File

@ -8,7 +8,7 @@
from FlatCAMTool import FlatCAMTool
from flatcamGUI.GUIElements import RadioSet, FCComboBox, IntEntry
from flatcamGUI.GUIElements import RadioSet, FCComboBox, FCSpinner
from PyQt5 import QtGui, QtWidgets
import gettext
@ -59,11 +59,9 @@ class ToolImage(FlatCAMTool):
ti_form_layout.addRow(self.tf_type_obj_combo_label, self.tf_type_obj_combo)
# DPI value of the imported image
self.dpi_entry = IntEntry()
self.dpi_entry = FCSpinner()
self.dpi_label = QtWidgets.QLabel('%s:' % _("DPI value"))
self.dpi_label.setToolTip(
_("Specify a DPI value for the image.")
)
self.dpi_label.setToolTip(_("Specify a DPI value for the image.") )
ti_form_layout.addRow(self.dpi_label, self.dpi_entry)
self.emty_lbl = QtWidgets.QLabel("")
@ -86,7 +84,9 @@ class ToolImage(FlatCAMTool):
ti2_form_layout.addRow(self.image_type_label, self.image_type)
# Mask value of the imported image when image monochrome
self.mask_bw_entry = IntEntry()
self.mask_bw_entry = FCSpinner()
self.mask_bw_entry.set_range(0, 255)
self.mask_bw_label = QtWidgets.QLabel("%s <b>B/W</b>:" % _('Mask value'))
self.mask_bw_label.setToolTip(
_("Mask for monochrome image.\n"
@ -99,7 +99,9 @@ class ToolImage(FlatCAMTool):
ti2_form_layout.addRow(self.mask_bw_label, self.mask_bw_entry)
# Mask value of the imported image for RED color when image color
self.mask_r_entry = IntEntry()
self.mask_r_entry = FCSpinner()
self.mask_r_entry.set_range(0, 255)
self.mask_r_label = QtWidgets.QLabel("%s <b>R:</b>" % _('Mask value'))
self.mask_r_label.setToolTip(
_("Mask for RED color.\n"
@ -110,7 +112,9 @@ class ToolImage(FlatCAMTool):
ti2_form_layout.addRow(self.mask_r_label, self.mask_r_entry)
# Mask value of the imported image for GREEN color when image color
self.mask_g_entry = IntEntry()
self.mask_g_entry = FCSpinner()
self.mask_g_entry.set_range(0, 255)
self.mask_g_label = QtWidgets.QLabel("%s <b>G:</b>" % _('Mask value'))
self.mask_g_label.setToolTip(
_("Mask for GREEN color.\n"
@ -121,7 +125,9 @@ class ToolImage(FlatCAMTool):
ti2_form_layout.addRow(self.mask_g_label, self.mask_g_entry)
# Mask value of the imported image for BLUE color when image color
self.mask_b_entry = IntEntry()
self.mask_b_entry = FCSpinner()
self.mask_b_entry.set_range(0, 255)
self.mask_b_label = QtWidgets.QLabel("%s <b>B:</b>" % _('Mask value'))
self.mask_b_label.setToolTip(
_("Mask for BLUE color.\n"
@ -132,15 +138,11 @@ class ToolImage(FlatCAMTool):
ti2_form_layout.addRow(self.mask_b_label, self.mask_b_entry)
# Buttons
hlay = QtWidgets.QHBoxLayout()
self.layout.addLayout(hlay)
hlay.addStretch()
self.import_button = QtWidgets.QPushButton(_("Import image"))
self.import_button.setToolTip(
_("Open a image of raster type and then import it in FlatCAM.")
)
hlay.addWidget(self.import_button)
self.layout.addWidget(self.import_button)
self.layout.addStretch()

View File

@ -27,6 +27,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
def __init__(self, app):
self.app = app
self.decimals = 4
FlatCAMTool.__init__(self, app)
Gerber.__init__(self, steps_per_circle=self.app.defaults["gerber_circle_steps"])
@ -213,14 +214,18 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.addtool_entry_lbl.setToolTip(
_("Diameter for the new tool to add in the Tool Table")
)
self.addtool_entry = FCEntry2()
self.addtool_entry = FCDoubleSpinner()
self.addtool_entry.set_precision(self.decimals)
form.addRow(self.addtool_entry_lbl, self.addtool_entry)
# Tip Dia
self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
self.tipdialabel.setToolTip(
_("The tip diameter for V-Shape Tool"))
self.tipdia_entry = LengthEntry()
self.tipdia_entry = FCDoubleSpinner()
self.tipdia_entry.set_precision(self.decimals)
form.addRow(self.tipdialabel, self.tipdia_entry)
# Tip Angle
@ -228,7 +233,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.tipanglelabel.setToolTip(
_("The tip angle for V-Shape Tool.\n"
"In degree."))
self.tipangle_entry = LengthEntry()
self.tipangle_entry = FCDoubleSpinner()
self.tipangle_entry.set_precision(self.decimals)
form.addRow(self.tipanglelabel, self.tipangle_entry)
grid2 = QtWidgets.QGridLayout()
@ -271,7 +278,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
_("Depth of cut into material. Negative value.\n"
"In FlatCAM units.")
)
self.cutz_entry = FloatEntry()
self.cutz_entry = FCDoubleSpinner()
self.cutz_entry.set_precision(self.decimals)
self.cutz_entry.set_range(-99999, -0.00000000000001)
self.cutz_entry.setToolTip(
_("Depth of cut into material. Negative value.\n"
"In FlatCAM units.")
@ -305,7 +315,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
_("Bounding box margin.")
)
grid3.addWidget(nccmarginlabel, 3, 0)
self.ncc_margin_entry = FCEntry()
self.ncc_margin_entry = FCDoubleSpinner()
self.ncc_margin_entry.set_precision(self.decimals)
grid3.addWidget(self.ncc_margin_entry, 3, 1)
# Method
@ -488,15 +500,12 @@ class NonCopperClear(FlatCAMTool, Gerber):
# store here solid_geometry when there are tool with isolation job
self.solid_geometry = []
# the number of decimals for the tools used in this FlatCAM Tool
self.decimals = 4
self.select_method = None
self.tool_type_item_options = []
self.addtool_btn.clicked.connect(self.on_tool_add)
self.addtool_entry.returnPressed.connect(self.on_tool_add)
self.addtool_entry.editingFinished.connect(self.on_tool_add)
self.deltool_btn.clicked.connect(self.on_tool_delete)
self.generate_ncc_button.clicked.connect(self.on_ncc_click)
@ -958,7 +967,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
for k, v in self.ncc_tools.items():
for tool_v in v.keys():
if tool_v == 'tooldia':
tool_dias.append(float('%.*f' % self.decimals, (v[tool_v])))
tool_dias.append(float('%.*f' % (self.decimals, (v[tool_v]))))
if float('%.*f' % (self.decimals, tool_dia)) in tool_dias:
if muted is None:

View File

@ -26,6 +26,7 @@ class ToolPaint(FlatCAMTool, Gerber):
def __init__(self, app):
self.app = app
self.decimals = 4
FlatCAMTool.__init__(self, app)
Geometry.__init__(self, geo_steps_per_circle=self.app.defaults["geometry_circle_steps"])
@ -156,19 +157,14 @@ class ToolPaint(FlatCAMTool, Gerber):
form.addRow(self.order_label, self.order_radio)
# ### Add a new Tool ## ##
hlay = QtWidgets.QHBoxLayout()
self.tools_box.addLayout(hlay)
self.addtool_entry_lbl = QtWidgets.QLabel('<b>%s:</b>' % _('Tool Dia'))
self.addtool_entry_lbl.setToolTip(
_("Diameter for the new tool.")
)
self.addtool_entry = FCEntry2()
self.addtool_entry = FCDoubleSpinner()
self.addtool_entry.set_precision(self.decimals)
# hlay.addWidget(self.addtool_label)
# hlay.addStretch()
hlay.addWidget(self.addtool_entry_lbl)
hlay.addWidget(self.addtool_entry)
form.addRow(self.addtool_entry_lbl, self.addtool_entry)
grid2 = QtWidgets.QGridLayout()
self.tools_box.addLayout(grid2)
@ -200,6 +196,8 @@ class ToolPaint(FlatCAMTool, Gerber):
grid3 = QtWidgets.QGridLayout()
self.tools_box.addLayout(grid3)
grid3.setColumnStretch(0, 0)
grid3.setColumnStretch(1, 1)
# Overlap
ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
@ -230,7 +228,9 @@ class ToolPaint(FlatCAMTool, Gerber):
"be painted.")
)
grid3.addWidget(marginlabel, 2, 0)
self.paintmargin_entry = FCEntry()
self.paintmargin_entry = FCDoubleSpinner()
self.paintmargin_entry.set_precision(self.decimals)
grid3.addWidget(self.paintmargin_entry, 2, 1)
# Method
@ -376,9 +376,6 @@ class ToolPaint(FlatCAMTool, Gerber):
self.sel_rect = []
# Number of decimals for tools used in this Tool
self.decimals = 4
# store here the default data for Geometry Data
self.default_data = {}
self.default_data.update({
@ -417,7 +414,7 @@ class ToolPaint(FlatCAMTool, Gerber):
# ## Signals
self.addtool_btn.clicked.connect(self.on_tool_add)
self.addtool_entry.returnPressed.connect(self.on_tool_add)
self.addtool_entry.editingFinished.connect(self.on_tool_add)
# self.copytool_btn.clicked.connect(lambda: self.on_tool_copy())
self.tools_table.itemChanged.connect(self.on_tool_edit)
self.deltool_btn.clicked.connect(self.on_tool_delete)

View File

@ -143,7 +143,7 @@ class Panelize(FlatCAMTool):
form_layout.addRow(panel_data_label)
# Spacing Columns
self.spacing_columns = FCEntry()
self.spacing_columns = FCSpinner()
self.spacing_columns_label = QtWidgets.QLabel('%s:' % _("Spacing cols"))
self.spacing_columns_label.setToolTip(
_("Spacing between columns of the desired panel.\n"
@ -152,7 +152,7 @@ class Panelize(FlatCAMTool):
form_layout.addRow(self.spacing_columns_label, self.spacing_columns)
# Spacing Rows
self.spacing_rows = FCEntry()
self.spacing_rows = FCSpinner()
self.spacing_rows_label = QtWidgets.QLabel('%s:' % _("Spacing rows"))
self.spacing_rows_label.setToolTip(
_("Spacing between rows of the desired panel.\n"
@ -161,7 +161,7 @@ class Panelize(FlatCAMTool):
form_layout.addRow(self.spacing_rows_label, self.spacing_rows)
# Columns
self.columns = FCEntry()
self.columns = FCSpinner()
self.columns_label = QtWidgets.QLabel('%s:' % _("Columns"))
self.columns_label.setToolTip(
_("Number of columns of the desired panel")
@ -169,7 +169,7 @@ class Panelize(FlatCAMTool):
form_layout.addRow(self.columns_label, self.columns)
# Rows
self.rows = FCEntry()
self.rows = FCSpinner()
self.rows_label = QtWidgets.QLabel('%s:' % _("Rows"))
self.rows_label.setToolTip(
_("Number of rows of the desired panel")
@ -200,7 +200,7 @@ class Panelize(FlatCAMTool):
)
form_layout.addRow(self.constrain_cb)
self.x_width_entry = FCEntry()
self.x_width_entry = FCSpinner()
self.x_width_lbl = QtWidgets.QLabel('%s:' % _("Width (DX)"))
self.x_width_lbl.setToolTip(
_("The width (DX) within which the panel must fit.\n"
@ -208,7 +208,7 @@ class Panelize(FlatCAMTool):
)
form_layout.addRow(self.x_width_lbl, self.x_width_entry)
self.y_height_entry = FCEntry()
self.y_height_entry = FCSpinner()
self.y_height_lbl = QtWidgets.QLabel('%s:' % _("Height (DY)"))
self.y_height_lbl.setToolTip(
_("The height (DY)within which the panel must fit.\n"
@ -386,77 +386,20 @@ class Panelize(FlatCAMTool):
self.outname = name + '_panelized'
try:
spacing_columns = float(self.spacing_columns.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
spacing_columns = float(self.spacing_columns.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
spacing_columns = float(self.spacing_columns.get_value())
spacing_columns = spacing_columns if spacing_columns is not None else 0
try:
spacing_rows = float(self.spacing_rows.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
spacing_rows = float(self.spacing_rows.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
spacing_rows = float(self.spacing_rows.get_value())
spacing_rows = spacing_rows if spacing_rows is not None else 0
try:
rows = int(self.rows.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
rows = float(self.rows.get_value().replace(',', '.'))
rows = int(rows)
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
rows = int(self.rows.get_value())
rows = rows if rows is not None else 1
try:
columns = int(self.columns.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
columns = float(self.columns.get_value().replace(',', '.'))
columns = int(columns)
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
columns = int(self.columns.get_value())
columns = columns if columns is not None else 1
try:
constrain_dx = float(self.x_width_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
constrain_dx = float(self.x_width_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
try:
constrain_dy = float(self.y_height_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
constrain_dy = float(self.y_height_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Wrong value format entered, use a number."))
return
constrain_dx = float(self.x_width_entry.get_value())
constrain_dy = float(self.y_height_entry.get_value())
panel_type = str(self.panel_type_radio.get_value())

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 213 B