ExcellonEditorPrefGroupUI.py 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. from flatcamGUI.preferences.OptionUI import *
  2. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI2
  3. import gettext
  4. import FlatCAMTranslation as fcTranslate
  5. import builtins
  6. fcTranslate.apply_language('strings')
  7. if '_' not in builtins.__dict__:
  8. _ = gettext.gettext
  9. class ExcellonEditorPrefGroupUI(OptionsGroupUI2):
  10. def __init__(self, decimals=4, **kwargs):
  11. self.decimals = decimals
  12. super().__init__(**kwargs)
  13. self.setTitle(str(_("Excellon Editor")))
  14. def build_options(self) -> [OptionUI]:
  15. return [
  16. HeadingOptionUI(
  17. label_text="Parameters",
  18. label_tooltip="A list of Excellon Editor parameters."
  19. ),
  20. SpinnerOptionUI(
  21. option="excellon_editor_sel_limit",
  22. label_text="Selection limit",
  23. label_tooltip="Set the number of selected Excellon geometry\n"
  24. "items above which the utility geometry\n"
  25. "becomes just a selection rectangle.\n"
  26. "Increases the performance when moving a\n"
  27. "large number of geometric elements.",
  28. min_value=0, max_value=99999, step=1
  29. ),
  30. DoubleSpinnerOptionUI(
  31. option="excellon_editor_newdia",
  32. label_text="New Dia",
  33. label_tooltip="Diameter for the new tool",
  34. min_value=0.000001, max_value=99.9999, step=0.1, decimals=self.decimals
  35. ),
  36. SpinnerOptionUI(
  37. option="excellon_editor_array_size",
  38. label_text="Nr of drills",
  39. label_tooltip="Specify how many drills to be in the array.",
  40. min_value=0, max_value=9999, step=1
  41. ),
  42. HeadingOptionUI(label_text="Linear Drill Array"),
  43. RadioSetOptionUI(
  44. option="excellon_editor_lin_dir",
  45. label_text="Linear Direction",
  46. label_tooltip="Direction on which the linear array is oriented:\n"
  47. "- 'X' - horizontal axis \n"
  48. "- 'Y' - vertical axis or \n"
  49. "- 'Angle' - a custom angle for the array inclination",
  50. choices=[
  51. {'label': _('X'), 'value': 'X'},
  52. {'label': _('Y'), 'value': 'Y'},
  53. {'label': _('Angle'), 'value': 'A'}
  54. ]
  55. ),
  56. DoubleSpinnerOptionUI(
  57. option="excellon_editor_lin_pitch",
  58. label_text="Pitch",
  59. label_tooltip="Pitch = Distance between elements of the array.",
  60. min_value=0, max_value=99999.9999, step=0.1, decimals=self.decimals
  61. ),
  62. DoubleSpinnerOptionUI(
  63. option="excellon_editor_lin_angle",
  64. label_text="Angle",
  65. label_tooltip="Angle at which each element in circular array is placed.", # FIXME tooltip seems wrong ?
  66. min_value=-360, max_value=360, step=5, decimals=self.decimals
  67. ),
  68. HeadingOptionUI(label_text="Circular Drill Array"),
  69. RadioSetOptionUI(
  70. option="excellon_editor_circ_dir",
  71. label_text="Circular Direction",
  72. label_tooltip="Direction for circular array.\n"
  73. "Can be CW = clockwise or CCW = counter clockwise.",
  74. choices=[
  75. {'label': _('CW'), 'value': 'CW'},
  76. {'label': _('CCW'), 'value': 'CCW'}
  77. ]
  78. ),
  79. DoubleSpinnerOptionUI(
  80. option="excellon_editor_circ_angle",
  81. label_text="Angle",
  82. label_tooltip="Angle at which each element in circular array is placed.",
  83. min_value=-360, max_value=360, step=5, decimals=self.decimals
  84. ),
  85. HeadingOptionUI(label_text="Slots"),
  86. DoubleSpinnerOptionUI(
  87. option="excellon_editor_slot_length",
  88. label_text="Length",
  89. label_tooltip="Length = The length of the slot.",
  90. min_value=0, max_value=99999, step=1, decimals=self.decimals
  91. ),
  92. RadioSetOptionUI(
  93. option="excellon_editor_slot_direction",
  94. label_text="Direction",
  95. label_tooltip="Direction on which the slot is oriented:\n"
  96. "- 'X' - horizontal axis \n"
  97. "- 'Y' - vertical axis or \n"
  98. "- 'Angle' - a custom angle for the slot inclination",
  99. choices=[
  100. {'label': _('X'), 'value': 'X'},
  101. {'label': _('Y'), 'value': 'Y'},
  102. {'label': _('Angle'), 'value': 'A'}
  103. ]
  104. ),
  105. DoubleSpinnerOptionUI(
  106. option="excellon_editor_slot_angle",
  107. label_text="Angle",
  108. label_tooltip="Angle at which the slot is placed.\n"
  109. "The precision is of max 2 decimals.\n"
  110. "Min value is: -359.99 degrees.\n"
  111. "Max value is: 360.00 degrees.",
  112. min_value=-359.99, max_value=360.00, step=5, decimals=self.decimals
  113. ),
  114. HeadingOptionUI(label_text="Linear Slot Array"),
  115. SpinnerOptionUI(
  116. option="excellon_editor_slot_array_size",
  117. label_text="Nr of slots",
  118. label_tooltip="Specify how many slots to be in the array.",
  119. min_value=0, max_value=999999, step=1
  120. ),
  121. RadioSetOptionUI(
  122. option="excellon_editor_slot_lin_dir",
  123. label_text="Linear Direction",
  124. label_tooltip="Direction on which the linear array is oriented:\n"
  125. "- 'X' - horizontal axis \n"
  126. "- 'Y' - vertical axis or \n"
  127. "- 'Angle' - a custom angle for the array inclination",
  128. choices=[
  129. {'label': _('X'), 'value': 'X'},
  130. {'label': _('Y'), 'value': 'Y'},
  131. {'label': _('Angle'), 'value': 'A'}
  132. ]
  133. ),
  134. DoubleSpinnerOptionUI(
  135. option="excellon_editor_slot_lin_pitch",
  136. label_text="Pitch",
  137. label_tooltip="Pitch = Distance between elements of the array.",
  138. min_value=0, max_value=999999, step=1, decimals=self.decimals
  139. ),
  140. DoubleSpinnerOptionUI(
  141. option="excellon_editor_slot_lin_angle",
  142. label_text="Angle",
  143. label_tooltip="Angle at which each element in circular array is placed.", # FIXME
  144. min_value=-360, max_value=360, step=5, decimals=self.decimals
  145. ),
  146. HeadingOptionUI(label_text="Circular Slot Array"),
  147. RadioSetOptionUI(
  148. option="excellon_editor_slot_circ_dir",
  149. label_text="Circular Direction",
  150. label_tooltip="Direction for circular array.\n"
  151. "Can be CW = clockwise or CCW = counter clockwise.",
  152. choices=[{'label': _('CW'), 'value': 'CW'},
  153. {'label': _('CCW'), 'value': 'CCW'}]
  154. ),
  155. DoubleSpinnerOptionUI(
  156. option="excellon_editor_slot_circ_angle",
  157. label_text="Circular Angle",
  158. label_tooltip="Angle at which each element in circular array is placed.",
  159. min_value=-360, max_value=360, step=5, decimals=self.decimals
  160. )
  161. ]