ExcellonOptPrefGroupUI.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. from PyQt5 import QtWidgets
  2. from PyQt5.QtCore import Qt, QSettings
  3. from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCEntry, FCSpinner, OptionalInputSection, \
  4. FCComboBox, NumericalEvalTupleEntry
  5. from appGUI.preferences import machinist_setting
  6. from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
  7. import gettext
  8. import appTranslation as fcTranslate
  9. import builtins
  10. fcTranslate.apply_language('strings')
  11. if '_' not in builtins.__dict__:
  12. _ = gettext.gettext
  13. settings = QSettings("Open Source", "FlatCAM")
  14. if settings.contains("machinist"):
  15. machinist_setting = settings.value('machinist', type=int)
  16. else:
  17. machinist_setting = 0
  18. class ExcellonOptPrefGroupUI(OptionsGroupUI):
  19. def __init__(self, decimals=4, parent=None):
  20. # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
  21. super(ExcellonOptPrefGroupUI, self).__init__(self, parent=parent)
  22. self.setTitle(str(_("Excellon Options")))
  23. self.decimals = decimals
  24. # ## Create CNC Job
  25. self.cncjob_label = QtWidgets.QLabel('<b>%s</b>' % _('Create CNC Job'))
  26. self.cncjob_label.setToolTip(
  27. _("Parameters used to create a CNC Job object\n"
  28. "for this drill object.")
  29. )
  30. self.layout.addWidget(self.cncjob_label)
  31. grid2 = QtWidgets.QGridLayout()
  32. self.layout.addLayout(grid2)
  33. grid2.setColumnStretch(0, 0)
  34. grid2.setColumnStretch(1, 1)
  35. # Operation Type
  36. self.operation_label = QtWidgets.QLabel('<b>%s:</b>' % _('Operation'))
  37. self.operation_label.setToolTip(
  38. _("Operation type:\n"
  39. "- Drilling -> will drill the drills/slots associated with this tool\n"
  40. "- Milling -> will mill the drills/slots")
  41. )
  42. self.operation_radio = RadioSet(
  43. [
  44. {'label': _('Drilling'), 'value': 'drill'},
  45. {'label': _("Milling"), 'value': 'mill'}
  46. ]
  47. )
  48. grid2.addWidget(self.operation_label, 0, 0)
  49. grid2.addWidget(self.operation_radio, 0, 1)
  50. self.mill_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  51. self.mill_type_label.setToolTip(
  52. _("Milling type:\n"
  53. "- Drills -> will mill the drills associated with this tool\n"
  54. "- Slots -> will mill the slots associated with this tool\n"
  55. "- Both -> will mill both drills and mills or whatever is available")
  56. )
  57. self.milling_type_radio = RadioSet(
  58. [
  59. {'label': _('Drills'), 'value': 'drills'},
  60. {'label': _("Slots"), 'value': 'slots'},
  61. {'label': _("Both"), 'value': 'both'},
  62. ]
  63. )
  64. grid2.addWidget(self.mill_type_label, 1, 0)
  65. grid2.addWidget(self.milling_type_radio, 1, 1)
  66. self.mill_dia_label = QtWidgets.QLabel('%s:' % _('Milling Diameter'))
  67. self.mill_dia_label.setToolTip(
  68. _("The diameter of the tool who will do the milling")
  69. )
  70. self.mill_dia_entry = FCDoubleSpinner()
  71. self.mill_dia_entry.set_precision(self.decimals)
  72. self.mill_dia_entry.set_range(0.0000, 10000.0000)
  73. grid2.addWidget(self.mill_dia_label, 2, 0)
  74. grid2.addWidget(self.mill_dia_entry, 2, 1)
  75. # ### Milling Holes ## ##
  76. self.mill_hole_label = QtWidgets.QLabel('<b>%s</b>' % _('Mill Holes'))
  77. self.mill_hole_label.setToolTip(
  78. _("Create Geometry for milling holes.")
  79. )
  80. grid2.addWidget(self.mill_hole_label, 16, 0, 1, 2)
  81. tdlabel = QtWidgets.QLabel('%s:' % _('Drill Tool dia'))
  82. tdlabel.setToolTip(
  83. _("Diameter of the cutting tool.")
  84. )
  85. self.tooldia_entry = FCDoubleSpinner()
  86. self.tooldia_entry.set_precision(self.decimals)
  87. self.tooldia_entry.set_range(0, 999.9999)
  88. grid2.addWidget(tdlabel, 18, 0)
  89. grid2.addWidget(self.tooldia_entry, 18, 1)
  90. stdlabel = QtWidgets.QLabel('%s:' % _('Slot Tool dia'))
  91. stdlabel.setToolTip(
  92. _("Diameter of the cutting tool\n"
  93. "when milling slots.")
  94. )
  95. self.slot_tooldia_entry = FCDoubleSpinner()
  96. self.slot_tooldia_entry.set_precision(self.decimals)
  97. self.slot_tooldia_entry.set_range(0, 999.9999)
  98. grid2.addWidget(stdlabel, 21, 0)
  99. grid2.addWidget(self.slot_tooldia_entry, 21, 1)
  100. self.layout.addStretch()