|
|
@@ -16,7 +16,7 @@ from PyQt5.QtCore import Qt, QSettings
|
|
|
|
|
|
from camlib import distance, arc, three_point_circle, Geometry, FlatCAMRTreeStorage
|
|
|
from appTool import AppTool
|
|
|
-from appGUI.GUIElements import OptionalInputSection, FCCheckBox, FCEntry, FCComboBox, FCTextAreaRich, \
|
|
|
+from appGUI.GUIElements import OptionalInputSection, FCCheckBox, FCLabel, FCComboBox, FCTextAreaRich, \
|
|
|
FCDoubleSpinner, FCButton, FCInputDialog, FCTree, NumericalEvalTupleEntry
|
|
|
from appParsers.ParseFont import *
|
|
|
|
|
|
@@ -46,7 +46,7 @@ class BufferSelectionTool(AppTool):
|
|
|
Simple input for buffer distance.
|
|
|
"""
|
|
|
|
|
|
- toolName = "Buffer Selection"
|
|
|
+ toolName = _("Buffer Selection")
|
|
|
|
|
|
def __init__(self, app, draw_app):
|
|
|
AppTool.__init__(self, app)
|
|
|
@@ -55,7 +55,7 @@ class BufferSelectionTool(AppTool):
|
|
|
self.decimals = app.decimals
|
|
|
|
|
|
# Title
|
|
|
- title_label = QtWidgets.QLabel("%s" % ('Editor ' + self.toolName))
|
|
|
+ title_label = FCLabel("%s" % ('Editor ' + self.toolName))
|
|
|
title_label.setStyleSheet("""
|
|
|
QLabel
|
|
|
{
|
|
|
@@ -82,7 +82,7 @@ class BufferSelectionTool(AppTool):
|
|
|
self.buffer_distance_entry.set_precision(self.decimals)
|
|
|
self.buffer_distance_entry.set_range(0.0000, 999999.9999)
|
|
|
form_layout.addRow(_("Buffer distance:"), self.buffer_distance_entry)
|
|
|
- self.buffer_corner_lbl = QtWidgets.QLabel(_("Buffer corner:"))
|
|
|
+ self.buffer_corner_lbl = FCLabel(_("Buffer corner:"))
|
|
|
self.buffer_corner_lbl.setToolTip(
|
|
|
_("There are 3 types of corners:\n"
|
|
|
" - 'Round': the corner is rounded for exterior buffer.\n"
|
|
|
@@ -99,15 +99,15 @@ class BufferSelectionTool(AppTool):
|
|
|
hlay = QtWidgets.QHBoxLayout()
|
|
|
self.buffer_tools_box.addLayout(hlay)
|
|
|
|
|
|
- self.buffer_int_button = QtWidgets.QPushButton(_("Buffer Interior"))
|
|
|
+ self.buffer_int_button = FCButton(_("Buffer Interior"))
|
|
|
hlay.addWidget(self.buffer_int_button)
|
|
|
- self.buffer_ext_button = QtWidgets.QPushButton(_("Buffer Exterior"))
|
|
|
+ self.buffer_ext_button = FCButton(_("Buffer Exterior"))
|
|
|
hlay.addWidget(self.buffer_ext_button)
|
|
|
|
|
|
hlay1 = QtWidgets.QHBoxLayout()
|
|
|
self.buffer_tools_box.addLayout(hlay1)
|
|
|
|
|
|
- self.buffer_button = QtWidgets.QPushButton(_("Full Buffer"))
|
|
|
+ self.buffer_button = FCButton(_("Full Buffer"))
|
|
|
hlay1.addWidget(self.buffer_button)
|
|
|
|
|
|
self.layout.addStretch()
|
|
|
@@ -191,7 +191,7 @@ class TextInputTool(AppTool):
|
|
|
Simple input for buffer distance.
|
|
|
"""
|
|
|
|
|
|
- toolName = "Text Input Tool"
|
|
|
+ toolName = _("Text Input Tool")
|
|
|
|
|
|
def __init__(self, app):
|
|
|
AppTool.__init__(self, app)
|
|
|
@@ -212,7 +212,7 @@ class TextInputTool(AppTool):
|
|
|
self.text_tool_frame.setLayout(self.text_tools_box)
|
|
|
|
|
|
# Title
|
|
|
- title_label = QtWidgets.QLabel("%s" % ('Editor ' + self.toolName))
|
|
|
+ title_label = FCLabel("%s" % self.toolName)
|
|
|
title_label.setStyleSheet("""
|
|
|
QLabel
|
|
|
{
|
|
|
@@ -238,7 +238,7 @@ class TextInputTool(AppTool):
|
|
|
|
|
|
self.font_type_cb = QtWidgets.QFontComboBox(self)
|
|
|
self.font_type_cb.setCurrentFont(f_current)
|
|
|
- self.form_layout.addRow(QtWidgets.QLabel('%s:' % _("Font")), self.font_type_cb)
|
|
|
+ self.form_layout.addRow(FCLabel('%s:' % _("Font")), self.font_type_cb)
|
|
|
|
|
|
# Flag variables to show if font is bold, italic, both or none (regular)
|
|
|
self.font_bold = False
|
|
|
@@ -310,7 +310,7 @@ class TextInputTool(AppTool):
|
|
|
self.font_italic_tb.setIcon(QtGui.QIcon(self.app.resource_location + '/italic32.png'))
|
|
|
hlay.addWidget(self.font_italic_tb)
|
|
|
|
|
|
- self.form_layout.addRow(QtWidgets.QLabel('%s:' % "Size"), hlay)
|
|
|
+ self.form_layout.addRow(FCLabel('%s:' % "Size"), hlay)
|
|
|
|
|
|
# Text input
|
|
|
self.text_input_entry = FCTextAreaRich()
|
|
|
@@ -319,13 +319,13 @@ class TextInputTool(AppTool):
|
|
|
# self.text_input_entry.setMaximumHeight(150)
|
|
|
self.text_input_entry.setCurrentFont(f_current)
|
|
|
self.text_input_entry.setFontPointSize(10)
|
|
|
- self.form_layout.addRow(QtWidgets.QLabel('%s:' % _("Text")), self.text_input_entry)
|
|
|
+ self.form_layout.addRow(FCLabel('%s:' % _("Text")), self.text_input_entry)
|
|
|
|
|
|
# Buttons
|
|
|
hlay1 = QtWidgets.QHBoxLayout()
|
|
|
self.form_layout.addRow("", hlay1)
|
|
|
hlay1.addStretch()
|
|
|
- self.apply_button = QtWidgets.QPushButton("Apply")
|
|
|
+ self.apply_button = FCButton(_("Apply"))
|
|
|
hlay1.addWidget(self.apply_button)
|
|
|
|
|
|
# self.layout.addStretch()
|
|
|
@@ -409,7 +409,7 @@ class PaintOptionsTool(AppTool):
|
|
|
Inputs to specify how to paint the selected polygons.
|
|
|
"""
|
|
|
|
|
|
- toolName = "Paint Tool"
|
|
|
+ toolName = _("Paint Tool")
|
|
|
|
|
|
def __init__(self, app, fcdraw):
|
|
|
AppTool.__init__(self, app)
|
|
|
@@ -419,7 +419,7 @@ class PaintOptionsTool(AppTool):
|
|
|
self.decimals = self.app.decimals
|
|
|
|
|
|
# Title
|
|
|
- title_label = QtWidgets.QLabel("%s" % ('Editor ' + self.toolName))
|
|
|
+ title_label = FCLabel("%s" % self.toolName)
|
|
|
title_label.setStyleSheet("""
|
|
|
QLabel
|
|
|
{
|
|
|
@@ -435,7 +435,7 @@ class PaintOptionsTool(AppTool):
|
|
|
grid.setColumnStretch(1, 1)
|
|
|
|
|
|
# Tool dia
|
|
|
- ptdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
|
|
|
+ ptdlabel = FCLabel('%s:' % _('Tool dia'))
|
|
|
ptdlabel.setToolTip(
|
|
|
_("Diameter of the tool to be used in the operation.")
|
|
|
)
|
|
|
@@ -447,7 +447,7 @@ class PaintOptionsTool(AppTool):
|
|
|
grid.addWidget(self.painttooldia_entry, 0, 1)
|
|
|
|
|
|
# Overlap
|
|
|
- ovlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
|
|
|
+ ovlabel = FCLabel('%s:' % _('Overlap'))
|
|
|
ovlabel.setToolTip(
|
|
|
_("How much (percentage) of the tool width to overlap each tool pass.\n"
|
|
|
"Adjust the value starting with lower values\n"
|
|
|
@@ -467,7 +467,7 @@ class PaintOptionsTool(AppTool):
|
|
|
grid.addWidget(self.paintoverlap_entry, 1, 1)
|
|
|
|
|
|
# Margin
|
|
|
- marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
|
|
|
+ marginlabel = FCLabel('%s:' % _('Margin'))
|
|
|
marginlabel.setToolTip(
|
|
|
_("Distance by which to avoid\n"
|
|
|
"the edges of the polygon to\n"
|
|
|
@@ -481,7 +481,7 @@ class PaintOptionsTool(AppTool):
|
|
|
grid.addWidget(self.paintmargin_entry, 2, 1)
|
|
|
|
|
|
# Method
|
|
|
- methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
|
|
|
+ methodlabel = FCLabel('%s:' % _('Method'))
|
|
|
methodlabel.setToolTip(
|
|
|
_("Algorithm to paint the polygons:\n"
|
|
|
"- Standard: Fixed step inwards.\n"
|
|
|
@@ -502,7 +502,7 @@ class PaintOptionsTool(AppTool):
|
|
|
grid.addWidget(self.paintmethod_combo, 3, 1)
|
|
|
|
|
|
# Connect lines
|
|
|
- pathconnectlabel = QtWidgets.QLabel(_("Connect:"))
|
|
|
+ pathconnectlabel = FCLabel('%s:' % _("Connect"))
|
|
|
pathconnectlabel.setToolTip(
|
|
|
_("Draw lines between resulting\n"
|
|
|
"segments to minimize tool lifts.")
|
|
|
@@ -512,7 +512,7 @@ class PaintOptionsTool(AppTool):
|
|
|
grid.addWidget(pathconnectlabel, 4, 0)
|
|
|
grid.addWidget(self.pathconnect_cb, 4, 1)
|
|
|
|
|
|
- contourlabel = QtWidgets.QLabel(_("Contour:"))
|
|
|
+ contourlabel = FCLabel('%s:' % _("Contour"))
|
|
|
contourlabel.setToolTip(
|
|
|
_("Cut around the perimeter of the polygon\n"
|
|
|
"to trim rough edges.")
|
|
|
@@ -525,7 +525,7 @@ class PaintOptionsTool(AppTool):
|
|
|
# Buttons
|
|
|
hlay = QtWidgets.QHBoxLayout()
|
|
|
self.layout.addLayout(hlay)
|
|
|
- self.paint_button = QtWidgets.QPushButton(_("Paint"))
|
|
|
+ self.paint_button = FCButton(_("Paint"))
|
|
|
hlay.addWidget(self.paint_button)
|
|
|
|
|
|
self.layout.addStretch()
|
|
|
@@ -619,7 +619,7 @@ class TransformEditorTool(AppTool):
|
|
|
self.decimals = self.app.decimals
|
|
|
|
|
|
# ## Title
|
|
|
- title_label = QtWidgets.QLabel("%s" % self.toolName)
|
|
|
+ title_label = FCLabel("%s" % self.toolName)
|
|
|
title_label.setStyleSheet("""
|
|
|
QLabel
|
|
|
{
|
|
|
@@ -628,7 +628,7 @@ class TransformEditorTool(AppTool):
|
|
|
}
|
|
|
""")
|
|
|
self.layout.addWidget(title_label)
|
|
|
- self.layout.addWidget(QtWidgets.QLabel(''))
|
|
|
+ self.layout.addWidget(FCLabel(''))
|
|
|
|
|
|
# ## Layout
|
|
|
grid0 = QtWidgets.QGridLayout()
|
|
|
@@ -637,10 +637,10 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.setColumnStretch(1, 1)
|
|
|
grid0.setColumnStretch(2, 0)
|
|
|
|
|
|
- grid0.addWidget(QtWidgets.QLabel(''))
|
|
|
+ grid0.addWidget(FCLabel(''))
|
|
|
|
|
|
# Reference
|
|
|
- ref_label = QtWidgets.QLabel('%s:' % _("Reference"))
|
|
|
+ ref_label = FCLabel('%s:' % _("Reference"))
|
|
|
ref_label.setToolTip(
|
|
|
_("The reference point for Rotate, Skew, Scale, Mirror.\n"
|
|
|
"Can be:\n"
|
|
|
@@ -656,7 +656,7 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(ref_label, 0, 0)
|
|
|
grid0.addWidget(self.ref_combo, 0, 1, 1, 2)
|
|
|
|
|
|
- self.point_label = QtWidgets.QLabel('%s:' % _("Value"))
|
|
|
+ self.point_label = FCLabel('%s:' % _("Value"))
|
|
|
self.point_label.setToolTip(
|
|
|
_("A point of reference in format X,Y.")
|
|
|
)
|
|
|
@@ -677,10 +677,10 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(separator_line, 5, 0, 1, 3)
|
|
|
|
|
|
# ## Rotate Title
|
|
|
- rotate_title_label = QtWidgets.QLabel("<font size=3><b>%s</b></font>" % self.rotateName)
|
|
|
+ rotate_title_label = FCLabel("<font size=3><b>%s</b></font>" % self.rotateName)
|
|
|
grid0.addWidget(rotate_title_label, 6, 0, 1, 3)
|
|
|
|
|
|
- self.rotate_label = QtWidgets.QLabel('%s:' % _("Angle"))
|
|
|
+ self.rotate_label = FCLabel('%s:' % _("Angle"))
|
|
|
self.rotate_label.setToolTip(
|
|
|
_("Angle for Rotation action, in degrees.\n"
|
|
|
"Float number between -360 and 359.\n"
|
|
|
@@ -714,7 +714,7 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(separator_line, 8, 0, 1, 3)
|
|
|
|
|
|
# ## Skew Title
|
|
|
- skew_title_label = QtWidgets.QLabel("<font size=3><b>%s</b></font>" % self.skewName)
|
|
|
+ skew_title_label = FCLabel("<font size=3><b>%s</b></font>" % self.skewName)
|
|
|
grid0.addWidget(skew_title_label, 9, 0, 1, 2)
|
|
|
|
|
|
self.skew_link_cb = FCCheckBox()
|
|
|
@@ -725,7 +725,7 @@ class TransformEditorTool(AppTool):
|
|
|
|
|
|
grid0.addWidget(self.skew_link_cb, 9, 2)
|
|
|
|
|
|
- self.skewx_label = QtWidgets.QLabel('%s:' % _("X angle"))
|
|
|
+ self.skewx_label = FCLabel('%s:' % _("X angle"))
|
|
|
self.skewx_label.setToolTip(
|
|
|
_("Angle for Skew action, in degrees.\n"
|
|
|
"Float number between -360 and 360.")
|
|
|
@@ -746,7 +746,7 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(self.skewx_entry, 10, 1)
|
|
|
grid0.addWidget(self.skewx_button, 10, 2)
|
|
|
|
|
|
- self.skewy_label = QtWidgets.QLabel('%s:' % _("Y angle"))
|
|
|
+ self.skewy_label = FCLabel('%s:' % _("Y angle"))
|
|
|
self.skewy_label.setToolTip(
|
|
|
_("Angle for Skew action, in degrees.\n"
|
|
|
"Float number between -360 and 360.")
|
|
|
@@ -776,7 +776,7 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(separator_line, 14, 0, 1, 3)
|
|
|
|
|
|
# ## Scale Title
|
|
|
- scale_title_label = QtWidgets.QLabel("<font size=3><b>%s</b></font>" % self.scaleName)
|
|
|
+ scale_title_label = FCLabel("<font size=3><b>%s</b></font>" % self.scaleName)
|
|
|
grid0.addWidget(scale_title_label, 15, 0, 1, 2)
|
|
|
|
|
|
self.scale_link_cb = FCCheckBox()
|
|
|
@@ -787,7 +787,7 @@ class TransformEditorTool(AppTool):
|
|
|
|
|
|
grid0.addWidget(self.scale_link_cb, 15, 2)
|
|
|
|
|
|
- self.scalex_label = QtWidgets.QLabel('%s:' % _("X factor"))
|
|
|
+ self.scalex_label = FCLabel('%s:' % _("X factor"))
|
|
|
self.scalex_label.setToolTip(
|
|
|
_("Factor for scaling on X axis.")
|
|
|
)
|
|
|
@@ -807,7 +807,7 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(self.scalex_entry, 17, 1)
|
|
|
grid0.addWidget(self.scalex_button, 17, 2)
|
|
|
|
|
|
- self.scaley_label = QtWidgets.QLabel('%s:' % _("Y factor"))
|
|
|
+ self.scaley_label = FCLabel('%s:' % _("Y factor"))
|
|
|
self.scaley_label.setToolTip(
|
|
|
_("Factor for scaling on Y axis.")
|
|
|
)
|
|
|
@@ -840,7 +840,7 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(separator_line, 21, 0, 1, 3)
|
|
|
|
|
|
# ## Flip Title
|
|
|
- flip_title_label = QtWidgets.QLabel("<font size=3><b>%s</b></font>" % self.flipName)
|
|
|
+ flip_title_label = FCLabel("<font size=3><b>%s</b></font>" % self.flipName)
|
|
|
grid0.addWidget(flip_title_label, 23, 0, 1, 3)
|
|
|
|
|
|
self.flipx_button = FCButton(_("Flip on X"))
|
|
|
@@ -865,10 +865,10 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(separator_line, 27, 0, 1, 3)
|
|
|
|
|
|
# ## Offset Title
|
|
|
- offset_title_label = QtWidgets.QLabel("<font size=3><b>%s</b></font>" % self.offsetName)
|
|
|
+ offset_title_label = FCLabel("<font size=3><b>%s</b></font>" % self.offsetName)
|
|
|
grid0.addWidget(offset_title_label, 29, 0, 1, 3)
|
|
|
|
|
|
- self.offx_label = QtWidgets.QLabel('%s:' % _("X val"))
|
|
|
+ self.offx_label = FCLabel('%s:' % _("X val"))
|
|
|
self.offx_label.setToolTip(
|
|
|
_("Distance to offset on X axis. In current units.")
|
|
|
)
|
|
|
@@ -888,7 +888,7 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(self.offx_entry, 31, 1)
|
|
|
grid0.addWidget(self.offx_button, 31, 2)
|
|
|
|
|
|
- self.offy_label = QtWidgets.QLabel('%s:' % _("Y val"))
|
|
|
+ self.offy_label = FCLabel('%s:' % _("Y val"))
|
|
|
self.offy_label.setToolTip(
|
|
|
_("Distance to offset on Y axis. In current units.")
|
|
|
)
|
|
|
@@ -914,7 +914,7 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(separator_line, 34, 0, 1, 3)
|
|
|
|
|
|
# ## Buffer Title
|
|
|
- buffer_title_label = QtWidgets.QLabel("<font size=3><b>%s</b></font>" % self.bufferName)
|
|
|
+ buffer_title_label = FCLabel("<font size=3><b>%s</b></font>" % self.bufferName)
|
|
|
grid0.addWidget(buffer_title_label, 35, 0, 1, 2)
|
|
|
|
|
|
self.buffer_rounded_cb = FCCheckBox('%s' % _("Rounded"))
|
|
|
@@ -927,7 +927,7 @@ class TransformEditorTool(AppTool):
|
|
|
|
|
|
grid0.addWidget(self.buffer_rounded_cb, 35, 2)
|
|
|
|
|
|
- self.buffer_label = QtWidgets.QLabel('%s:' % _("Distance"))
|
|
|
+ self.buffer_label = FCLabel('%s:' % _("Distance"))
|
|
|
self.buffer_label.setToolTip(
|
|
|
_("A positive value will create the effect of dilation,\n"
|
|
|
"while a negative value will create the effect of erosion.\n"
|
|
|
@@ -952,7 +952,7 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(self.buffer_entry, 37, 1)
|
|
|
grid0.addWidget(self.buffer_button, 37, 2)
|
|
|
|
|
|
- self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Value"))
|
|
|
+ self.buffer_factor_label = FCLabel('%s:' % _("Value"))
|
|
|
self.buffer_factor_label.setToolTip(
|
|
|
_("A positive value will create the effect of dilation,\n"
|
|
|
"while a negative value will create the effect of erosion.\n"
|
|
|
@@ -978,7 +978,7 @@ class TransformEditorTool(AppTool):
|
|
|
grid0.addWidget(self.buffer_factor_entry, 38, 1)
|
|
|
grid0.addWidget(self.buffer_factor_button, 38, 2)
|
|
|
|
|
|
- grid0.addWidget(QtWidgets.QLabel(''), 42, 0, 1, 3)
|
|
|
+ grid0.addWidget(FCLabel(''), 42, 0, 1, 3)
|
|
|
|
|
|
self.layout.addStretch()
|
|
|
|
|
|
@@ -3273,15 +3273,15 @@ class AppGeoEditor(QtCore.QObject):
|
|
|
|
|
|
# ## Page Title icon
|
|
|
pixmap = QtGui.QPixmap(self.app.resource_location + '/flatcam_icon32.png')
|
|
|
- self.icon = QtWidgets.QLabel()
|
|
|
+ self.icon = FCLabel()
|
|
|
self.icon.setPixmap(pixmap)
|
|
|
self.title_box.addWidget(self.icon, stretch=0)
|
|
|
|
|
|
# ## Title label
|
|
|
- self.title_label = QtWidgets.QLabel("<font size=5><b>%s</b></font>" % _('Geometry Editor'))
|
|
|
+ self.title_label = FCLabel("<font size=5><b>%s</b></font>" % _('Geometry Editor'))
|
|
|
self.title_label.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
|
|
self.title_box.addWidget(self.title_label, stretch=1)
|
|
|
- self.title_box.addWidget(QtWidgets.QLabel(''))
|
|
|
+ self.title_box.addWidget(FCLabel(''))
|
|
|
|
|
|
self.tw = FCTree(columns=3, header_hidden=False, protected_column=[0, 1], extended_sel=True)
|
|
|
self.tw.setHeaderLabels(["ID", _("Type"), _("Name")])
|
|
|
@@ -3298,7 +3298,7 @@ class AppGeoEditor(QtCore.QObject):
|
|
|
layout.addStretch()
|
|
|
|
|
|
# Editor
|
|
|
- self.exit_editor_button = QtWidgets.QPushButton(_('Exit Editor'))
|
|
|
+ self.exit_editor_button = FCButton(_('Exit Editor'))
|
|
|
self.exit_editor_button.setIcon(QtGui.QIcon(self.app.resource_location + '/power16.png'))
|
|
|
self.exit_editor_button.setToolTip(
|
|
|
_("Exit from Editor.")
|