flatcam/appGUI/preferences/cncjob/CNCJobOptPrefGroupUI.py

82 lines
2.8 KiB
Python

from PyQt5 import QtWidgets, QtGui
from PyQt5.QtCore import QSettings
from appGUI.GUIElements import RadioSet, FCCheckBox
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
import gettext
import appTranslation as fcTranslate
import builtins
fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
settings = QSettings("Open Source", "FlatCAM")
if settings.contains("machinist"):
machinist_setting = settings.value('machinist', type=int)
else:
machinist_setting = 0
class CNCJobOptPrefGroupUI(OptionsGroupUI):
def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
super(CNCJobOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("CNC Job Options")))
self.decimals = decimals
# ## Export G-Code
self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export G-Code"))
self.export_gcode_label.setToolTip(
_("Export and save G-Code to\n"
"make this object to a file.")
)
self.layout.addWidget(self.export_gcode_label)
qsettings = QSettings("Open Source", "FlatCAM")
if qsettings.contains("textbox_font_size"):
tb_fsize = qsettings.value('textbox_font_size', type=int)
else:
tb_fsize = 10
font = QtGui.QFont()
font.setPointSize(tb_fsize)
grid0 = QtWidgets.QGridLayout()
self.layout.addLayout(grid0)
grid0.setColumnStretch(0, 0)
grid0.setColumnStretch(1, 1)
# Plot Kind
self.cncplot_method_label = QtWidgets.QLabel('%s:' % _("Plot kind"))
self.cncplot_method_label.setToolTip(
_("This selects the kind of geometries on the canvas to plot.\n"
"Those can be either of type 'Travel' which means the moves\n"
"above the work piece or it can be of type 'Cut',\n"
"which means the moves that cut into the material.")
)
self.cncplot_method_radio = RadioSet([
{"label": _("All"), "value": "all"},
{"label": _("Travel"), "value": "travel"},
{"label": _("Cut"), "value": "cut"}
], orientation='vertical', stretch=False)
grid0.addWidget(self.cncplot_method_label, 1, 0)
grid0.addWidget(self.cncplot_method_radio, 1, 1)
grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
# Display Annotation
self.annotation_cb = FCCheckBox(_("Display Annotation"))
self.annotation_cb.setToolTip(
_("This selects if to display text annotation on the plot.\n"
"When checked it will display numbers in order for each end\n"
"of a travel line."
)
)
grid0.addWidget(self.annotation_cb, 2, 0, 1, 3)
self.layout.addStretch()