GerberAdvOptPrefGroupUI.py 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. from flatcamGUI.GUIElements import OptionalInputSection
  2. from flatcamGUI.preferences.OptionUI import *
  3. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI2
  4. import gettext
  5. import FlatCAMTranslation as fcTranslate
  6. import builtins
  7. fcTranslate.apply_language('strings')
  8. if '_' not in builtins.__dict__:
  9. _ = gettext.gettext
  10. class GerberAdvOptPrefGroupUI(OptionsGroupUI2):
  11. def __init__(self, decimals=4, **kwargs):
  12. self.decimals = decimals
  13. super().__init__(**kwargs)
  14. self.setTitle(str(_("Gerber Adv. Options")))
  15. self.simplify_cb = self.option_dict()["gerber_simplification"].get_field()
  16. self.simplification_tol_label = self.option_dict()["gerber_simp_tolerance"].label_widget
  17. self.simplification_tol_spinner = self.option_dict()["gerber_simp_tolerance"].get_field()
  18. self.ois_simplif = OptionalInputSection(self.simplify_cb, [self.simplification_tol_label, self.simplification_tol_spinner], logic=True)
  19. def build_options(self) -> [OptionUI]:
  20. return [
  21. HeadingOptionUI(
  22. label_text="Advanced Options",
  23. label_tooltip="A list of Gerber advanced parameters.\n"
  24. "Those parameters are available only for\n"
  25. "Advanced App. Level."
  26. ),
  27. CheckboxOptionUI(
  28. option="gerber_follow",
  29. label_text='"Follow"',
  30. label_tooltip="Generate a 'Follow' geometry.\n"
  31. "This means that it will cut through\n"
  32. "the middle of the trace."
  33. ),
  34. CheckboxOptionUI(
  35. option="gerber_aperture_display",
  36. label_text="Table Show/Hide",
  37. label_tooltip="Toggle the display of the Gerber Apertures Table.\n"
  38. "Also, on hide, it will delete all mark shapes\n"
  39. "that are drawn on canvas."
  40. ),
  41. SeparatorOptionUI(),
  42. RadioSetOptionUI(
  43. option="gerber_tool_type",
  44. label_text="Tool Type",
  45. label_bold=True,
  46. label_tooltip="Choose which tool to use for Gerber isolation:\n"
  47. "'Circular' or 'V-shape'.\n"
  48. "When the 'V-shape' is selected then the tool\n"
  49. "diameter will depend on the chosen cut depth.",
  50. choices=[{'label': 'Circular', 'value': 'circular'},
  51. {'label': 'V-Shape', 'value': 'v'}]
  52. ),
  53. DoubleSpinnerOptionUI(
  54. option="gerber_vtipdia",
  55. label_text="V-Tip Dia",
  56. label_tooltip="The tip diameter for V-Shape Tool",
  57. min_value=-99.9999, max_value=99.9999, step=0.1, decimals=self.decimals
  58. ),
  59. SpinnerOptionUI(
  60. option="gerber_vtipangle",
  61. label_text="V-Tip Angle",
  62. label_tooltip="The tip angle for V-Shape Tool.\n"
  63. "In degrees.",
  64. min_value=1, max_value=180, step=5
  65. ),
  66. DoubleSpinnerOptionUI(
  67. option="gerber_vcutz",
  68. label_text="Cut Z",
  69. label_tooltip="Cutting depth (negative)\n"
  70. "below the copper surface.",
  71. min_value=-99.9999, max_value=0.0000, step=0.1, decimals=self.decimals
  72. ),
  73. RadioSetOptionUI(
  74. option="gerber_iso_type",
  75. label_text="Isolation Type",
  76. label_tooltip="Choose how the isolation will be executed:\n"
  77. "- 'Full' -> complete isolation of polygons\n"
  78. "- 'Ext' -> will isolate only on the outside\n"
  79. "- 'Int' -> will isolate only on the inside\n"
  80. "'Exterior' isolation is almost always possible\n"
  81. "(with the right tool) but 'Interior'\n"
  82. "isolation can be done only when there is an opening\n"
  83. "inside of the polygon (e.g polygon is a 'doughnut' shape).",
  84. choices=[{'label': _('Full'), 'value': 'full'},
  85. {'label': _('Exterior'), 'value': 'ext'},
  86. {'label': _('Interior'), 'value': 'int'}]
  87. ),
  88. SeparatorOptionUI(),
  89. RadioSetOptionUI(
  90. option="gerber_buffering",
  91. label_text="Buffering",
  92. label_tooltip="Buffering type:\n"
  93. "- None --> best performance, fast file loading but no so good display\n"
  94. "- Full --> slow file loading but good visuals. This is the default.\n"
  95. "<<WARNING>>: Don't change this unless you know what you are doing !!!",
  96. choices=[{'label': _('None'), 'value': 'no'},
  97. {'label': _('Full'), 'value': 'full'}]
  98. ),
  99. CheckboxOptionUI(
  100. option="gerber_simplification",
  101. label_text="Simplify",
  102. label_tooltip="When checked all the Gerber polygons will be\n"
  103. "loaded with simplification having a set tolerance.\n"
  104. "<<WARNING>>: Don't change this unless you know what you are doing !!!"
  105. ),
  106. DoubleSpinnerOptionUI(
  107. option="gerber_simp_tolerance",
  108. label_text="Tolerance",
  109. label_tooltip="Tolerance for polygon simplification.",
  110. min_value=0.0, max_value=0.01, step=0.0001, decimals=self.decimals+1
  111. )
  112. ]