GerberEditorPrefGroupUI.py 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 GerberEditorPrefGroupUI(OptionsGroupUI2):
  10. def __init__(self, decimals=4, **kwargs):
  11. self.decimals = decimals
  12. super().__init__(**kwargs)
  13. self.setTitle(str(_("Gerber Editor")))
  14. def build_options(self) -> [OptionUI]:
  15. return [
  16. HeadingOptionUI(
  17. label_text="Parameters",
  18. label_tooltip="A list of Gerber Editor parameters."
  19. ),
  20. SpinnerOptionUI(
  21. option="gerber_editor_sel_limit",
  22. label_text="Selection limit",
  23. label_tooltip="Set the number of selected Gerber 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=9999, step=1
  29. ),
  30. SpinnerOptionUI(
  31. option="gerber_editor_newcode",
  32. label_text="New Aperture code",
  33. label_tooltip="Code for the new aperture",
  34. min_value=10, max_value=99, step=1
  35. ),
  36. DoubleSpinnerOptionUI(
  37. option="gerber_editor_newsize",
  38. label_text="New Aperture size",
  39. label_tooltip="Size for the new aperture",
  40. min_value=0.0, max_value=100.0, step=0.1, decimals=self.decimals
  41. ),
  42. ComboboxOptionUI(
  43. option="gerber_editor_newtype",
  44. label_text="New Aperture type",
  45. label_tooltip="Type for the new aperture.\n"
  46. "Can be 'C', 'R' or 'O'.",
  47. choices=['C', 'R', 'O']
  48. ),
  49. SpinnerOptionUI(
  50. option="gerber_editor_array_size",
  51. label_text="Nr of pads",
  52. label_tooltip="Specify how many pads to be in the array.",
  53. min_value=0, max_value=9999, step=1
  54. ),
  55. LineEntryOptionUI(
  56. option="gerber_editor_newdim",
  57. label_text="Aperture Dimensions",
  58. label_tooltip="Diameters of the tools, separated by comma.\n"
  59. "The value of the diameter has to use the dot decimals separator.\n"
  60. "Valid values: 0.3, 1.0"
  61. ),
  62. HeadingOptionUI(label_text="Linear Pad Array"),
  63. RadioSetOptionUI(
  64. option="gerber_editor_lin_axis",
  65. label_text="Linear Direction",
  66. label_tooltip="Direction on which the linear array is oriented:\n"
  67. "- 'X' - horizontal axis \n"
  68. "- 'Y' - vertical axis or \n"
  69. "- 'Angle' - a custom angle for the array inclination",
  70. choices=[{'label': _('X'), 'value': 'X'},
  71. {'label': _('Y'), 'value': 'Y'},
  72. {'label': _('Angle'), 'value': 'A'}]
  73. ),
  74. DoubleSpinnerOptionUI(
  75. option="gerber_editor_lin_pitch",
  76. label_text="Pitch",
  77. label_tooltip="Pitch = Distance between elements of the array.",
  78. min_value=-9999.99, max_value=9999.99, step=0.1, decimals=self.decimals
  79. ),
  80. DoubleSpinnerOptionUI(
  81. option="gerber_editor_lin_angle",
  82. label_text="Angle",
  83. label_tooltip="Angle at which each element in circular array is placed.", # FIXME: this seems wrong
  84. min_value=-360, max_value=360, step=5, decimals=self.decimals
  85. ),
  86. HeadingOptionUI(label_text="Circular Pad Array"),
  87. RadioSetOptionUI(
  88. option="gerber_editor_circ_dir",
  89. label_text="Circular Direction",
  90. label_tooltip="Direction for circular array.\n"
  91. "Can be CW = clockwise or CCW = counter clockwise.",
  92. choices=[{'label': _('CW'), 'value': 'CW'},
  93. {'label': _('CCW'), 'value': 'CCW'}]
  94. ),
  95. DoubleSpinnerOptionUI(
  96. option="gerber_editor_circ_angle",
  97. label_text="Circular Angle",
  98. label_tooltip="Angle at which each element in circular array is placed.",
  99. min_value=-360, max_value=360, step=5, decimals=self.decimals
  100. ),
  101. HeadingOptionUI(label_text="Buffer Tool"),
  102. DoubleSpinnerOptionUI(
  103. option="gerber_editor_buff_f",
  104. label_text="Buffer distance",
  105. label_tooltip="Distance at which to buffer the Gerber element.",
  106. min_value=-9999, max_value=9999, step=0.1, decimals=self.decimals
  107. ),
  108. HeadingOptionUI(label_text="Scale Tool"),
  109. DoubleSpinnerOptionUI(
  110. option="gerber_editor_scale_f",
  111. label_text="Scale factor",
  112. label_tooltip="Factor to scale the Gerber element.",
  113. min_value=0, max_value=9999, step=0.1, decimals=self.decimals
  114. ),
  115. HeadingOptionUI(label_text="Mark Area Tool"),
  116. DoubleSpinnerOptionUI(
  117. option="gerber_editor_ma_low",
  118. label_text="Threshold low",
  119. label_tooltip="Threshold value under which the apertures are not marked.",
  120. min_value=0, max_value=9999, step=0.1, decimals=self.decimals
  121. ),
  122. DoubleSpinnerOptionUI(
  123. option="gerber_editor_ma_high",
  124. label_text="Threshold high",
  125. label_tooltip="Threshold value over which the apertures are not marked.",
  126. min_value=0, max_value=9999, step=0.1, decimals=self.decimals
  127. )
  128. ]