- in Calculators Plugin fixed the Electroplating Calculator to work as expected and removed the redundant button 'Calculate'
This commit is contained in:
@@ -15,6 +15,7 @@ CHANGELOG for FlatCAM Evo beta
|
|||||||
- a small fin in the SVG parser
|
- a small fin in the SVG parser
|
||||||
- added a new Tcl command that is returning the name of the active object ('get_active') to accompany the 'set_active' command
|
- added a new Tcl command that is returning the name of the active object ('get_active') to accompany the 'set_active' command
|
||||||
- a small fix for the 2d graphic mode by replacing the q5agg matplotlib backend with the qtagg backend which should work with the Qt6
|
- a small fix for the 2d graphic mode by replacing the q5agg matplotlib backend with the qtagg backend which should work with the Qt6
|
||||||
|
- in Calculators Plugin fixed the Electroplating Calculator to work as expected and removed the redundant button 'Calculate'
|
||||||
|
|
||||||
26.04.2022
|
26.04.2022
|
||||||
|
|
||||||
|
|||||||
@@ -94,9 +94,40 @@ class ToolCalculator(AppTool):
|
|||||||
self.ui.fl_oz_entry.editingFinished.connect(self.on_calculate_ml_units)
|
self.ui.fl_oz_entry.editingFinished.connect(self.on_calculate_ml_units)
|
||||||
|
|
||||||
self.ui.reset_button.clicked.connect(self.set_tool_ui)
|
self.ui.reset_button.clicked.connect(self.set_tool_ui)
|
||||||
self.ui.area_sel_radio.activated_custom.connect(self.on_area_calculation_radio)
|
|
||||||
self.ui.calculate_tin_button.clicked.connect(lambda: self.on_tin_solution_calculation())
|
self.ui.calculate_tin_button.clicked.connect(lambda: self.on_tin_solution_calculation())
|
||||||
self.ui.sol_radio.activated_custom.connect(self.on_tin_solution_type)
|
self.ui.sol_radio.activated_custom.connect(self.on_tin_solution_type)
|
||||||
|
self.ui.area_sel_radio.activated_custom.connect(self.on_area_calculation_radio)
|
||||||
|
|
||||||
|
def on_area_calculation_radio(self, val):
|
||||||
|
self.ui_disconnect()
|
||||||
|
self.ui_connect()
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
self.ep_calculate_output()
|
||||||
|
|
||||||
def install(self, icon=None, separator=None, **kwargs):
|
def install(self, icon=None, separator=None, **kwargs):
|
||||||
AppTool.install(self, icon, separator, shortcut='Alt+C', **kwargs)
|
AppTool.install(self, icon, separator, shortcut='Alt+C', **kwargs)
|
||||||
@@ -143,10 +174,10 @@ class ToolCalculator(AppTool):
|
|||||||
self.ui.cutDepth_entry.set_value(cut_z)
|
self.ui.cutDepth_entry.set_value(cut_z)
|
||||||
self.on_calculate_tool_dia()
|
self.on_calculate_tool_dia()
|
||||||
|
|
||||||
|
# Electroplating Calculator
|
||||||
self.ui.area_sel_radio.set_value('d')
|
self.ui.area_sel_radio.set_value('d')
|
||||||
self.on_area_calculation_radio(val='d')
|
self.on_area_calculation_radio(val=self.ui.area_sel_radio.get_value())
|
||||||
|
self.ep_calculate_output()
|
||||||
self.on_calculate_eplate()
|
|
||||||
|
|
||||||
# Tinning Calculator
|
# Tinning Calculator
|
||||||
self.ui.sol_radio.set_value("sol1")
|
self.ui.sol_radio.set_value("sol1")
|
||||||
@@ -154,32 +185,6 @@ class ToolCalculator(AppTool):
|
|||||||
self.ui_disconnect()
|
self.ui_disconnect()
|
||||||
self.ui_connect()
|
self.ui_connect()
|
||||||
|
|
||||||
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):
|
def on_calculate_tool_dia(self):
|
||||||
self.ui_disconnect()
|
self.ui_disconnect()
|
||||||
# Calculation:
|
# Calculation:
|
||||||
@@ -261,7 +266,7 @@ class ToolCalculator(AppTool):
|
|||||||
floz_val = float(self.ui.fl_oz_entry.get_value())
|
floz_val = float(self.ui.fl_oz_entry.get_value())
|
||||||
self.ui.ml_entry.set_value('%.*f' % (self.decimals, (floz_val * 29.5735296875)))
|
self.ui.ml_entry.set_value('%.*f' % (self.decimals, (floz_val * 29.5735296875)))
|
||||||
|
|
||||||
def on_calculate_current(self):
|
def ep_calculate_current(self):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
:return:
|
:return:
|
||||||
@@ -290,10 +295,10 @@ class ToolCalculator(AppTool):
|
|||||||
else:
|
else:
|
||||||
calculated_current = (area * density) * 0.0021527820833419
|
calculated_current = (area * density) * 0.0021527820833419
|
||||||
|
|
||||||
self.ui.cvalue_entry.set_value('%.2f' % calculated_current)
|
self.ui.cvalue_entry.set_value('%.3f' % calculated_current)
|
||||||
self.ui_connect()
|
self.ui_connect()
|
||||||
|
|
||||||
def on_calculate_time(self):
|
def ep_calculate_procedure_time(self):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
:return:
|
:return:
|
||||||
@@ -321,12 +326,12 @@ class ToolCalculator(AppTool):
|
|||||||
self.ui.time_entry.set_value('%.1f' % calculated_time)
|
self.ui.time_entry.set_value('%.1f' % calculated_time)
|
||||||
self.ui_connect()
|
self.ui_connect()
|
||||||
|
|
||||||
def on_calculate_eplate(self):
|
def ep_calculate_output(self):
|
||||||
self.on_calculate_time()
|
self.ep_calculate_procedure_time()
|
||||||
self.on_calculate_current()
|
self.ep_calculate_current()
|
||||||
self.app.inform.emit('[success] %s' % _("Done."))
|
self.app.inform.emit('[success] %s' % _("Done."))
|
||||||
|
|
||||||
def on_calculate_growth(self):
|
def ep_calculate_copper_growth(self):
|
||||||
self.ui_disconnect()
|
self.ui_disconnect()
|
||||||
density = self.ui.cdensity_entry.get_value()
|
density = self.ui.cdensity_entry.get_value()
|
||||||
g_time = self.ui.time_entry.get_value()
|
g_time = self.ui.time_entry.get_value()
|
||||||
@@ -404,19 +409,27 @@ class ToolCalculator(AppTool):
|
|||||||
self.ui.calculate_vshape_button.clicked.connect(self.on_calculate_tool_dia)
|
self.ui.calculate_vshape_button.clicked.connect(self.on_calculate_tool_dia)
|
||||||
|
|
||||||
# Electroplating Calculator
|
# Electroplating Calculator
|
||||||
self.ui.cdensity_entry.valueChanged.connect(self.on_calculate_eplate)
|
self.ui.cdensity_entry.valueChanged.connect(self.on_density_changed)
|
||||||
self.ui.cdensity_entry.returnPressed.connect(self.on_calculate_eplate)
|
self.ui.growth_entry.valueChanged.connect(self.on_growth_changed)
|
||||||
|
if self.ui.area_sel_radio.get_value() == 'a': # 'area'
|
||||||
|
self.ui.area_entry.valueChanged.connect(self.on_dims_changed)
|
||||||
|
else:
|
||||||
|
self.ui.pcblength_entry.valueChanged.connect(self.on_dims_changed)
|
||||||
|
self.ui.pcbwidth_entry.valueChanged.connect(self.on_dims_changed)
|
||||||
|
self.ui.time_entry.valueChanged.connect(self.on_time_changed)
|
||||||
|
|
||||||
self.ui.growth_entry.valueChanged.connect(self.on_calculate_time)
|
def on_density_changed(self):
|
||||||
self.ui.growth_entry.returnPressed.connect(self.on_calculate_time)
|
self.ep_calculate_output()
|
||||||
|
|
||||||
self.ui.area_entry.valueChanged.connect(self.on_calculate_current)
|
def on_growth_changed(self):
|
||||||
self.ui.area_entry.returnPressed.connect(self.on_calculate_current)
|
self.ep_calculate_output()
|
||||||
|
|
||||||
self.ui.time_entry.valueChanged.connect(self.on_calculate_growth)
|
def on_dims_changed(self):
|
||||||
self.ui.time_entry.returnPressed.connect(self.on_calculate_growth)
|
self.ep_calculate_output()
|
||||||
|
|
||||||
self.ui.calculate_plate_button.clicked.connect(self.on_calculate_eplate)
|
def on_time_changed(self):
|
||||||
|
self.ep_calculate_copper_growth()
|
||||||
|
self.ep_calculate_output()
|
||||||
|
|
||||||
def ui_disconnect(self):
|
def ui_disconnect(self):
|
||||||
# V-Shape Calculator
|
# V-Shape Calculator
|
||||||
@@ -458,26 +471,22 @@ class ToolCalculator(AppTool):
|
|||||||
self.ui.cdensity_entry.valueChanged.disconnect()
|
self.ui.cdensity_entry.valueChanged.disconnect()
|
||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError):
|
||||||
pass
|
pass
|
||||||
try:
|
|
||||||
self.ui.cdensity_entry.returnPressed.disconnect()
|
|
||||||
except (AttributeError, TypeError):
|
|
||||||
pass
|
|
||||||
# Growth
|
# Growth
|
||||||
try:
|
try:
|
||||||
self.ui.growth_entry.valueChanged.disconnect()
|
self.ui.growth_entry.valueChanged.disconnect()
|
||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError):
|
||||||
pass
|
pass
|
||||||
try:
|
|
||||||
self.ui.growth_entry.returnPressed.disconnect()
|
|
||||||
except (AttributeError, TypeError):
|
|
||||||
pass
|
|
||||||
# Area
|
# Area
|
||||||
try:
|
try:
|
||||||
self.ui.area_entry.valueChanged.disconnect()
|
self.ui.area_entry.valueChanged.disconnect()
|
||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError):
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
self.ui.area_entry.returnPressed.disconnect()
|
self.ui.pcblength_entry.valueChanged.disconnect()
|
||||||
|
except (AttributeError, TypeError):
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
self.ui.pcbwidth_entry.valueChanged.disconnect()
|
||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError):
|
||||||
pass
|
pass
|
||||||
# Time
|
# Time
|
||||||
@@ -485,15 +494,6 @@ class ToolCalculator(AppTool):
|
|||||||
self.ui.time_entry.valueChanged.disconnect()
|
self.ui.time_entry.valueChanged.disconnect()
|
||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError):
|
||||||
pass
|
pass
|
||||||
try:
|
|
||||||
self.ui.time_entry.returnPressed.disconnect()
|
|
||||||
except (AttributeError, TypeError):
|
|
||||||
pass
|
|
||||||
# Calculate
|
|
||||||
try:
|
|
||||||
self.ui.calculate_plate_button.clicked.disconnect()
|
|
||||||
except (AttributeError, TypeError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class CalcUI:
|
class CalcUI:
|
||||||
@@ -680,7 +680,10 @@ class CalcUI:
|
|||||||
# grid_electro.addWidget(FCLabel(""), 0, 0, 1, 2)
|
# grid_electro.addWidget(FCLabel(""), 0, 0, 1, 2)
|
||||||
|
|
||||||
# Area Calculation
|
# Area Calculation
|
||||||
self.area_sel_label = FCLabel('%s:' % _("Area Calculation"))
|
self.area_sel_label = FCLabel('%s:' % _("Area Calculation"), bold=True)
|
||||||
|
grid_electro.addWidget(self.area_sel_label, 4, 0)
|
||||||
|
|
||||||
|
# Area Choice
|
||||||
self.area_sel_label.setToolTip(
|
self.area_sel_label.setToolTip(
|
||||||
_("Determine the board area.")
|
_("Determine the board area.")
|
||||||
)
|
)
|
||||||
@@ -689,7 +692,6 @@ class CalcUI:
|
|||||||
{"label": _("Area"), "value": "a"}
|
{"label": _("Area"), "value": "a"}
|
||||||
], compact=True)
|
], compact=True)
|
||||||
|
|
||||||
grid_electro.addWidget(self.area_sel_label, 4, 0)
|
|
||||||
grid_electro.addWidget(self.area_sel_radio, 6, 0, 1, 2)
|
grid_electro.addWidget(self.area_sel_radio, 6, 0, 1, 2)
|
||||||
|
|
||||||
# BOARD LENGTH
|
# BOARD LENGTH
|
||||||
@@ -795,6 +797,15 @@ class CalcUI:
|
|||||||
grid_electro.addWidget(self.growth_label, 18, 0)
|
grid_electro.addWidget(self.growth_label, 18, 0)
|
||||||
grid_electro.addLayout(g_hlay, 18, 1)
|
grid_electro.addLayout(g_hlay, 18, 1)
|
||||||
|
|
||||||
|
self.separator_line = QtWidgets.QFrame()
|
||||||
|
self.separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
|
||||||
|
self.separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
|
||||||
|
grid_electro.addWidget(self.separator_line, 20, 0, 1, 2)
|
||||||
|
|
||||||
|
# Output values
|
||||||
|
self.output_lbl = FCLabel('%s' % _("Output"), bold=True)
|
||||||
|
grid_electro.addWidget(self.output_lbl, 22, 0)
|
||||||
|
|
||||||
# CURRENT
|
# CURRENT
|
||||||
self.cvaluelabel = FCLabel('%s:' % _("Current Value"))
|
self.cvaluelabel = FCLabel('%s:' % _("Current Value"))
|
||||||
self.cvaluelabel.setToolTip(_('This is the current intensity value\n'
|
self.cvaluelabel.setToolTip(_('This is the current intensity value\n'
|
||||||
@@ -814,8 +825,8 @@ class CalcUI:
|
|||||||
c_hlay.addWidget(self.cvalue_entry)
|
c_hlay.addWidget(self.cvalue_entry)
|
||||||
c_hlay.addWidget(current_unit)
|
c_hlay.addWidget(current_unit)
|
||||||
|
|
||||||
grid_electro.addWidget(self.cvaluelabel, 20, 0)
|
grid_electro.addWidget(self.cvaluelabel, 24, 0)
|
||||||
grid_electro.addLayout(c_hlay, 20, 1)
|
grid_electro.addLayout(c_hlay, 24, 1)
|
||||||
|
|
||||||
# TIME
|
# TIME
|
||||||
self.timelabel = FCLabel('%s:' % _("Time"))
|
self.timelabel = FCLabel('%s:' % _("Time"))
|
||||||
@@ -835,16 +846,8 @@ class CalcUI:
|
|||||||
t_hlay.addWidget(self.time_entry)
|
t_hlay.addWidget(self.time_entry)
|
||||||
t_hlay.addWidget(time_unit)
|
t_hlay.addWidget(time_unit)
|
||||||
|
|
||||||
grid_electro.addWidget(self.timelabel, 22, 0)
|
grid_electro.addWidget(self.timelabel, 26, 0)
|
||||||
grid_electro.addLayout(t_hlay, 22, 1)
|
grid_electro.addLayout(t_hlay, 26, 1)
|
||||||
|
|
||||||
# ## Buttons
|
|
||||||
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.")
|
|
||||||
)
|
|
||||||
grid_electro.addWidget(self.calculate_plate_button, 24, 0, 1, 2)
|
|
||||||
|
|
||||||
# #############################################################################################################
|
# #############################################################################################################
|
||||||
# ############################## Tinning Calculator ###############################################
|
# ############################## Tinning Calculator ###############################################
|
||||||
|
|||||||
Reference in New Issue
Block a user