Tools2InvertPrefGroupUI.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. from PyQt5 import QtWidgets
  2. from PyQt5.QtCore import QSettings
  3. from appGUI.GUIElements import FCDoubleSpinner, RadioSet
  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 Tools2InvertPrefGroupUI(OptionsGroupUI):
  17. def __init__(self, decimals=4, parent=None):
  18. super(Tools2InvertPrefGroupUI, self).__init__(self, parent=parent)
  19. self.setTitle(str(_("Invert Gerber Tool Options")))
  20. self.decimals = decimals
  21. # ## Subtractor Tool Parameters
  22. self.sublabel = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  23. self.sublabel.setToolTip(
  24. _("A tool to invert Gerber geometry from positive to negative\n"
  25. "and in revers.")
  26. )
  27. self.layout.addWidget(self.sublabel)
  28. # Grid Layout
  29. grid0 = QtWidgets.QGridLayout()
  30. grid0.setColumnStretch(0, 0)
  31. grid0.setColumnStretch(1, 1)
  32. self.layout.addLayout(grid0)
  33. # Margin
  34. self.margin_label = QtWidgets.QLabel('%s:' % _('Margin'))
  35. self.margin_label.setToolTip(
  36. _("Distance by which to avoid\n"
  37. "the edges of the Gerber object.")
  38. )
  39. self.margin_entry = FCDoubleSpinner()
  40. self.margin_entry.set_precision(self.decimals)
  41. self.margin_entry.set_range(0.0000, 9999.9999)
  42. self.margin_entry.setObjectName(_("Margin"))
  43. grid0.addWidget(self.margin_label, 2, 0, 1, 2)
  44. grid0.addWidget(self.margin_entry, 3, 0, 1, 2)
  45. self.join_label = QtWidgets.QLabel('%s:' % _("Lines Join Style"))
  46. self.join_label.setToolTip(
  47. _("The way that the lines in the object outline will be joined.\n"
  48. "Can be:\n"
  49. "- rounded -> an arc is added between two joining lines\n"
  50. "- square -> the lines meet in 90 degrees angle\n"
  51. "- bevel -> the lines are joined by a third line")
  52. )
  53. self.join_radio = RadioSet([
  54. {'label': 'Rounded', 'value': 'r'},
  55. {'label': 'Square', 'value': 's'},
  56. {'label': 'Bevel', 'value': 'b'}
  57. ], orientation='vertical', stretch=False)
  58. grid0.addWidget(self.join_label, 5, 0, 1, 2)
  59. grid0.addWidget(self.join_radio, 7, 0, 1, 2)
  60. self.layout.addStretch()