ToolCalculators.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. # ##########################################################
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # File Author: Marius Adrian Stanciu (c) #
  4. # Date: 3/10/2019 #
  5. # MIT Licence #
  6. # ##########################################################
  7. from PyQt5 import QtWidgets, QtGui
  8. from appTool import AppTool
  9. from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, NumericalEvalEntry, FCLabel, RadioSet, FCButton
  10. import math
  11. import gettext
  12. import appTranslation as fcTranslate
  13. import builtins
  14. fcTranslate.apply_language('strings')
  15. if '_' not in builtins.__dict__:
  16. _ = gettext.gettext
  17. class ToolCalculator(AppTool):
  18. def __init__(self, app):
  19. AppTool.__init__(self, app)
  20. self.app = app
  21. self.decimals = self.app.decimals
  22. # #############################################################################
  23. # ######################### Tool GUI ##########################################
  24. # #############################################################################
  25. self.ui = CalcUI(layout=self.layout, app=self.app)
  26. self.toolName = self.ui.toolName
  27. self.units = ''
  28. # ## Signals
  29. self.ui.cutDepth_entry.valueChanged.connect(self.on_calculate_tool_dia)
  30. self.ui.cutDepth_entry.returnPressed.connect(self.on_calculate_tool_dia)
  31. self.ui.tipDia_entry.returnPressed.connect(self.on_calculate_tool_dia)
  32. self.ui.tipAngle_entry.returnPressed.connect(self.on_calculate_tool_dia)
  33. self.ui.calculate_vshape_button.clicked.connect(self.on_calculate_tool_dia)
  34. self.ui.mm_entry.editingFinished.connect(self.on_calculate_inch_units)
  35. self.ui.inch_entry.editingFinished.connect(self.on_calculate_mm_units)
  36. self.ui.calculate_plate_button.clicked.connect(self.on_calculate_eplate)
  37. self.ui.reset_button.clicked.connect(self.set_tool_ui)
  38. self.ui.area_sel_radio.activated_custom.connect(self.on_area_calculation_radio)
  39. def run(self, toggle=True):
  40. self.app.defaults.report_usage("ToolCalculators()")
  41. if toggle:
  42. # if the splitter is hidden, display it, else hide it but only if the current widget is the same
  43. if self.app.ui.splitter.sizes()[0] == 0:
  44. self.app.ui.splitter.setSizes([1, 1])
  45. else:
  46. try:
  47. if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
  48. # if tab is populated with the tool but it does not have the focus, focus on it
  49. if not self.app.ui.notebook.currentWidget() is self.app.ui.tool_tab:
  50. # focus on Tool Tab
  51. self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab)
  52. else:
  53. self.app.ui.splitter.setSizes([0, 1])
  54. except AttributeError:
  55. pass
  56. else:
  57. if self.app.ui.splitter.sizes()[0] == 0:
  58. self.app.ui.splitter.setSizes([1, 1])
  59. AppTool.run(self)
  60. self.set_tool_ui()
  61. self.app.ui.notebook.setTabText(2, _("Calc. Tool"))
  62. def install(self, icon=None, separator=None, **kwargs):
  63. AppTool.install(self, icon, separator, shortcut='Alt+C', **kwargs)
  64. def set_tool_ui(self):
  65. self.units = self.app.defaults['units'].lower()
  66. # ## Initialize form
  67. self.ui.mm_entry.set_value('%.*f' % (self.decimals, 0))
  68. self.ui.inch_entry.set_value('%.*f' % (self.decimals, 0))
  69. length = self.app.defaults["tools_calc_electro_length"]
  70. width = self.app.defaults["tools_calc_electro_width"]
  71. density = self.app.defaults["tools_calc_electro_cdensity"]
  72. growth = self.app.defaults["tools_calc_electro_growth"]
  73. self.ui.pcblength_entry.set_value(length)
  74. self.ui.pcbwidth_entry.set_value(width)
  75. self.ui.area_entry.set_value(self.app.defaults["tools_calc_electro_area"])
  76. self.ui.cdensity_entry.set_value(density)
  77. self.ui.growth_entry.set_value(growth)
  78. self.ui.cvalue_entry.set_value(0.00)
  79. self.ui.time_entry.set_value(0.0)
  80. tip_dia = self.app.defaults["tools_calc_vshape_tip_dia"]
  81. tip_angle = self.app.defaults["tools_calc_vshape_tip_angle"]
  82. cut_z = self.app.defaults["tools_calc_vshape_cut_z"]
  83. self.ui.tipDia_entry.set_value(tip_dia)
  84. self.ui.tipAngle_entry.set_value(tip_angle)
  85. self.ui.cutDepth_entry.set_value(cut_z)
  86. self.ui.effectiveToolDia_entry.set_value('0.0000')
  87. self.ui.area_sel_radio.set_value('d')
  88. self.on_area_calculation_radio(val='d')
  89. def on_area_calculation_radio(self, val):
  90. if val == 'a':
  91. self.ui.pcbwidthlabel.hide()
  92. self.ui.pcbwidth_entry.hide()
  93. self.ui.width_unit.hide()
  94. self.ui.pcblengthlabel.hide()
  95. self.ui.pcblength_entry.hide()
  96. self.ui.length_unit.hide()
  97. self.ui.area_label.show()
  98. self.ui.area_entry.show()
  99. self.ui.area_unit.show()
  100. else:
  101. self.ui.pcbwidthlabel.show()
  102. self.ui.pcbwidth_entry.show()
  103. self.ui.width_unit.show()
  104. self.ui.pcblengthlabel.show()
  105. self.ui.pcblength_entry.show()
  106. self.ui.length_unit.show()
  107. self.ui.area_label.hide()
  108. self.ui.area_entry.hide()
  109. self.ui.area_unit.hide()
  110. def on_calculate_tool_dia(self):
  111. # Calculation:
  112. # Manufacturer gives total angle of the the tip but we need only half of it
  113. # tangent(half_tip_angle) = opposite side / adjacent = part_of _real_dia / depth_of_cut
  114. # effective_diameter = tip_diameter + part_of_real_dia_left_side + part_of_real_dia_right_side
  115. # tool is symmetrical therefore: part_of_real_dia_left_side = part_of_real_dia_right_side
  116. # effective_diameter = tip_diameter + (2 * part_of_real_dia_left_side)
  117. # effective diameter = tip_diameter + (2 * depth_of_cut * tangent(half_tip_angle))
  118. tip_diameter = float(self.ui.tipDia_entry.get_value())
  119. half_tip_angle = float(self.ui.tipAngle_entry.get_value()) / 2.0
  120. cut_depth = float(self.ui.cutDepth_entry.get_value())
  121. cut_depth = -cut_depth if cut_depth < 0 else cut_depth
  122. tool_diameter = tip_diameter + (2 * cut_depth * math.tan(math.radians(half_tip_angle)))
  123. self.ui.effectiveToolDia_entry.set_value(self.app.dec_format(tool_diameter, self.decimals))
  124. def on_calculate_inch_units(self):
  125. mm_val = float(self.ui.mm_entry.get_value())
  126. self.ui.inch_entry.set_value('%.*f' % (self.decimals, (mm_val / 25.4)))
  127. def on_calculate_mm_units(self):
  128. inch_val = float(self.ui.inch_entry.get_value())
  129. self.ui.mm_entry.set_value('%.*f' % (self.decimals, (inch_val * 25.4)))
  130. def on_calculate_eplate(self):
  131. area_calc_sel = self.ui.area_sel_radio.get_value()
  132. length = self.ui.pcblength_entry.get_value()
  133. width = self.ui.pcbwidth_entry.get_value()
  134. area = self.ui.area_entry.get_value()
  135. density = self.ui.cdensity_entry.get_value()
  136. copper = self.ui.growth_entry.get_value()
  137. if area_calc_sel == 'd':
  138. calculated_current = (length * width * density) * 0.0021527820833419
  139. else:
  140. calculated_current = (area * density) * 0.0021527820833419
  141. calculated_time = copper * 2.142857142857143 * float(20 / density)
  142. self.ui.cvalue_entry.set_value('%.2f' % calculated_current)
  143. self.ui.time_entry.set_value('%.1f' % calculated_time)
  144. class CalcUI:
  145. toolName = _("Calculators")
  146. v_shapeName = _("V-Shape Tool Calculator")
  147. unitsName = _("Units Calculator")
  148. eplateName = _("ElectroPlating Calculator")
  149. def __init__(self, layout, app):
  150. self.app = app
  151. self.decimals = self.app.decimals
  152. self.layout = layout
  153. self.units = self.app.defaults['units'].lower()
  154. # ## Title
  155. title_label = FCLabel("%s" % self.toolName)
  156. title_label.setStyleSheet("""
  157. QLabel
  158. {
  159. font-size: 16px;
  160. font-weight: bold;
  161. }
  162. """)
  163. self.layout.addWidget(title_label)
  164. # #####################
  165. # ## Units Calculator #
  166. # #####################
  167. self.unists_spacer_label = FCLabel(" ")
  168. self.layout.addWidget(self.unists_spacer_label)
  169. # ## Title of the Units Calculator
  170. units_label = FCLabel("<font size=3><b>%s</b></font>" % self.unitsName)
  171. self.layout.addWidget(units_label)
  172. # Grid Layout
  173. grid_units_layout = QtWidgets.QGridLayout()
  174. self.layout.addLayout(grid_units_layout)
  175. inch_label = FCLabel(_("INCH"))
  176. mm_label = FCLabel(_("MM"))
  177. grid_units_layout.addWidget(mm_label, 0, 0)
  178. grid_units_layout.addWidget(inch_label, 0, 1)
  179. self.inch_entry = NumericalEvalEntry(border_color='#0069A9')
  180. # self.inch_entry.setFixedWidth(70)
  181. # self.inch_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
  182. self.inch_entry.setToolTip(_("Here you enter the value to be converted from INCH to MM"))
  183. self.mm_entry = NumericalEvalEntry(border_color='#0069A9')
  184. # self.mm_entry.setFixedWidth(130)
  185. # self.mm_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
  186. self.mm_entry.setToolTip(_("Here you enter the value to be converted from MM to INCH"))
  187. grid_units_layout.addWidget(self.mm_entry, 1, 0)
  188. grid_units_layout.addWidget(self.inch_entry, 1, 1)
  189. # ##############################
  190. # ## V-shape Tool Calculator ###
  191. # ##############################
  192. self.v_shape_spacer_label = FCLabel(" ")
  193. self.layout.addWidget(self.v_shape_spacer_label)
  194. # ## Title of the V-shape Tools Calculator
  195. v_shape_title_label = FCLabel("<font size=3><b>%s</b></font>" % self.v_shapeName)
  196. self.layout.addWidget(v_shape_title_label)
  197. # ## Form Layout
  198. form_layout = QtWidgets.QFormLayout()
  199. self.layout.addLayout(form_layout)
  200. self.tipDia_label = FCLabel('%s:' % _("Tip Diameter"))
  201. self.tipDia_entry = FCDoubleSpinner(callback=self.confirmation_message)
  202. self.tipDia_entry.set_precision(self.decimals)
  203. self.tipDia_entry.set_range(0.0, 10000.0000)
  204. self.tipDia_entry.setSingleStep(0.1)
  205. # self.tipDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
  206. self.tipDia_label.setToolTip(
  207. _("This is the tool tip diameter.\n"
  208. "It is specified by manufacturer.")
  209. )
  210. self.tipAngle_label = FCLabel('%s:' % _("Tip Angle"))
  211. self.tipAngle_entry = FCSpinner(callback=self.confirmation_message_int)
  212. self.tipAngle_entry.set_range(0, 180)
  213. self.tipAngle_entry.set_step(5)
  214. # self.tipAngle_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
  215. self.tipAngle_label.setToolTip(_("This is the angle of the tip of the tool.\n"
  216. "It is specified by manufacturer."))
  217. self.cutDepth_label = FCLabel('%s:' % _("Cut Z"))
  218. self.cutDepth_entry = FCDoubleSpinner(callback=self.confirmation_message)
  219. self.cutDepth_entry.set_range(-10000.0000, 10000.0000)
  220. self.cutDepth_entry.set_precision(self.decimals)
  221. # self.cutDepth_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
  222. self.cutDepth_label.setToolTip(_("This is the depth to cut into the material.\n"
  223. "In the CNCJob is the CutZ parameter."))
  224. self.effectiveToolDia_label = FCLabel('%s:' % _("Tool Diameter"))
  225. self.effectiveToolDia_entry = FCDoubleSpinner(callback=self.confirmation_message)
  226. self.effectiveToolDia_entry.set_precision(self.decimals)
  227. # self.effectiveToolDia_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
  228. self.effectiveToolDia_label.setToolTip(_("This is the tool diameter to be entered into\n"
  229. "FlatCAM Gerber section.\n"
  230. "In the CNCJob section it is called >Tool dia<."))
  231. # self.effectiveToolDia_entry.setEnabled(False)
  232. form_layout.addRow(self.tipDia_label, self.tipDia_entry)
  233. form_layout.addRow(self.tipAngle_label, self.tipAngle_entry)
  234. form_layout.addRow(self.cutDepth_label, self.cutDepth_entry)
  235. form_layout.addRow(self.effectiveToolDia_label, self.effectiveToolDia_entry)
  236. # ## Buttons
  237. self.calculate_vshape_button = FCButton(_("Calculate"))
  238. self.calculate_vshape_button.setIcon(QtGui.QIcon(self.app.resource_location + '/calculator16.png'))
  239. self.calculate_vshape_button.setToolTip(
  240. _("Calculate either the Cut Z or the effective tool diameter,\n "
  241. "depending on which is desired and which is known. ")
  242. )
  243. self.layout.addWidget(self.calculate_vshape_button)
  244. # ####################################
  245. # ## ElectroPlating Tool Calculator ##
  246. # ####################################
  247. self.layout.addWidget(FCLabel(""))
  248. # ## Title of the ElectroPlating Tools Calculator
  249. plate_title_label = FCLabel("<font size=3><b>%s</b></font>" % self.eplateName)
  250. plate_title_label.setToolTip(
  251. _("This calculator is useful for those who plate the via/pad/drill holes,\n"
  252. "using a method like graphite ink or calcium hypophosphite ink or palladium chloride.")
  253. )
  254. self.layout.addWidget(plate_title_label)
  255. # ## Plate Form Layout
  256. grid2 = QtWidgets.QGridLayout()
  257. grid2.setColumnStretch(0, 0)
  258. grid2.setColumnStretch(1, 1)
  259. self.layout.addLayout(grid2)
  260. # Area Calculation
  261. self.area_sel_label = FCLabel('%s:' % _("Area Calculation"))
  262. self.area_sel_label.setToolTip(
  263. _("Choose how to calculate the board area.")
  264. )
  265. self.area_sel_radio = RadioSet([
  266. {'label': _('Dimensions'), 'value': 'd'},
  267. {"label": _("Area"), "value": "a"}
  268. ], stretch=False)
  269. grid2.addWidget(self.area_sel_label, 0, 0)
  270. grid2.addWidget(self.area_sel_radio, 1, 0, 1, 2)
  271. # BOARD LENGTH
  272. self.pcblengthlabel = FCLabel('%s:' % _("Board Length"))
  273. self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
  274. self.pcblength_entry = FCDoubleSpinner(callback=self.confirmation_message)
  275. self.pcblength_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
  276. self.pcblength_entry.set_precision(self.decimals)
  277. self.pcblength_entry.set_range(0.0, 10000.0000)
  278. self.length_unit = FCLabel('%s' % _("cm"))
  279. self.length_unit.setMinimumWidth(25)
  280. l_hlay = QtWidgets.QHBoxLayout()
  281. l_hlay.addWidget(self.pcblength_entry)
  282. l_hlay.addWidget(self.length_unit)
  283. grid2.addWidget(self.pcblengthlabel, 2, 0)
  284. grid2.addLayout(l_hlay, 2, 1)
  285. # BOARD WIDTH
  286. self.pcbwidthlabel = FCLabel('%s:' % _("Board Width"))
  287. self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
  288. self.pcbwidth_entry = FCDoubleSpinner(callback=self.confirmation_message)
  289. self.pcbwidth_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
  290. self.pcbwidth_entry.set_precision(self.decimals)
  291. self.pcbwidth_entry.set_range(0.0, 10000.0000)
  292. self.width_unit = FCLabel('%s' % _("cm"))
  293. self.width_unit.setMinimumWidth(25)
  294. w_hlay = QtWidgets.QHBoxLayout()
  295. w_hlay.addWidget(self.pcbwidth_entry)
  296. w_hlay.addWidget(self.width_unit)
  297. grid2.addWidget(self.pcbwidthlabel, 4, 0)
  298. grid2.addLayout(w_hlay, 4, 1)
  299. # AREA
  300. self.area_label = FCLabel('%s:' % _("Area"))
  301. self.area_label.setToolTip(_('This is the board area.'))
  302. self.area_entry = FCDoubleSpinner(callback=self.confirmation_message)
  303. self.area_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
  304. self.area_entry.set_precision(self.decimals)
  305. self.area_entry.set_range(0.0, 10000.0000)
  306. self.area_unit = FCLabel('%s<sup>2</sup>' % _("cm"))
  307. self.area_unit.setMinimumWidth(25)
  308. a_hlay = QtWidgets.QHBoxLayout()
  309. a_hlay.addWidget(self.area_entry)
  310. a_hlay.addWidget(self.area_unit)
  311. grid2.addWidget(self.area_label, 6, 0)
  312. grid2.addLayout(a_hlay, 6, 1)
  313. separator_line = QtWidgets.QFrame()
  314. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  315. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  316. grid2.addWidget(separator_line, 7, 0, 1, 2)
  317. # DENSITY
  318. self.cdensity_label = FCLabel('%s:' % _("Current Density"))
  319. self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
  320. "In Amps per Square Feet ASF."))
  321. self.cdensity_entry = FCDoubleSpinner(callback=self.confirmation_message)
  322. self.cdensity_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
  323. self.cdensity_entry.set_precision(self.decimals)
  324. self.cdensity_entry.set_range(0.0, 10000.0000)
  325. self.cdensity_entry.setSingleStep(0.1)
  326. density_unit = FCLabel('%s' % "ASF")
  327. density_unit.setMinimumWidth(25)
  328. d_hlay = QtWidgets.QHBoxLayout()
  329. d_hlay.addWidget(self.cdensity_entry)
  330. d_hlay.addWidget(density_unit)
  331. grid2.addWidget(self.cdensity_label, 8, 0)
  332. grid2.addLayout(d_hlay, 8, 1)
  333. # COPPER GROWTH
  334. self.growth_label = FCLabel('%s:' % _("Copper Growth"))
  335. self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
  336. "In microns."))
  337. self.growth_entry = FCDoubleSpinner(callback=self.confirmation_message)
  338. self.growth_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
  339. self.growth_entry.set_precision(self.decimals)
  340. self.growth_entry.set_range(0.0, 10000.0000)
  341. self.growth_entry.setSingleStep(0.01)
  342. growth_unit = FCLabel('%s' % _("um"))
  343. growth_unit.setMinimumWidth(25)
  344. g_hlay = QtWidgets.QHBoxLayout()
  345. g_hlay.addWidget(self.growth_entry)
  346. g_hlay.addWidget(growth_unit)
  347. grid2.addWidget(self.growth_label, 10, 0)
  348. grid2.addLayout(g_hlay, 10, 1)
  349. # CURRENT
  350. self.cvaluelabel = FCLabel('%s:' % _("Current Value"))
  351. self.cvaluelabel.setToolTip(_('This is the current intensity value\n'
  352. 'to be set on the Power Supply. In Amps.'))
  353. self.cvalue_entry = FCDoubleSpinner(callback=self.confirmation_message)
  354. self.cvalue_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
  355. self.cvalue_entry.set_precision(self.decimals)
  356. self.cvalue_entry.set_range(0.0, 10000.0000)
  357. self.cvalue_entry.setSingleStep(0.1)
  358. current_unit = FCLabel('%s' % "A")
  359. current_unit.setMinimumWidth(25)
  360. self.cvalue_entry.setReadOnly(True)
  361. c_hlay = QtWidgets.QHBoxLayout()
  362. c_hlay.addWidget(self.cvalue_entry)
  363. c_hlay.addWidget(current_unit)
  364. grid2.addWidget(self.cvaluelabel, 12, 0)
  365. grid2.addLayout(c_hlay, 12, 1)
  366. # TIME
  367. self.timelabel = FCLabel('%s:' % _("Time"))
  368. self.timelabel.setToolTip(_('This is the calculated time required for the procedure.\n'
  369. 'In minutes.'))
  370. self.time_entry = FCDoubleSpinner(callback=self.confirmation_message)
  371. self.time_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
  372. self.time_entry.set_precision(self.decimals)
  373. self.time_entry.set_range(0.0, 10000.0000)
  374. self.time_entry.setSingleStep(0.1)
  375. time_unit = FCLabel('%s' % "min")
  376. time_unit.setMinimumWidth(25)
  377. self.time_entry.setReadOnly(True)
  378. t_hlay = QtWidgets.QHBoxLayout()
  379. t_hlay.addWidget(self.time_entry)
  380. t_hlay.addWidget(time_unit)
  381. grid2.addWidget(self.timelabel, 14, 0)
  382. grid2.addLayout(t_hlay, 14, 1)
  383. # ## Buttons
  384. self.calculate_plate_button = FCButton(_("Calculate"))
  385. self.calculate_plate_button.setIcon(QtGui.QIcon(self.app.resource_location + '/calculator16.png'))
  386. self.calculate_plate_button.setToolTip(
  387. _("Calculate the current intensity value and the procedure time,\n"
  388. "depending on the parameters above")
  389. )
  390. self.layout.addWidget(self.calculate_plate_button)
  391. self.layout.addStretch()
  392. # ## Reset Tool
  393. self.reset_button = FCButton(_("Reset Tool"))
  394. self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png'))
  395. self.reset_button.setToolTip(
  396. _("Will reset the tool parameters.")
  397. )
  398. self.reset_button.setStyleSheet("""
  399. QPushButton
  400. {
  401. font-weight: bold;
  402. }
  403. """)
  404. self.layout.addWidget(self.reset_button)
  405. # #################################### FINSIHED GUI ###########################
  406. # #############################################################################
  407. def confirmation_message(self, accepted, minval, maxval):
  408. if accepted is False:
  409. self.app.inform[str, bool].emit('[WARNING_NOTCL] %s: [%.*f, %.*f]' % (_("Edited value is out of range"),
  410. self.decimals,
  411. minval,
  412. self.decimals,
  413. maxval), False)
  414. else:
  415. self.app.inform[str, bool].emit('[success] %s' % _("Edited value is within limits."), False)
  416. def confirmation_message_int(self, accepted, minval, maxval):
  417. if accepted is False:
  418. self.app.inform[str, bool].emit('[WARNING_NOTCL] %s: [%d, %d]' %
  419. (_("Edited value is out of range"), minval, maxval), False)
  420. else:
  421. self.app.inform[str, bool].emit('[success] %s' % _("Edited value is within limits."), False)