CNCJobAdvOptPrefGroupUI.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. from PyQt5 import QtWidgets, QtGui
  2. from PyQt5.QtCore import QSettings, Qt
  3. from appGUI.GUIElements import FCTextArea, FCCheckBox, FCComboBox, FCSpinner, FCColorEntry
  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 CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
  17. def __init__(self, decimals=4, parent=None):
  18. # OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
  19. super(CNCJobAdvOptPrefGroupUI, self).__init__(self, parent=parent)
  20. self.decimals = decimals
  21. self.setTitle(str(_("CNC Job Adv. Options")))
  22. # ## Export G-Code
  23. self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC 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. grid0 = QtWidgets.QGridLayout()
  30. self.layout.addLayout(grid0)
  31. grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2)
  32. # Annotation Font Size
  33. self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size"))
  34. self.annotation_fontsize_label.setToolTip(
  35. _("The font size of the annotation text. In pixels.")
  36. )
  37. grid0.addWidget(self.annotation_fontsize_label, 2, 0)
  38. self.annotation_fontsize_sp = FCSpinner()
  39. self.annotation_fontsize_sp.set_range(0, 9999)
  40. grid0.addWidget(self.annotation_fontsize_sp, 2, 1)
  41. grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
  42. # Annotation Font Color
  43. self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color'))
  44. self.annotation_color_label.setToolTip(
  45. _("Set the font color for the annotation texts.")
  46. )
  47. self.annotation_fontcolor_entry = FCColorEntry()
  48. grid0.addWidget(self.annotation_color_label, 3, 0)
  49. grid0.addWidget(self.annotation_fontcolor_entry, 3, 1)
  50. grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
  51. self.layout.addStretch()
  52. self.annotation_fontcolor_entry.editingFinished.connect(self.on_annotation_fontcolor_entry)
  53. def on_annotation_fontcolor_entry(self):
  54. self.app.defaults['cncjob_annotation_fontcolor'] = self.annotation_fontcolor_entry.get_value()