GeometryEditorPrefGroupUI.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. from PyQt5 import QtWidgets
  2. from PyQt5.QtCore import QSettings
  3. from AppGUI.GUIElements import FCSpinner, 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 GeometryEditorPrefGroupUI(OptionsGroupUI):
  17. def __init__(self, decimals=4, parent=None):
  18. # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
  19. super(GeometryEditorPrefGroupUI, self).__init__(self, parent=parent)
  20. self.setTitle(str(_("Geometry Editor")))
  21. self.decimals = decimals
  22. # Advanced Geometry Parameters
  23. self.param_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
  24. self.param_label.setToolTip(
  25. _("A list of Geometry Editor parameters.")
  26. )
  27. self.layout.addWidget(self.param_label)
  28. grid0 = QtWidgets.QGridLayout()
  29. self.layout.addLayout(grid0)
  30. # Selection Limit
  31. self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit"))
  32. self.sel_limit_label.setToolTip(
  33. _("Set the number of selected geometry\n"
  34. "items above which the utility geometry\n"
  35. "becomes just a selection rectangle.\n"
  36. "Increases the performance when moving a\n"
  37. "large number of geometric elements.")
  38. )
  39. self.sel_limit_entry = FCSpinner()
  40. self.sel_limit_entry.set_range(0, 9999)
  41. grid0.addWidget(self.sel_limit_label, 0, 0)
  42. grid0.addWidget(self.sel_limit_entry, 0, 1)
  43. # Milling Type
  44. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  45. milling_type_label.setToolTip(
  46. _("Milling type:\n"
  47. "- climb / best for precision milling and to reduce tool usage\n"
  48. "- conventional / useful when there is no backlash compensation")
  49. )
  50. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  51. {'label': _('Conventional'), 'value': 'cv'}])
  52. grid0.addWidget(milling_type_label, 1, 0)
  53. grid0.addWidget(self.milling_type_radio, 1, 1)
  54. self.layout.addStretch()