ExcellonEditorPrefGroupUI.py 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. from PyQt5 import QtWidgets
  2. from flatcamGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet
  3. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
  4. class ExcellonEditorPrefGroupUI(OptionsGroupUI):
  5. def __init__(self, decimals=4, parent=None):
  6. super(ExcellonEditorPrefGroupUI, self).__init__(self)
  7. self.setTitle(str(_("Excellon Editor")))
  8. self.decimals = decimals
  9. # Excellon Editor Parameters
  10. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  11. self.param_label.setToolTip(
  12. _("A list of Excellon Editor parameters.")
  13. )
  14. self.layout.addWidget(self.param_label)
  15. grid0 = QtWidgets.QGridLayout()
  16. self.layout.addLayout(grid0)
  17. # Selection Limit
  18. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  19. self.sel_limit_label.setToolTip(
  20. _("Set the number of selected Excellon geometry\n"
  21. "items above which the utility geometry\n"
  22. "becomes just a selection rectangle.\n"
  23. "Increases the performance when moving a\n"
  24. "large number of geometric elements.")
  25. )
  26. self.sel_limit_entry = FCSpinner()
  27. self.sel_limit_entry.set_range(0, 99999)
  28. grid0.addWidget(self.sel_limit_label, 0, 0)
  29. grid0.addWidget(self.sel_limit_entry, 0, 1)
  30. # New Diameter
  31. self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Dia'))
  32. self.addtool_entry_lbl.setToolTip(
  33. _("Diameter for the new tool")
  34. )
  35. self.addtool_entry = FCDoubleSpinner()
  36. self.addtool_entry.set_range(0.000001, 99.9999)
  37. self.addtool_entry.set_precision(self.decimals)
  38. grid0.addWidget(self.addtool_entry_lbl, 1, 0)
  39. grid0.addWidget(self.addtool_entry, 1, 1)
  40. # Number of drill holes in a drill array
  41. self.drill_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of drills'))
  42. self.drill_array_size_label.setToolTip(
  43. _("Specify how many drills to be in the array.")
  44. )
  45. # self.drill_array_size_label.setMinimumWidth(100)
  46. self.drill_array_size_entry = FCSpinner()
  47. self.drill_array_size_entry.set_range(0, 9999)
  48. grid0.addWidget(self.drill_array_size_label, 2, 0)
  49. grid0.addWidget(self.drill_array_size_entry, 2, 1)
  50. self.drill_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Drill Array'))
  51. grid0.addWidget(self.drill_array_linear_label, 3, 0, 1, 2)
  52. # Linear Drill Array direction
  53. self.drill_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  54. self.drill_axis_label.setToolTip(
  55. _("Direction on which the linear array is oriented:\n"
  56. "- 'X' - horizontal axis \n"
  57. "- 'Y' - vertical axis or \n"
  58. "- 'Angle' - a custom angle for the array inclination")
  59. )
  60. # self.drill_axis_label.setMinimumWidth(100)
  61. self.drill_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  62. {'label': _('Y'), 'value': 'Y'},
  63. {'label': _('Angle'), 'value': 'A'}])
  64. grid0.addWidget(self.drill_axis_label, 4, 0)
  65. grid0.addWidget(self.drill_axis_radio, 4, 1)
  66. # Linear Drill Array pitch distance
  67. self.drill_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  68. self.drill_pitch_label.setToolTip(
  69. _("Pitch = Distance between elements of the array.")
  70. )
  71. # self.drill_pitch_label.setMinimumWidth(100)
  72. self.drill_pitch_entry = FCDoubleSpinner()
  73. self.drill_pitch_entry.set_range(0, 99999.9999)
  74. self.drill_pitch_entry.set_precision(self.decimals)
  75. grid0.addWidget(self.drill_pitch_label, 5, 0)
  76. grid0.addWidget(self.drill_pitch_entry, 5, 1)
  77. # Linear Drill Array custom angle
  78. self.drill_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  79. self.drill_angle_label.setToolTip(
  80. _("Angle at which each element in circular array is placed.")
  81. )
  82. self.drill_angle_entry = FCDoubleSpinner()
  83. self.drill_pitch_entry.set_range(-360, 360)
  84. self.drill_pitch_entry.set_precision(self.decimals)
  85. self.drill_angle_entry.setWrapping(True)
  86. self.drill_angle_entry.setSingleStep(5)
  87. grid0.addWidget(self.drill_angle_label, 6, 0)
  88. grid0.addWidget(self.drill_angle_entry, 6, 1)
  89. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Drill Array'))
  90. grid0.addWidget(self.drill_array_circ_label, 7, 0, 1, 2)
  91. # Circular Drill Array direction
  92. self.drill_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  93. self.drill_circular_direction_label.setToolTip(
  94. _("Direction for circular array.\n"
  95. "Can be CW = clockwise or CCW = counter clockwise.")
  96. )
  97. self.drill_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  98. {'label': _('CCW'), 'value': 'CCW'}])
  99. grid0.addWidget(self.drill_circular_direction_label, 8, 0)
  100. grid0.addWidget(self.drill_circular_dir_radio, 8, 1)
  101. # Circular Drill Array Angle
  102. self.drill_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  103. self.drill_circular_angle_label.setToolTip(
  104. _("Angle at which each element in circular array is placed.")
  105. )
  106. self.drill_circular_angle_entry = FCDoubleSpinner()
  107. self.drill_circular_angle_entry.set_range(-360, 360)
  108. self.drill_circular_angle_entry.set_precision(self.decimals)
  109. self.drill_circular_angle_entry.setWrapping(True)
  110. self.drill_circular_angle_entry.setSingleStep(5)
  111. grid0.addWidget(self.drill_circular_angle_label, 9, 0)
  112. grid0.addWidget(self.drill_circular_angle_entry, 9, 1)
  113. # ##### SLOTS #####
  114. # #################
  115. self.drill_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Slots'))
  116. grid0.addWidget(self.drill_array_circ_label, 10, 0, 1, 2)
  117. # Slot length
  118. self.slot_length_label = QtWidgets.QLabel('%s:' % _('Length'))
  119. self.slot_length_label.setToolTip(
  120. _("Length = The length of the slot.")
  121. )
  122. self.slot_length_label.setMinimumWidth(100)
  123. self.slot_length_entry = FCDoubleSpinner()
  124. self.slot_length_entry.set_range(0, 99999)
  125. self.slot_length_entry.set_precision(self.decimals)
  126. self.slot_length_entry.setWrapping(True)
  127. self.slot_length_entry.setSingleStep(1)
  128. grid0.addWidget(self.slot_length_label, 11, 0)
  129. grid0.addWidget(self.slot_length_entry, 11, 1)
  130. # Slot direction
  131. self.slot_axis_label = QtWidgets.QLabel('%s:' % _('Direction'))
  132. self.slot_axis_label.setToolTip(
  133. _("Direction on which the slot is oriented:\n"
  134. "- 'X' - horizontal axis \n"
  135. "- 'Y' - vertical axis or \n"
  136. "- 'Angle' - a custom angle for the slot inclination")
  137. )
  138. self.slot_axis_label.setMinimumWidth(100)
  139. self.slot_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  140. {'label': _('Y'), 'value': 'Y'},
  141. {'label': _('Angle'), 'value': 'A'}])
  142. grid0.addWidget(self.slot_axis_label, 12, 0)
  143. grid0.addWidget(self.slot_axis_radio, 12, 1)
  144. # Slot custom angle
  145. self.slot_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  146. self.slot_angle_label.setToolTip(
  147. _("Angle at which the slot is placed.\n"
  148. "The precision is of max 2 decimals.\n"
  149. "Min value is: -359.99 degrees.\n"
  150. "Max value is: 360.00 degrees.")
  151. )
  152. self.slot_angle_label.setMinimumWidth(100)
  153. self.slot_angle_spinner = FCDoubleSpinner()
  154. self.slot_angle_spinner.set_precision(self.decimals)
  155. self.slot_angle_spinner.setWrapping(True)
  156. self.slot_angle_spinner.setRange(-359.99, 360.00)
  157. self.slot_angle_spinner.setSingleStep(5)
  158. grid0.addWidget(self.slot_angle_label, 13, 0)
  159. grid0.addWidget(self.slot_angle_spinner, 13, 1)
  160. # #### SLOTS ARRAY #######
  161. # ########################
  162. self.slot_array_linear_label = QtWidgets.QLabel('<b>%s:</b>' % _('Linear Slot Array'))
  163. grid0.addWidget(self.slot_array_linear_label, 14, 0, 1, 2)
  164. # Number of slot holes in a drill array
  165. self.slot_array_size_label = QtWidgets.QLabel('%s:' % _('Nr of slots'))
  166. self.drill_array_size_label.setToolTip(
  167. _("Specify how many slots to be in the array.")
  168. )
  169. # self.slot_array_size_label.setMinimumWidth(100)
  170. self.slot_array_size_entry = FCSpinner()
  171. self.slot_array_size_entry.set_range(0, 999999)
  172. grid0.addWidget(self.slot_array_size_label, 15, 0)
  173. grid0.addWidget(self.slot_array_size_entry, 15, 1)
  174. # Linear Slot Array direction
  175. self.slot_array_axis_label = QtWidgets.QLabel('%s:' % _('Linear Direction'))
  176. self.slot_array_axis_label.setToolTip(
  177. _("Direction on which the linear array is oriented:\n"
  178. "- 'X' - horizontal axis \n"
  179. "- 'Y' - vertical axis or \n"
  180. "- 'Angle' - a custom angle for the array inclination")
  181. )
  182. # self.slot_axis_label.setMinimumWidth(100)
  183. self.slot_array_axis_radio = RadioSet([{'label': _('X'), 'value': 'X'},
  184. {'label': _('Y'), 'value': 'Y'},
  185. {'label': _('Angle'), 'value': 'A'}])
  186. grid0.addWidget(self.slot_array_axis_label, 16, 0)
  187. grid0.addWidget(self.slot_array_axis_radio, 16, 1)
  188. # Linear Slot Array pitch distance
  189. self.slot_array_pitch_label = QtWidgets.QLabel('%s:' % _('Pitch'))
  190. self.slot_array_pitch_label.setToolTip(
  191. _("Pitch = Distance between elements of the array.")
  192. )
  193. # self.drill_pitch_label.setMinimumWidth(100)
  194. self.slot_array_pitch_entry = FCDoubleSpinner()
  195. self.slot_array_pitch_entry.set_precision(self.decimals)
  196. self.slot_array_pitch_entry.setWrapping(True)
  197. self.slot_array_pitch_entry.setRange(0, 999999)
  198. self.slot_array_pitch_entry.setSingleStep(1)
  199. grid0.addWidget(self.slot_array_pitch_label, 17, 0)
  200. grid0.addWidget(self.slot_array_pitch_entry, 17, 1)
  201. # Linear Slot Array custom angle
  202. self.slot_array_angle_label = QtWidgets.QLabel('%s:' % _('Angle'))
  203. self.slot_array_angle_label.setToolTip(
  204. _("Angle at which each element in circular array is placed.")
  205. )
  206. self.slot_array_angle_entry = FCDoubleSpinner()
  207. self.slot_array_angle_entry.set_precision(self.decimals)
  208. self.slot_array_angle_entry.setWrapping(True)
  209. self.slot_array_angle_entry.setRange(-360, 360)
  210. self.slot_array_angle_entry.setSingleStep(5)
  211. grid0.addWidget(self.slot_array_angle_label, 18, 0)
  212. grid0.addWidget(self.slot_array_angle_entry, 18, 1)
  213. self.slot_array_circ_label = QtWidgets.QLabel('<b>%s:</b>' % _('Circular Slot Array'))
  214. grid0.addWidget(self.slot_array_circ_label, 19, 0, 1, 2)
  215. # Circular Slot Array direction
  216. self.slot_array_circular_direction_label = QtWidgets.QLabel('%s:' % _('Circular Direction'))
  217. self.slot_array_circular_direction_label.setToolTip(
  218. _("Direction for circular array.\n"
  219. "Can be CW = clockwise or CCW = counter clockwise.")
  220. )
  221. self.slot_array_circular_dir_radio = RadioSet([{'label': _('CW'), 'value': 'CW'},
  222. {'label': _('CCW'), 'value': 'CCW'}])
  223. grid0.addWidget(self.slot_array_circular_direction_label, 20, 0)
  224. grid0.addWidget(self.slot_array_circular_dir_radio, 20, 1)
  225. # Circular Slot Array Angle
  226. self.slot_array_circular_angle_label = QtWidgets.QLabel('%s:' % _('Circular Angle'))
  227. self.slot_array_circular_angle_label.setToolTip(
  228. _("Angle at which each element in circular array is placed.")
  229. )
  230. self.slot_array_circular_angle_entry = FCDoubleSpinner()
  231. self.slot_array_circular_angle_entry.set_precision(self.decimals)
  232. self.slot_array_circular_angle_entry.setWrapping(True)
  233. self.slot_array_circular_angle_entry.setRange(-360, 360)
  234. self.slot_array_circular_angle_entry.setSingleStep(5)
  235. grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
  236. grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
  237. self.layout.addStretch()