GerberAdvOptPrefGroupUI.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. from PyQt5 import QtWidgets
  2. from PyQt5.QtCore import QSettings
  3. from AppGUI.GUIElements import FCCheckBox, RadioSet, FCDoubleSpinner, FCSpinner, OptionalInputSection
  4. from AppGUI.preferences.OptionsGroupUI import OptionsGroupUI
  5. import gettext
  6. import AppTranslation as fcTranslate
  7. import builtins
  8. fcTranslate.apply_language('strings')
  9. if '_' not in builtins.__dict__:
  10. _ = gettext.gettext
  11. settings = QSettings("Open Source", "FlatCAM")
  12. if settings.contains("machinist"):
  13. machinist_setting = settings.value('machinist', type=int)
  14. else:
  15. machinist_setting = 0
  16. class GerberAdvOptPrefGroupUI(OptionsGroupUI):
  17. def __init__(self, decimals=4, parent=None):
  18. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  19. super(GerberAdvOptPrefGroupUI, self).__init__(self, parent=parent)
  20. self.setTitle(str(_("Gerber Adv. Options")))
  21. self.decimals = decimals
  22. # ## Advanced Gerber Parameters
  23. self.adv_param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
  24. self.adv_param_label.setToolTip(
  25. _("A list of Gerber advanced parameters.\n"
  26. "Those parameters are available only for\n"
  27. "Advanced App. Level.")
  28. )
  29. self.layout.addWidget(self.adv_param_label)
  30. grid0 = QtWidgets.QGridLayout()
  31. self.layout.addLayout(grid0)
  32. # Follow Attribute
  33. self.follow_cb = FCCheckBox(label=_('"Follow"'))
  34. self.follow_cb.setToolTip(
  35. _("Generate a 'Follow' geometry.\n"
  36. "This means that it will cut through\n"
  37. "the middle of the trace.")
  38. )
  39. grid0.addWidget(self.follow_cb, 0, 0, 1, 2)
  40. # Aperture Table Visibility CB
  41. self.aperture_table_visibility_cb = FCCheckBox(label=_('Table Show/Hide'))
  42. self.aperture_table_visibility_cb.setToolTip(
  43. _("Toggle the display of the Gerber Apertures Table.\n"
  44. "Also, on hide, it will delete all mark shapes\n"
  45. "that are drawn on canvas.")
  46. )
  47. grid0.addWidget(self.aperture_table_visibility_cb, 1, 0, 1, 2)
  48. separator_line = QtWidgets.QFrame()
  49. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  50. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  51. grid0.addWidget(separator_line, 2, 0, 1, 2)
  52. # Buffering Type
  53. buffering_label = QtWidgets.QLabel('%s:' % _('Buffering'))
  54. buffering_label.setToolTip(
  55. _("Buffering type:\n"
  56. "- None --> best performance, fast file loading but no so good display\n"
  57. "- Full --> slow file loading but good visuals. This is the default.\n"
  58. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  59. )
  60. self.buffering_radio = RadioSet([{'label': _('None'), 'value': 'no'},
  61. {'label': _('Full'), 'value': 'full'}])
  62. grid0.addWidget(buffering_label, 9, 0)
  63. grid0.addWidget(self.buffering_radio, 9, 1)
  64. # Simplification
  65. self.simplify_cb = FCCheckBox(label=_('Simplify'))
  66. self.simplify_cb.setToolTip(
  67. _("When checked all the Gerber polygons will be\n"
  68. "loaded with simplification having a set tolerance.\n"
  69. "<<WARNING>>: Don't change this unless you know what you are doing !!!")
  70. )
  71. grid0.addWidget(self.simplify_cb, 10, 0, 1, 2)
  72. # Simplification tolerance
  73. self.simplification_tol_label = QtWidgets.QLabel(_('Tolerance'))
  74. self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification."))
  75. self.simplification_tol_spinner = FCDoubleSpinner()
  76. self.simplification_tol_spinner.set_precision(self.decimals + 1)
  77. self.simplification_tol_spinner.setWrapping(True)
  78. self.simplification_tol_spinner.setRange(0.00000, 0.01000)
  79. self.simplification_tol_spinner.setSingleStep(0.0001)
  80. grid0.addWidget(self.simplification_tol_label, 11, 0)
  81. grid0.addWidget(self.simplification_tol_spinner, 11, 1)
  82. self.ois_simplif = OptionalInputSection(
  83. self.simplify_cb,
  84. [
  85. self.simplification_tol_label, self.simplification_tol_spinner
  86. ],
  87. logic=True)
  88. self.layout.addStretch()