- in Copper Thieving Tool added a new parameter to filter areas too small to be desired in the copper thieving; added it to Preferences too

- Copper Thieving Tool added a new parameter to select what extra geometry to include in the Pattern Plating Mask; added it to the Preferences
- made a wide change on the spinners GUI ranges: from 9999.9999 all values to 10000.0000
- fixed some late issues in Corner Markers Tool new feature (messages)
- upgraded Calculator Tool and added the new parameter is the Preferences
- updated translation strings
This commit is contained in:
Marius Stanciu
2020-11-02 18:03:13 +02:00
committed by Marius
parent 84ef0f8a03
commit 4f9bb918d5
70 changed files with 4150 additions and 3371 deletions

View File

@@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtGui
from appTool import AppTool
from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, NumericalEvalEntry
from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, NumericalEvalEntry, FCLabel, RadioSet, FCButton
import math
import gettext
@@ -48,6 +48,8 @@ class ToolCalculator(AppTool):
self.ui.calculate_plate_button.clicked.connect(self.on_calculate_eplate)
self.ui.reset_button.clicked.connect(self.set_tool_ui)
self.ui.area_sel_radio.activated_custom.connect(self.on_area_calculation_radio)
def run(self, toggle=True):
self.app.defaults.report_usage("ToolCalculators()")
@@ -80,7 +82,7 @@ class ToolCalculator(AppTool):
AppTool.install(self, icon, separator, shortcut='Alt+C', **kwargs)
def set_tool_ui(self):
self.units = self.app.defaults['units'].upper()
self.units = self.app.defaults['units'].lower()
# ## Initialize form
self.ui.mm_entry.set_value('%.*f' % (self.decimals, 0))
@@ -90,8 +92,10 @@ class ToolCalculator(AppTool):
width = self.app.defaults["tools_calc_electro_width"]
density = self.app.defaults["tools_calc_electro_cdensity"]
growth = self.app.defaults["tools_calc_electro_growth"]
self.ui.pcblength_entry.set_value(length)
self.ui.pcbwidth_entry.set_value(width)
self.ui.area_entry.set_value(self.app.defaults["tools_calc_electro_area"])
self.ui.cdensity_entry.set_value(density)
self.ui.growth_entry.set_value(growth)
self.ui.cvalue_entry.set_value(0.00)
@@ -106,6 +110,35 @@ class ToolCalculator(AppTool):
self.ui.cutDepth_entry.set_value(cut_z)
self.ui.effectiveToolDia_entry.set_value('0.0000')
self.ui.area_sel_radio.set_value('d')
self.on_area_calculation_radio(val='d')
def on_area_calculation_radio(self, val):
if val == 'a':
self.ui.pcbwidthlabel.hide()
self.ui.pcbwidth_entry.hide()
self.ui.width_unit.hide()
self.ui.pcblengthlabel.hide()
self.ui.pcblength_entry.hide()
self.ui.length_unit.hide()
self.ui.area_label.show()
self.ui.area_entry.show()
self.ui.area_unit.show()
else:
self.ui.pcbwidthlabel.show()
self.ui.pcbwidth_entry.show()
self.ui.width_unit.show()
self.ui.pcblengthlabel.show()
self.ui.pcblength_entry.show()
self.ui.length_unit.show()
self.ui.area_label.hide()
self.ui.area_entry.hide()
self.ui.area_unit.hide()
def on_calculate_tool_dia(self):
# Calculation:
# Manufacturer gives total angle of the the tip but we need only half of it
@@ -123,23 +156,29 @@ class ToolCalculator(AppTool):
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.ui.effectiveToolDia_entry.set_value("%.*f" % (self.decimals, tool_diameter))
self.ui.effectiveToolDia_entry.set_value(self.app.dec_format(tool_diameter, self.decimals))
def on_calculate_inch_units(self):
mm_val = float(self.mm_entry.get_value())
mm_val = float(self.ui.mm_entry.get_value())
self.ui.inch_entry.set_value('%.*f' % (self.decimals, (mm_val / 25.4)))
def on_calculate_mm_units(self):
inch_val = float(self.inch_entry.get_value())
inch_val = float(self.ui.inch_entry.get_value())
self.ui.mm_entry.set_value('%.*f' % (self.decimals, (inch_val * 25.4)))
def on_calculate_eplate(self):
length = float(self.ui.pcblength_entry.get_value())
width = float(self.ui.pcbwidth_entry.get_value())
density = float(self.ui.cdensity_entry.get_value())
copper = float(self.ui.growth_entry.get_value())
area_calc_sel = self.ui.area_sel_radio.get_value()
length = self.ui.pcblength_entry.get_value()
width = self.ui.pcbwidth_entry.get_value()
area = self.ui.area_entry.get_value()
calculated_current = (length * width * density) * 0.0021527820833419
density = self.ui.cdensity_entry.get_value()
copper = self.ui.growth_entry.get_value()
if area_calc_sel == 'd':
calculated_current = (length * width * density) * 0.0021527820833419
else:
calculated_current = (area * density) * 0.0021527820833419
calculated_time = copper * 2.142857142857143 * float(20 / density)
self.ui.cvalue_entry.set_value('%.2f' % calculated_current)
@@ -157,9 +196,10 @@ class CalcUI:
self.app = app
self.decimals = self.app.decimals
self.layout = layout
self.units = self.app.defaults['units'].lower()
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
title_label = FCLabel("%s" % self.toolName)
title_label.setStyleSheet("""
QLabel
{
@@ -173,19 +213,19 @@ class CalcUI:
# ## Units Calculator #
# #####################
self.unists_spacer_label = QtWidgets.QLabel(" ")
self.unists_spacer_label = FCLabel(" ")
self.layout.addWidget(self.unists_spacer_label)
# ## Title of the Units Calculator
units_label = QtWidgets.QLabel("<font size=3><b>%s</b></font>" % self.unitsName)
units_label = FCLabel("<font size=3><b>%s</b></font>" % self.unitsName)
self.layout.addWidget(units_label)
# Grid Layout
grid_units_layout = QtWidgets.QGridLayout()
self.layout.addLayout(grid_units_layout)
inch_label = QtWidgets.QLabel(_("INCH"))
mm_label = QtWidgets.QLabel(_("MM"))
inch_label = FCLabel(_("INCH"))
mm_label = FCLabel(_("MM"))
grid_units_layout.addWidget(mm_label, 0, 0)
grid_units_layout.addWidget(inch_label, 0, 1)
@@ -206,21 +246,21 @@ class CalcUI:
# ##############################
# ## V-shape Tool Calculator ###
# ##############################
self.v_shape_spacer_label = QtWidgets.QLabel(" ")
self.v_shape_spacer_label = FCLabel(" ")
self.layout.addWidget(self.v_shape_spacer_label)
# ## Title of the V-shape Tools Calculator
v_shape_title_label = QtWidgets.QLabel("<font size=3><b>%s</b></font>" % self.v_shapeName)
v_shape_title_label = FCLabel("<font size=3><b>%s</b></font>" % self.v_shapeName)
self.layout.addWidget(v_shape_title_label)
# ## Form Layout
form_layout = QtWidgets.QFormLayout()
self.layout.addLayout(form_layout)
self.tipDia_label = QtWidgets.QLabel('%s:' % _("Tip Diameter"))
self.tipDia_label = FCLabel('%s:' % _("Tip Diameter"))
self.tipDia_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.tipDia_entry.set_precision(self.decimals)
self.tipDia_entry.set_range(0.0, 9999.9999)
self.tipDia_entry.set_range(0.0, 10000.0000)
self.tipDia_entry.setSingleStep(0.1)
# self.tipDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
@@ -228,7 +268,7 @@ class CalcUI:
_("This is the tool tip diameter.\n"
"It is specified by manufacturer.")
)
self.tipAngle_label = QtWidgets.QLabel('%s:' % _("Tip Angle"))
self.tipAngle_label = FCLabel('%s:' % _("Tip Angle"))
self.tipAngle_entry = FCSpinner(callback=self.confirmation_message_int)
self.tipAngle_entry.set_range(0, 180)
self.tipAngle_entry.set_step(5)
@@ -237,16 +277,16 @@ class CalcUI:
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_label = FCLabel('%s:' % _("Cut Z"))
self.cutDepth_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.cutDepth_entry.set_range(-9999.9999, 9999.9999)
self.cutDepth_entry.set_range(-10000.0000, 10000.0000)
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_label = FCLabel('%s:' % _("Tool Diameter"))
self.effectiveToolDia_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.effectiveToolDia_entry.set_precision(self.decimals)
@@ -262,8 +302,9 @@ class CalcUI:
form_layout.addRow(self.effectiveToolDia_label, self.effectiveToolDia_entry)
# ## Buttons
self.calculate_vshape_button = QtWidgets.QPushButton(_("Calculate"))
# self.calculate_button.setFixedWidth(70)
self.calculate_vshape_button = FCButton(_("Calculate"))
self.calculate_vshape_button.setIcon(QtGui.QIcon(self.app.resource_location + '/calculator16.png'))
self.calculate_vshape_button.setToolTip(
_("Calculate either the Cut Z or the effective tool diameter,\n "
"depending on which is desired and which is known. ")
@@ -275,11 +316,10 @@ class CalcUI:
# ## ElectroPlating Tool Calculator ##
# ####################################
self.plate_spacer_label = QtWidgets.QLabel(" ")
self.layout.addWidget(self.plate_spacer_label)
self.layout.addWidget(FCLabel(""))
# ## Title of the ElectroPlating Tools Calculator
plate_title_label = QtWidgets.QLabel("<font size=3><b>%s</b></font>" % self.eplateName)
plate_title_label = FCLabel("<font size=3><b>%s</b></font>" % self.eplateName)
plate_title_label.setToolTip(
_("This calculator is useful for those who plate the via/pad/drill holes,\n"
"using a method like graphite ink or calcium hypophosphite ink or palladium chloride.")
@@ -287,79 +327,168 @@ class CalcUI:
self.layout.addWidget(plate_title_label)
# ## Plate Form Layout
plate_form_layout = QtWidgets.QFormLayout()
self.layout.addLayout(plate_form_layout)
grid2 = QtWidgets.QGridLayout()
grid2.setColumnStretch(0, 0)
grid2.setColumnStretch(1, 1)
self.layout.addLayout(grid2)
self.pcblengthlabel = QtWidgets.QLabel('%s:' % _("Board Length"))
self.pcblength_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.pcblength_entry.set_precision(self.decimals)
self.pcblength_entry.set_range(0.0, 9999.9999)
# Area Calculation
self.area_sel_label = FCLabel('%s:' % _("Area Calculation"))
self.area_sel_label.setToolTip(
_("Choose how to calculate the board area.")
)
self.area_sel_radio = RadioSet([
{'label': _('Dimensions'), 'value': 'd'},
{"label": _("Area"), "value": "a"}
], stretch=False)
# self.pcblength_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
grid2.addWidget(self.area_sel_label, 0, 0)
grid2.addWidget(self.area_sel_radio, 1, 0, 1, 2)
# BOARD LENGTH
self.pcblengthlabel = FCLabel('%s:' % _("Board Length"))
self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
self.pcblength_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.pcblength_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
self.pcblength_entry.set_precision(self.decimals)
self.pcblength_entry.set_range(0.0, 10000.0000)
self.pcbwidthlabel = QtWidgets.QLabel('%s:' % _("Board Width"))
self.pcbwidth_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.pcbwidth_entry.set_precision(self.decimals)
self.pcbwidth_entry.set_range(0.0, 9999.9999)
self.length_unit = FCLabel('%s' % _("cm"))
self.length_unit.setMinimumWidth(25)
# self.pcbwidth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
l_hlay = QtWidgets.QHBoxLayout()
l_hlay.addWidget(self.pcblength_entry)
l_hlay.addWidget(self.length_unit)
grid2.addWidget(self.pcblengthlabel, 2, 0)
grid2.addLayout(l_hlay, 2, 1)
# BOARD WIDTH
self.pcbwidthlabel = FCLabel('%s:' % _("Board Width"))
self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
self.pcbwidth_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.pcbwidth_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
self.pcbwidth_entry.set_precision(self.decimals)
self.pcbwidth_entry.set_range(0.0, 10000.0000)
self.cdensity_label = QtWidgets.QLabel('%s:' % _("Current Density"))
self.cdensity_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.cdensity_entry.set_precision(self.decimals)
self.cdensity_entry.set_range(0.0, 9999.9999)
self.cdensity_entry.setSingleStep(0.1)
self.width_unit = FCLabel('%s' % _("cm"))
self.width_unit.setMinimumWidth(25)
# self.cdensity_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
w_hlay = QtWidgets.QHBoxLayout()
w_hlay.addWidget(self.pcbwidth_entry)
w_hlay.addWidget(self.width_unit)
grid2.addWidget(self.pcbwidthlabel, 4, 0)
grid2.addLayout(w_hlay, 4, 1)
# AREA
self.area_label = FCLabel('%s:' % _("Area"))
self.area_label.setToolTip(_('This is the board area.'))
self.area_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.area_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
self.area_entry.set_precision(self.decimals)
self.area_entry.set_range(0.0, 10000.0000)
self.area_unit = FCLabel('%s<sup>2</sup>' % _("cm"))
self.area_unit.setMinimumWidth(25)
a_hlay = QtWidgets.QHBoxLayout()
a_hlay.addWidget(self.area_entry)
a_hlay.addWidget(self.area_unit)
grid2.addWidget(self.area_label, 6, 0)
grid2.addLayout(a_hlay, 6, 1)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid2.addWidget(separator_line, 7, 0, 1, 2)
# DENSITY
self.cdensity_label = FCLabel('%s:' % _("Current Density"))
self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
"In Amps per Square Feet ASF."))
self.cdensity_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.cdensity_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
self.cdensity_entry.set_precision(self.decimals)
self.cdensity_entry.set_range(0.0, 10000.0000)
self.cdensity_entry.setSingleStep(0.1)
self.growth_label = QtWidgets.QLabel('%s:' % _("Copper Growth"))
self.growth_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.growth_entry.set_precision(self.decimals)
self.growth_entry.set_range(0.0, 9999.9999)
self.growth_entry.setSingleStep(0.01)
density_unit = FCLabel('%s' % "ASF")
density_unit.setMinimumWidth(25)
# self.growth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
d_hlay = QtWidgets.QHBoxLayout()
d_hlay.addWidget(self.cdensity_entry)
d_hlay.addWidget(density_unit)
grid2.addWidget(self.cdensity_label, 8, 0)
grid2.addLayout(d_hlay, 8, 1)
# COPPER GROWTH
self.growth_label = FCLabel('%s:' % _("Copper Growth"))
self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
"In microns."))
self.growth_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.growth_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
self.growth_entry.set_precision(self.decimals)
self.growth_entry.set_range(0.0, 10000.0000)
self.growth_entry.setSingleStep(0.01)
# self.growth_entry.setEnabled(False)
growth_unit = FCLabel('%s' % _("um"))
growth_unit.setMinimumWidth(25)
self.cvaluelabel = QtWidgets.QLabel('%s:' % _("Current Value"))
self.cvalue_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.cvalue_entry.set_precision(self.decimals)
self.cvalue_entry.set_range(0.0, 9999.9999)
self.cvalue_entry.setSingleStep(0.1)
g_hlay = QtWidgets.QHBoxLayout()
g_hlay.addWidget(self.growth_entry)
g_hlay.addWidget(growth_unit)
# self.cvalue_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
grid2.addWidget(self.growth_label, 10, 0)
grid2.addLayout(g_hlay, 10, 1)
# CURRENT
self.cvaluelabel = FCLabel('%s:' % _("Current Value"))
self.cvaluelabel.setToolTip(_('This is the current intensity value\n'
'to be set on the Power Supply. In Amps.'))
self.cvalue_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.cvalue_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
self.cvalue_entry.set_precision(self.decimals)
self.cvalue_entry.set_range(0.0, 10000.0000)
self.cvalue_entry.setSingleStep(0.1)
current_unit = FCLabel('%s' % "A")
current_unit.setMinimumWidth(25)
self.cvalue_entry.setReadOnly(True)
self.timelabel = QtWidgets.QLabel('%s:' % _("Time"))
self.time_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.time_entry.set_precision(self.decimals)
self.time_entry.set_range(0.0, 9999.9999)
self.time_entry.setSingleStep(0.1)
c_hlay = QtWidgets.QHBoxLayout()
c_hlay.addWidget(self.cvalue_entry)
c_hlay.addWidget(current_unit)
# self.time_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
grid2.addWidget(self.cvaluelabel, 12, 0)
grid2.addLayout(c_hlay, 12, 1)
# TIME
self.timelabel = FCLabel('%s:' % _("Time"))
self.timelabel.setToolTip(_('This is the calculated time required for the procedure.\n'
'In minutes.'))
self.time_entry = FCDoubleSpinner(callback=self.confirmation_message)
self.time_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
self.time_entry.set_precision(self.decimals)
self.time_entry.set_range(0.0, 10000.0000)
self.time_entry.setSingleStep(0.1)
time_unit = FCLabel('%s' % "min")
time_unit.setMinimumWidth(25)
self.time_entry.setReadOnly(True)
plate_form_layout.addRow(self.pcblengthlabel, self.pcblength_entry)
plate_form_layout.addRow(self.pcbwidthlabel, self.pcbwidth_entry)
plate_form_layout.addRow(self.cdensity_label, self.cdensity_entry)
plate_form_layout.addRow(self.growth_label, self.growth_entry)
plate_form_layout.addRow(self.cvaluelabel, self.cvalue_entry)
plate_form_layout.addRow(self.timelabel, self.time_entry)
t_hlay = QtWidgets.QHBoxLayout()
t_hlay.addWidget(self.time_entry)
t_hlay.addWidget(time_unit)
grid2.addWidget(self.timelabel, 14, 0)
grid2.addLayout(t_hlay, 14, 1)
# ## Buttons
self.calculate_plate_button = QtWidgets.QPushButton(_("Calculate"))
# self.calculate_button.setFixedWidth(70)
self.calculate_plate_button = FCButton(_("Calculate"))
self.calculate_plate_button.setIcon(QtGui.QIcon(self.app.resource_location + '/calculator16.png'))
self.calculate_plate_button.setToolTip(
_("Calculate the current intensity value and the procedure time,\n"
"depending on the parameters above")
@@ -369,7 +498,7 @@ class CalcUI:
self.layout.addStretch()
# ## Reset Tool
self.reset_button = QtWidgets.QPushButton(_("Reset Tool"))
self.reset_button = FCButton(_("Reset Tool"))
self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png'))
self.reset_button.setToolTip(
_("Will reset the tool parameters.")