flatcam/appGUI/preferences/cncjob/CNCJobAdvOptPrefGroupUI.py

71 lines
2.6 KiB
Python
Raw Normal View History

2020-06-02 15:29:45 +00:00
from PyQt5 import QtWidgets, QtGui
from PyQt5.QtCore import QSettings, Qt
from appGUI.GUIElements import FCTextArea, FCCheckBox, FCComboBox, FCSpinner, FCColorEntry
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 CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
super(CNCJobAdvOptPrefGroupUI, self).__init__(self, parent=parent)
self.decimals = decimals
self.setTitle(str(_("CNC Job Adv. Options")))
# ## Export G-Code
self.export_gcode_label = QtWidgets.QLabel("<b>%s:</b>" % _("Export CNC 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)
grid0 = QtWidgets.QGridLayout()
self.layout.addLayout(grid0)
grid0.addWidget(QtWidgets.QLabel(''), 1, 0, 1, 2)
# Annotation Font Size
self.annotation_fontsize_label = QtWidgets.QLabel('%s:' % _("Annotation Size"))
self.annotation_fontsize_label.setToolTip(
_("The font size of the annotation text. In pixels.")
)
grid0.addWidget(self.annotation_fontsize_label, 2, 0)
self.annotation_fontsize_sp = FCSpinner()
self.annotation_fontsize_sp.set_range(0, 9999)
grid0.addWidget(self.annotation_fontsize_sp, 2, 1)
grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
# Annotation Font Color
self.annotation_color_label = QtWidgets.QLabel('%s:' % _('Annotation Color'))
self.annotation_color_label.setToolTip(
_("Set the font color for the annotation texts.")
)
2020-06-02 15:29:45 +00:00
self.annotation_fontcolor_entry = FCColorEntry()
grid0.addWidget(self.annotation_color_label, 3, 0)
2020-06-02 15:29:45 +00:00
grid0.addWidget(self.annotation_fontcolor_entry, 3, 1)
2020-06-02 15:24:44 +00:00
2020-06-02 15:29:45 +00:00
grid0.addWidget(QtWidgets.QLabel(''), 3, 2)
self.layout.addStretch()
self.annotation_fontcolor_entry.editingFinished.connect(self.on_annotation_fontcolor_entry)
def on_annotation_fontcolor_entry(self):
self.app.defaults['cncjob_annotation_fontcolor'] = self.annotation_fontcolor_entry.get_value()