Tools2FiducialsPrefGroupUI.py 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. from PyQt5 import QtWidgets
  2. from flatcamGUI.GUIElements import FCDoubleSpinner, RadioSet
  3. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
  4. class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
  5. def __init__(self, decimals=4, parent=None):
  6. super(Tools2FiducialsPrefGroupUI, self).__init__(self)
  7. self.setTitle(str(_("Fiducials Tool Options")))
  8. self.decimals = decimals
  9. # ## Grid Layout
  10. grid_lay = QtWidgets.QGridLayout()
  11. self.layout.addLayout(grid_lay)
  12. grid_lay.setColumnStretch(0, 0)
  13. grid_lay.setColumnStretch(1, 1)
  14. self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _('Parameters'))
  15. self.param_label.setToolTip(
  16. _("Parameters used for this tool.")
  17. )
  18. grid_lay.addWidget(self.param_label, 0, 0, 1, 2)
  19. # DIAMETER #
  20. self.dia_label = QtWidgets.QLabel('%s:' % _("Size"))
  21. self.dia_label.setToolTip(
  22. _("This set the fiducial diameter if fiducial type is circular,\n"
  23. "otherwise is the size of the fiducial.\n"
  24. "The soldermask opening is double than that.")
  25. )
  26. self.dia_entry = FCDoubleSpinner()
  27. self.dia_entry.set_range(1.0000, 3.0000)
  28. self.dia_entry.set_precision(self.decimals)
  29. self.dia_entry.setWrapping(True)
  30. self.dia_entry.setSingleStep(0.1)
  31. grid_lay.addWidget(self.dia_label, 1, 0)
  32. grid_lay.addWidget(self.dia_entry, 1, 1)
  33. # MARGIN #
  34. self.margin_label = QtWidgets.QLabel('%s:' % _("Margin"))
  35. self.margin_label.setToolTip(
  36. _("Bounding box margin.")
  37. )
  38. self.margin_entry = FCDoubleSpinner()
  39. self.margin_entry.set_range(-9999.9999, 9999.9999)
  40. self.margin_entry.set_precision(self.decimals)
  41. self.margin_entry.setSingleStep(0.1)
  42. grid_lay.addWidget(self.margin_label, 2, 0)
  43. grid_lay.addWidget(self.margin_entry, 2, 1)
  44. # Mode #
  45. self.mode_radio = RadioSet([
  46. {'label': _('Auto'), 'value': 'auto'},
  47. {"label": _("Manual"), "value": "manual"}
  48. ], stretch=False)
  49. self.mode_label = QtWidgets.QLabel(_("Mode:"))
  50. self.mode_label.setToolTip(
  51. _("- 'Auto' - automatic placement of fiducials in the corners of the bounding box.\n"
  52. "- 'Manual' - manual placement of fiducials.")
  53. )
  54. grid_lay.addWidget(self.mode_label, 3, 0)
  55. grid_lay.addWidget(self.mode_radio, 3, 1)
  56. # Position for second fiducial #
  57. self.pos_radio = RadioSet([
  58. {'label': _('Up'), 'value': 'up'},
  59. {"label": _("Down"), "value": "down"},
  60. {"label": _("None"), "value": "no"}
  61. ], stretch=False)
  62. self.pos_label = QtWidgets.QLabel('%s:' % _("Second fiducial"))
  63. self.pos_label.setToolTip(
  64. _("The position for the second fiducial.\n"
  65. "- 'Up' - the order is: bottom-left, top-left, top-right.\n"
  66. "- 'Down' - the order is: bottom-left, bottom-right, top-right.\n"
  67. "- 'None' - there is no second fiducial. The order is: bottom-left, top-right.")
  68. )
  69. grid_lay.addWidget(self.pos_label, 4, 0)
  70. grid_lay.addWidget(self.pos_radio, 4, 1)
  71. separator_line = QtWidgets.QFrame()
  72. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  73. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  74. grid_lay.addWidget(separator_line, 5, 0, 1, 2)
  75. # Fiducial type #
  76. self.fid_type_radio = RadioSet([
  77. {'label': _('Circular'), 'value': 'circular'},
  78. {"label": _("Cross"), "value": "cross"},
  79. {"label": _("Chess"), "value": "chess"}
  80. ], stretch=False)
  81. self.fid_type_label = QtWidgets.QLabel('%s:' % _("Fiducial Type"))
  82. self.fid_type_label.setToolTip(
  83. _("The type of fiducial.\n"
  84. "- 'Circular' - this is the regular fiducial.\n"
  85. "- 'Cross' - cross lines fiducial.\n"
  86. "- 'Chess' - chess pattern fiducial.")
  87. )
  88. grid_lay.addWidget(self.fid_type_label, 6, 0)
  89. grid_lay.addWidget(self.fid_type_radio, 6, 1)
  90. # Line Thickness #
  91. self.line_thickness_label = QtWidgets.QLabel('%s:' % _("Line thickness"))
  92. self.line_thickness_label.setToolTip(
  93. _("Bounding box margin.")
  94. )
  95. self.line_thickness_entry = FCDoubleSpinner()
  96. self.line_thickness_entry.set_range(0.00001, 9999.9999)
  97. self.line_thickness_entry.set_precision(self.decimals)
  98. self.line_thickness_entry.setSingleStep(0.1)
  99. grid_lay.addWidget(self.line_thickness_label, 7, 0)
  100. grid_lay.addWidget(self.line_thickness_entry, 7, 1)
  101. self.layout.addStretch()