CNCJobOptPrefGroupUI.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. from PyQt5 import QtWidgets, QtGui
  2. from PyQt5.QtCore import QSettings
  3. from appGUI.GUIElements import RadioSet, FCCheckBox
  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 CNCJobOptPrefGroupUI(OptionsGroupUI):
  17. def __init__(self, decimals=4, parent=None):
  18. # OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
  19. super(CNCJobOptPrefGroupUI, self).__init__(self, parent=parent)
  20. self.setTitle(str(_("CNC Job Options")))
  21. self.decimals = decimals
  22. # ## Export G-Code
  23. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export G-Code"))
  24. self.export_gcode_label.setToolTip(
  25. _("Export and save G-Code to\n"
  26. "make this object to a file.")
  27. )
  28. self.layout.addWidget(self.export_gcode_label)
  29. qsettings = QSettings("Open Source", "FlatCAM")
  30. if qsettings.contains("textbox_font_size"):
  31. tb_fsize = qsettings.value('textbox_font_size', type=int)
  32. else:
  33. tb_fsize = 10
  34. font = QtGui.QFont()
  35. font.setPointSize(tb_fsize)
  36. grid0 = QtWidgets.QGridLayout()
  37. self.layout.addLayout(grid0)
  38. grid0.setColumnStretch(0, 0)
  39. grid0.setColumnStretch(1, 1)
  40. # Plot Kind
  41. self.cncplot_method_label = QtWidgets.QLabel('%s:' % _("Plot kind"))
  42. self.cncplot_method_label.setToolTip(
  43. _("This selects the kind of geometries on the canvas to plot.\n"
  44. "Those can be either of type 'Travel' which means the moves\n"
  45. "above the work piece or it can be of type 'Cut',\n"
  46. "which means the moves that cut into the material.")
  47. )
  48. self.cncplot_method_radio = RadioSet([
  49. {"label": _("All"), "value": "all"},
  50. {"label": _("Travel"), "value": "travel"},
  51. {"label": _("Cut"), "value": "cut"}
  52. ], orientation='vertical', stretch=False)
  53. grid0.addWidget(self.cncplot_method_label, 1, 0)
  54. grid0.addWidget(self.cncplot_method_radio, 1, 1)
  55. grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
  56. # Display Annotation
  57. self.annotation_cb = FCCheckBox(_("Display Annotation"))
  58. self.annotation_cb.setToolTip(
  59. _("This selects if to display text annotation on the plot.\n"
  60. "When checked it will display numbers in order for each end\n"
  61. "of a travel line."
  62. )
  63. )
  64. grid0.addWidget(self.annotation_cb, 2, 0, 1, 3)
  65. self.layout.addStretch()