GerberAdvOptPrefGroupUI.py 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. from PyQt5 import QtWidgets
  2. from flatcamGUI.GUIElements import FCCheckBox, RadioSet, FCDoubleSpinner, FCSpinner, OptionalInputSection
  3. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
  4. class GerberAdvOptPrefGroupUI(OptionsGroupUI):
  5. def __init__(self, decimals=4, parent=None):
  6. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  7. super(GerberAdvOptPrefGroupUI, self).__init__(self)
  8. self.setTitle(str(_("Gerber Adv. Options")))
  9. self.decimals = decimals
  10. # ## Advanced Gerber Parameters
  11. self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  12. self.adv_param_label.setToolTip(
  13. _("A list of Gerber advanced parameters.\n"
  14. "Those parameters are available only for\n"
  15. "Advanced App. Level.")
  16. )
  17. self.layout.addWidget(self.adv_param_label)
  18. grid0 = QtWidgets.QGridLayout()
  19. self.layout.addLayout(grid0)
  20. # Follow Attribute
  21. self.follow_cb = FCCheckBox(label=_('"Follow"'))
  22. self.follow_cb.setToolTip(
  23. _("Generate a 'Follow' geometry.\n"
  24. "This means that it will cut through\n"
  25. "the middle of the trace.")
  26. )
  27. grid0.addWidget(self.follow_cb, 0, 0, 1, 2)
  28. # Aperture Table Visibility CB
  29. self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
  30. self.aperture_table_visibility_cb.setToolTip(
  31. _("Toggle the display of the Gerber Apertures Table.\n"
  32. "Also, on hide, it will delete all mark shapes\n"
  33. "that are drawn on canvas.")
  34. )
  35. grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2)
  36. separator_line = QtWidgets.QFrame()
  37. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  38. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  39. grid0.addWidget(separator_line, 2, 0, 1, 2)
  40. # Tool Type
  41. self.tool_type_label = QtWidgets.QLabel('<b>%s</b>' % _('Tool Type'))
  42. self.tool_type_label.setToolTip(
  43. _("Choose which tool to use for Gerber isolation:\n"
  44. "'Circular' or 'V-shape'.\n"
  45. "When the 'V-shape' is selected then the tool\n"
  46. "diameter will depend on the chosen cut depth.")
  47. )
  48. self.tool_type_radio = RadioSet([{'label': 'Circular', 'value': 'circular'},
  49. {'label': 'V-Shape', 'value': 'v'}])
  50. grid0.addWidget(self.tool_type_label, 3, 0)
  51. grid0.addWidget(self.tool_type_radio, 3, 1, 1, 2)
  52. # Tip Dia
  53. self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
  54. self.tipdialabel.setToolTip(
  55. _("The tip diameter for V-Shape Tool")
  56. )
  57. self.tipdia_spinner = FCDoubleSpinner()
  58. self.tipdia_spinner.set_precision(self.decimals)
  59. self.tipdia_spinner.set_range(-99.9999, 99.9999)
  60. self.tipdia_spinner.setSingleStep(0.1)
  61. self.tipdia_spinner.setWrapping(True)
  62. grid0.addWidget(self.tipdialabel, 4, 0)
  63. grid0.addWidget(self.tipdia_spinner, 4, 1, 1, 2)
  64. # Tip Angle
  65. self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
  66. self.tipanglelabel.setToolTip(
  67. _("The tip angle for V-Shape Tool.\n"
  68. "In degree.")
  69. )
  70. self.tipangle_spinner = FCSpinner()
  71. self.tipangle_spinner.set_range(1, 180)
  72. self.tipangle_spinner.set_step(5)
  73. self.tipangle_spinner.setWrapping(True)
  74. grid0.addWidget(self.tipanglelabel, 5, 0)
  75. grid0.addWidget(self.tipangle_spinner, 5, 1, 1, 2)
  76. # Cut Z
  77. self.cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
  78. self.cutzlabel.setToolTip(
  79. _("Cutting depth (negative)\n"
  80. "below the copper surface.")
  81. )
  82. self.cutz_spinner = FCDoubleSpinner()
  83. self.cutz_spinner.set_precision(self.decimals)
  84. self.cutz_spinner.set_range(-99.9999, 0.0000)
  85. self.cutz_spinner.setSingleStep(0.1)
  86. self.cutz_spinner.setWrapping(True)
  87. grid0.addWidget(self.cutzlabel, 6, 0)
  88. grid0.addWidget(self.cutz_spinner, 6, 1, 1, 2)
  89. # Isolation Type
  90. self.iso_type_label = QtWidgets.QLabel('%s:' % _('Isolation Type'))
  91. self.iso_type_label.setToolTip(
  92. _("Choose how the isolation will be executed:\n"
  93. "- 'Full' -> complete isolation of polygons\n"
  94. "- 'Ext' -> will isolate only on the outside\n"
  95. "- 'Int' -> will isolate only on the inside\n"
  96. "'Exterior' isolation is almost always possible\n"
  97. "(with the right tool) but 'Interior'\n"
  98. "isolation can be done only when there is an opening\n"
  99. "inside of the polygon (e.g polygon is a 'doughnut' shape).")
  100. )
  101. self.iso_type_radio = RadioSet([{'label': _('Full'), 'value': 'full'},
  102. {'label': _('Exterior'), 'value': 'ext'},
  103. {'label': _('Interior'), 'value': 'int'}])
  104. grid0.addWidget(self.iso_type_label, 7, 0,)
  105. grid0.addWidget(self.iso_type_radio, 7, 1, 1, 2)
  106. separator_line = QtWidgets.QFrame()
  107. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  108. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  109. grid0.addWidget(separator_line, 8, 0, 1, 2)
  110. # Buffering Type
  111. buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
  112. buffering_label.setToolTip(
  113. _("Buffering type:\n"
  114. "- None --> best performance, fast file loading but no so good display\n"
  115. "- Full --> slow file loading but good visuals. This is the default.\n"
  116. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  117. )
  118. self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
  119. {'label': _('Full'), 'value': 'full'}])
  120. grid0.addWidget(buffering_label, 9, 0)
  121. grid0.addWidget(self.buffering_radio, 9, 1)
  122. # Simplification
  123. self.simplify_cb = FCCheckBox(label=_('Simplify'))
  124. self.simplify_cb.setToolTip(
  125. _("When checked all the Gerber polygons will be\n"
  126. "loaded with simplification having a set tolerance.\n"
  127. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  128. )
  129. grid0.addWidget(self.simplify_cb, 10, 0, 1, 2)
  130. # Simplification tolerance
  131. self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
  132. self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification."))
  133. self.simplification_tol_spinner = FCDoubleSpinner()
  134. self.simplification_tol_spinner.set_precision(self.decimals + 1)
  135. self.simplification_tol_spinner.setWrapping(True)
  136. self.simplification_tol_spinner.setRange(0.00000, 0.01000)
  137. self.simplification_tol_spinner.setSingleStep(0.0001)
  138. grid0.addWidget(self.simplification_tol_label, 11, 0)
  139. grid0.addWidget(self.simplification_tol_spinner, 11, 1)
  140. self.ois_simplif = OptionalInputSection(
  141. self.simplify_cb,
  142. [
  143. self.simplification_tol_label, self.simplification_tol_spinner
  144. ],
  145. logic=True)
  146. self.layout.addStretch()