ToolsCalculatorsPrefGroupUI.py 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. from PyQt5 import QtWidgets
  2. from PyQt5.QtCore import QSettings
  3. from appGUI.GUIElements import FCDoubleSpinner, FCLabel
  4. from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
  5. import gettext
  6. import appTranslation as fcTranslate
  7. import builtins
  8. fcTranslate.apply_language('strings')
  9. if '_' not in builtins.__dict__:
  10. _ = gettext.gettext
  11. settings = QSettings("Open Source", "FlatCAM")
  12. if settings.contains("machinist"):
  13. machinist_setting = settings.value('machinist', type=int)
  14. else:
  15. machinist_setting = 0
  16. class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
  17. def __init__(self, decimals=4, parent=None):
  18. # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent)
  19. super(ToolsCalculatorsPrefGroupUI, self).__init__(self, parent=parent)
  20. self.setTitle(str(_("Calculators Tool Options")))
  21. self.decimals = decimals
  22. # ## V-shape Calculator Tool
  23. self.vshape_tool_label = FCLabel("<b>%s:</b>" % _("V-Shape Tool Calculator"))
  24. self.vshape_tool_label.setToolTip(
  25. _("Calculate the tool diameter for a given V-shape tool,\n"
  26. "having the tip diameter, tip angle and\n"
  27. "depth-of-cut as parameters.")
  28. )
  29. self.layout.addWidget(self.vshape_tool_label)
  30. grid0 = QtWidgets.QGridLayout()
  31. grid0.setColumnStretch(0, 0)
  32. grid0.setColumnStretch(1, 1)
  33. self.layout.addLayout(grid0)
  34. # ## Tip Diameter
  35. self.tip_dia_entry = FCDoubleSpinner()
  36. self.tip_dia_entry.set_range(0.000001, 10000.0000)
  37. self.tip_dia_entry.set_precision(self.decimals)
  38. self.tip_dia_entry.setSingleStep(0.1)
  39. self.tip_dia_label = FCLabel('%s:' % _("Tip Diameter"))
  40. self.tip_dia_label.setToolTip(
  41. _("This is the tool tip diameter.\n"
  42. "It is specified by manufacturer.")
  43. )
  44. grid0.addWidget(self.tip_dia_label, 0, 0)
  45. grid0.addWidget(self.tip_dia_entry, 0, 1)
  46. # ## Tip angle
  47. self.tip_angle_entry = FCDoubleSpinner()
  48. self.tip_angle_entry.set_range(0.0, 180.0)
  49. self.tip_angle_entry.set_precision(self.decimals)
  50. self.tip_angle_entry.setSingleStep(5)
  51. self.tip_angle_label = FCLabel('%s:' % _("Tip Angle"))
  52. self.tip_angle_label.setToolTip(
  53. _("This is the angle on the tip of the tool.\n"
  54. "It is specified by manufacturer.")
  55. )
  56. grid0.addWidget(self.tip_angle_label, 2, 0)
  57. grid0.addWidget(self.tip_angle_entry, 2, 1)
  58. # ## Depth-of-cut Cut Z
  59. self.cut_z_entry = FCDoubleSpinner()
  60. self.cut_z_entry.set_range(-10000.0000, 0.0000)
  61. self.cut_z_entry.set_precision(self.decimals)
  62. self.cut_z_entry.setSingleStep(0.01)
  63. self.cut_z_label = FCLabel('%s:' % _("Cut Z"))
  64. self.cut_z_label.setToolTip(
  65. _("This is depth to cut into material.\n"
  66. "In the CNCJob object it is the CutZ parameter.")
  67. )
  68. grid0.addWidget(self.cut_z_label, 4, 0)
  69. grid0.addWidget(self.cut_z_entry, 4, 1)
  70. # ## Electroplating Calculator Tool
  71. self.plate_title_label = FCLabel("<b>%s:</b>" % _("ElectroPlating Calculator"))
  72. self.plate_title_label.setToolTip(
  73. _("This calculator is useful for those who plate the via/pad/drill holes,\n"
  74. "using a method like graphite ink or calcium hypophosphite ink or palladium chloride.")
  75. )
  76. grid0.addWidget(self.plate_title_label, 3, 0, 1, 2)
  77. # ## PCB Length
  78. self.pcblength_entry = FCDoubleSpinner()
  79. self.pcblength_entry.set_range(0.000001, 10000.0000)
  80. self.pcblength_entry.set_precision(self.decimals)
  81. self.pcblength_entry.setSingleStep(0.1)
  82. self.pcblengthlabel = FCLabel('%s:' % _("Board Length"))
  83. self.pcblengthlabel.setToolTip(_('This is the board length. In centimeters.'))
  84. grid0.addWidget(self.pcblengthlabel, 6, 0)
  85. grid0.addWidget(self.pcblength_entry, 6, 1)
  86. # ## PCB Width
  87. self.pcbwidth_entry = FCDoubleSpinner()
  88. self.pcbwidth_entry.set_range(0.000001, 10000.0000)
  89. self.pcbwidth_entry.set_precision(self.decimals)
  90. self.pcbwidth_entry.setSingleStep(0.1)
  91. self.pcbwidthlabel = FCLabel('%s:' % _("Board Width"))
  92. self.pcbwidthlabel.setToolTip(_('This is the board width.In centimeters.'))
  93. grid0.addWidget(self.pcbwidthlabel, 8, 0)
  94. grid0.addWidget(self.pcbwidth_entry, 8, 1)
  95. # AREA
  96. self.area_label = FCLabel('%s:' % _("Area"))
  97. self.area_label.setToolTip(_('This is the board area.'))
  98. self.area_entry = FCDoubleSpinner()
  99. self.area_entry.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
  100. self.area_entry.set_precision(self.decimals)
  101. self.area_entry.set_range(0.0, 10000.0000)
  102. grid0.addWidget(self.area_label, 10, 0)
  103. grid0.addWidget(self.area_entry, 10, 1)
  104. # ## Current Density
  105. self.cdensity_label = FCLabel('%s:' % _("Current Density"))
  106. self.cdensity_entry = FCDoubleSpinner()
  107. self.cdensity_entry.set_range(0.000001, 10000.0000)
  108. self.cdensity_entry.set_precision(self.decimals)
  109. self.cdensity_entry.setSingleStep(0.1)
  110. self.cdensity_label.setToolTip(_("Current density to pass through the board. \n"
  111. "In Amps per Square Feet ASF."))
  112. grid0.addWidget(self.cdensity_label, 12, 0)
  113. grid0.addWidget(self.cdensity_entry, 12, 1)
  114. # ## PCB Copper Growth
  115. self.growth_label = FCLabel('%s:' % _("Copper Growth"))
  116. self.growth_entry = FCDoubleSpinner()
  117. self.growth_entry.set_range(0.000001, 10000.0000)
  118. self.growth_entry.set_precision(self.decimals)
  119. self.growth_entry.setSingleStep(0.01)
  120. self.growth_label.setToolTip(_("How thick the copper growth is intended to be.\n"
  121. "In microns."))
  122. grid0.addWidget(self.growth_label, 14, 0)
  123. grid0.addWidget(self.growth_entry, 14, 1)
  124. self.layout.addStretch()