Tools2sidedPrefGroupUI.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 Tools2sidedPrefGroupUI(OptionsGroupUI):
  17. def __init__(self, decimals=4, parent=None):
  18. # OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
  19. super(Tools2sidedPrefGroupUI, self).__init__(self, parent=parent)
  20. self.setTitle(str(_("2Sided Tool Options")))
  21. self.decimals = decimals
  22. # ## Board cuttout
  23. self.dblsided_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  24. self.dblsided_label.setToolTip(
  25. _("A tool to help in creating a double sided\n"
  26. "PCB using alignment holes.")
  27. )
  28. self.layout.addWidget(self.dblsided_label)
  29. grid0 = QtWidgets.QGridLayout()
  30. self.layout.addLayout(grid0)
  31. # ## Drill diameter for alignment holes
  32. self.drill_dia_entry = FCDoubleSpinner()
  33. self.drill_dia_entry.set_range(0.000001, 10000.0000)
  34. self.drill_dia_entry.set_precision(self.decimals)
  35. self.drill_dia_entry.setSingleStep(0.1)
  36. self.dd_label = QtWidgets.QLabel('%s:' % _("Drill dia"))
  37. self.dd_label.setToolTip(
  38. _("Diameter of the drill for the "
  39. "alignment holes.")
  40. )
  41. grid0.addWidget(self.dd_label, 0, 0)
  42. grid0.addWidget(self.drill_dia_entry, 0, 1)
  43. # ## Alignment Axis
  44. self.align_ax_label = QtWidgets.QLabel('%s:' % _("Align Axis"))
  45. self.align_ax_label.setToolTip(
  46. _("Mirror vertically (X) or horizontally (Y).")
  47. )
  48. self.align_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  49. {'label': 'Y', 'value': 'Y'}])
  50. grid0.addWidget(self.align_ax_label, 1, 0)
  51. grid0.addWidget(self.align_axis_radio, 1, 1)
  52. # ## Axis
  53. self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'},
  54. {'label': 'Y', 'value': 'Y'}])
  55. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  56. self.mirax_label.setToolTip(
  57. _("Mirror vertically (X) or horizontally (Y).")
  58. )
  59. separator_line = QtWidgets.QFrame()
  60. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  61. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  62. grid0.addWidget(separator_line, 2, 0, 1, 2)
  63. grid0.addWidget(self.mirax_label, 3, 0)
  64. grid0.addWidget(self.mirror_axis_radio, 3, 1)
  65. # ## Axis Location
  66. self.axis_location_radio = RadioSet(
  67. [
  68. {'label': _('Point'), 'value': 'point'},
  69. {'label': _('Box'), 'value': 'box'},
  70. {'label': _('Hole Snap'), 'value': 'hole'},
  71. ]
  72. )
  73. self.axloc_label = QtWidgets.QLabel('%s:' % _("Axis Ref"))
  74. self.axloc_label.setToolTip(
  75. _("The coordinates used as reference for the mirror operation.\n"
  76. "Can be:\n"
  77. "- Point -> a set of coordinates (x,y) around which the object is mirrored\n"
  78. "- Box -> a set of coordinates (x, y) obtained from the center of the\n"
  79. "bounding box of another object selected below\n"
  80. "- Hole Snap-> a point defined by the center of a drill hone in a Excellon object")
  81. )
  82. grid0.addWidget(self.axloc_label, 4, 0)
  83. grid0.addWidget(self.axis_location_radio, 4, 1)
  84. self.layout.addStretch()