Tools2CalPrefGroupUI.py 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. from PyQt5 import QtWidgets
  2. from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCEntry
  3. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
  4. class Tools2CalPrefGroupUI(OptionsGroupUI):
  5. def __init__(self, decimals=4, parent=None):
  6. super(Tools2CalPrefGroupUI, self).__init__(self)
  7. self.setTitle(str(_("Calibration 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. # Calibration source
  20. self.cal_source_lbl = QtWidgets.QLabel("<b>%s:</b>" % _("Source Type"))
  21. self.cal_source_lbl.setToolTip(_("The source of calibration points.\n"
  22. "It can be:\n"
  23. "- Object -> click a hole geo for Excellon or a pad for Gerber\n"
  24. "- Free -> click freely on canvas to acquire the calibration points"))
  25. self.cal_source_radio = RadioSet([{'label': _('Object'), 'value': 'object'},
  26. {'label': _('Free'), 'value': 'free'}],
  27. stretch=False)
  28. grid_lay.addWidget(self.cal_source_lbl, 1, 0)
  29. grid_lay.addWidget(self.cal_source_radio, 1, 1, 1, 2)
  30. separator_line = QtWidgets.QFrame()
  31. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  32. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  33. grid_lay.addWidget(separator_line, 2, 0, 1, 2)
  34. # Travel Z entry
  35. travelz_lbl = QtWidgets.QLabel('%s:' % _("Travel Z"))
  36. travelz_lbl.setToolTip(
  37. _("Height (Z) for travelling between the points.")
  38. )
  39. self.travelz_entry = FCDoubleSpinner()
  40. self.travelz_entry.set_range(-9999.9999, 9999.9999)
  41. self.travelz_entry.set_precision(self.decimals)
  42. self.travelz_entry.setSingleStep(0.1)
  43. grid_lay.addWidget(travelz_lbl, 3, 0)
  44. grid_lay.addWidget(self.travelz_entry, 3, 1, 1, 2)
  45. # Verification Z entry
  46. verz_lbl = QtWidgets.QLabel('%s:' % _("Verification Z"))
  47. verz_lbl.setToolTip(
  48. _("Height (Z) for checking the point.")
  49. )
  50. self.verz_entry = FCDoubleSpinner()
  51. self.verz_entry.set_range(-9999.9999, 9999.9999)
  52. self.verz_entry.set_precision(self.decimals)
  53. self.verz_entry.setSingleStep(0.1)
  54. grid_lay.addWidget(verz_lbl, 4, 0)
  55. grid_lay.addWidget(self.verz_entry, 4, 1, 1, 2)
  56. # Zero the Z of the verification tool
  57. self.zeroz_cb = FCCheckBox('%s' % _("Zero Z tool"))
  58. self.zeroz_cb.setToolTip(
  59. _("Include a sequence to zero the height (Z)\n"
  60. "of the verification tool.")
  61. )
  62. grid_lay.addWidget(self.zeroz_cb, 5, 0, 1, 3)
  63. # Toochange Z entry
  64. toolchangez_lbl = QtWidgets.QLabel('%s:' % _("Toolchange Z"))
  65. toolchangez_lbl.setToolTip(
  66. _("Height (Z) for mounting the verification probe.")
  67. )
  68. self.toolchangez_entry = FCDoubleSpinner()
  69. self.toolchangez_entry.set_range(0.0000, 9999.9999)
  70. self.toolchangez_entry.set_precision(self.decimals)
  71. self.toolchangez_entry.setSingleStep(0.1)
  72. grid_lay.addWidget(toolchangez_lbl, 6, 0)
  73. grid_lay.addWidget(self.toolchangez_entry, 6, 1, 1, 2)
  74. # Toolchange X-Y entry
  75. toolchangexy_lbl = QtWidgets.QLabel('%s:' % _('Toolchange X-Y'))
  76. toolchangexy_lbl.setToolTip(
  77. _("Toolchange X,Y position.\n"
  78. "If no value is entered then the current\n"
  79. "(x, y) point will be used,")
  80. )
  81. self.toolchange_xy_entry = FCEntry()
  82. grid_lay.addWidget(toolchangexy_lbl, 7, 0)
  83. grid_lay.addWidget(self.toolchange_xy_entry, 7, 1, 1, 2)
  84. # Second point choice
  85. second_point_lbl = QtWidgets.QLabel('%s:' % _("Second point"))
  86. second_point_lbl.setToolTip(
  87. _("Second point in the Gcode verification can be:\n"
  88. "- top-left -> the user will align the PCB vertically\n"
  89. "- bottom-right -> the user will align the PCB horizontally")
  90. )
  91. self.second_point_radio = RadioSet([{'label': _('Top-Left'), 'value': 'tl'},
  92. {'label': _('Bottom-Right'), 'value': 'br'}],
  93. orientation='vertical')
  94. grid_lay.addWidget(second_point_lbl, 8, 0)
  95. grid_lay.addWidget(self.second_point_radio, 8, 1, 1, 2)
  96. self.layout.addStretch()