diff --git a/FlatCAMEditor.py b/FlatCAMEditor.py index 15324f27..3c1b4dc5 100644 --- a/FlatCAMEditor.py +++ b/FlatCAMEditor.py @@ -82,33 +82,33 @@ class BufferSelectionTool(FlatCAMTool): # Buffer distance self.buffer_distance_entry = FCEntry() - form_layout.addRow("Buffer distance:", self.buffer_distance_entry) - self.buffer_corner_lbl = QtWidgets.QLabel("Buffer corner:") + form_layout.addRow(_tr("Buffer distance:"), self.buffer_distance_entry) + self.buffer_corner_lbl = QtWidgets.QLabel(_tr("Buffer corner:")) self.buffer_corner_lbl.setToolTip( - "There are 3 types of corners:\n" + _tr("There are 3 types of corners:\n" " - 'Round': the corner is rounded for exterior buffer.\n" " - 'Square:' the corner is met in a sharp angle for exterior buffer.\n" - " - 'Beveled:' the corner is a line that directly connects the features meeting in the corner" + " - 'Beveled:' the corner is a line that directly connects the features meeting in the corner") ) self.buffer_corner_cb = FCComboBox() - self.buffer_corner_cb.addItem("Round") - self.buffer_corner_cb.addItem("Square") - self.buffer_corner_cb.addItem("Beveled") + self.buffer_corner_cb.addItem(_tr("Round")) + self.buffer_corner_cb.addItem(_tr("Square")) + self.buffer_corner_cb.addItem(_tr("Beveled")) form_layout.addRow(self.buffer_corner_lbl, self.buffer_corner_cb) # Buttons hlay = QtWidgets.QHBoxLayout() self.buffer_tools_box.addLayout(hlay) - self.buffer_int_button = QtWidgets.QPushButton("Buffer Interior") + self.buffer_int_button = QtWidgets.QPushButton(_tr("Buffer Interior")) hlay.addWidget(self.buffer_int_button) - self.buffer_ext_button = QtWidgets.QPushButton("Buffer Exterior") + self.buffer_ext_button = QtWidgets.QPushButton(_tr("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 = QtWidgets.QPushButton(_tr("Full Buffer")) hlay1.addWidget(self.buffer_button) self.layout.addStretch() @@ -129,7 +129,7 @@ class BufferSelectionTool(FlatCAMTool): if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) - self.app.ui.notebook.setTabText(2, "Buffer Tool") + self.app.ui.notebook.setTabText(2, _tr("Buffer Tool")) def on_buffer(self): try: @@ -140,8 +140,8 @@ class BufferSelectionTool(FlatCAMTool): buffer_distance = float(self.buffer_distance_entry.get_value().replace(',', '.')) self.buffer_distance_entry.set_value(buffer_distance) except ValueError: - self.app.inform.emit("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " - "Add it and retry.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " + "Add it and retry.")) return # the cb index start from 0 but the join styles for the buffer start from 1 therefore the adjustment # I populated the combobox such that the index coincide with the join styles value (which is really an INT) @@ -157,8 +157,8 @@ class BufferSelectionTool(FlatCAMTool): buffer_distance = float(self.buffer_distance_entry.get_value().replace(',', '.')) self.buffer_distance_entry.set_value(buffer_distance) except ValueError: - self.app.inform.emit("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " - "Add it and retry.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " + "Add it and retry.")) return # the cb index start from 0 but the join styles for the buffer start from 1 therefore the adjustment # I populated the combobox such that the index coincide with the join styles value (which is really an INT) @@ -174,8 +174,8 @@ class BufferSelectionTool(FlatCAMTool): buffer_distance = float(self.buffer_distance_entry.get_value().replace(',', '.')) self.buffer_distance_entry.set_value(buffer_distance) except ValueError: - self.app.inform.emit("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " - "Add it and retry.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " + "Add it and retry.")) return # the cb index start from 0 but the join styles for the buffer start from 1 therefore the adjustment # I populated the combobox such that the index coincide with the join styles value (which is really an INT) @@ -422,10 +422,10 @@ class PaintOptionsTool(FlatCAMTool): self.layout.addLayout(grid) # Tool dia - ptdlabel = QtWidgets.QLabel('Tool dia:') + ptdlabel = QtWidgets.QLabel(_tr('Tool dia:')) ptdlabel.setToolTip( - "Diameter of the tool to\n" - "be used in the operation." + _tr( "Diameter of the tool to\n" + "be used in the operation.") ) grid.addWidget(ptdlabel, 0, 0) @@ -433,9 +433,9 @@ class PaintOptionsTool(FlatCAMTool): grid.addWidget(self.painttooldia_entry, 0, 1) # Overlap - ovlabel = QtWidgets.QLabel('Overlap:') + ovlabel = QtWidgets.QLabel(_tr('Overlap:')) ovlabel.setToolTip( - "How much (fraction) of the tool width to overlap each tool pass.\n" + _tr("How much (fraction) of the tool width to overlap each tool pass.\n" "Example:\n" "A value here of 0.25 means 25% from the tool diameter found above.\n\n" "Adjust the value starting with lower values\n" @@ -443,7 +443,7 @@ class PaintOptionsTool(FlatCAMTool): "not painted.\n" "Lower values = faster processing, faster execution on PCB.\n" "Higher values = slow processing and slow execution on CNC\n" - "due of too many paths." + "due of too many paths.") ) grid.addWidget(ovlabel, 1, 0) self.paintoverlap_entry = FCEntry() @@ -451,45 +451,45 @@ class PaintOptionsTool(FlatCAMTool): grid.addWidget(self.paintoverlap_entry, 1, 1) # Margin - marginlabel = QtWidgets.QLabel('Margin:') + marginlabel = QtWidgets.QLabel(_tr('Margin:')) marginlabel.setToolTip( - "Distance by which to avoid\n" + _tr( "Distance by which to avoid\n" "the edges of the polygon to\n" - "be painted." + "be painted.") ) grid.addWidget(marginlabel, 2, 0) self.paintmargin_entry = FCEntry() grid.addWidget(self.paintmargin_entry, 2, 1) # Method - methodlabel = QtWidgets.QLabel('Method:') + methodlabel = QtWidgets.QLabel(_tr('Method:')) methodlabel.setToolTip( - "Algorithm to paint the polygon:
" + _tr("Algorithm to paint the polygon:
" "Standard: Fixed step inwards.
" - "Seed-based: Outwards from seed." + "Seed-based: Outwards from seed.") ) grid.addWidget(methodlabel, 3, 0) self.paintmethod_combo = RadioSet([ - {"label": "Standard", "value": "standard"}, - {"label": "Seed-based", "value": "seed"}, - {"label": "Straight lines", "value": "lines"} + {"label": _tr("Standard"), "value": "standard"}, + {"label": _tr("Seed-based"), "value": "seed"}, + {"label": _tr("Straight lines"), "value": "lines"} ], orientation='vertical', stretch=False) grid.addWidget(self.paintmethod_combo, 3, 1) # Connect lines - pathconnectlabel = QtWidgets.QLabel("Connect:") + pathconnectlabel = QtWidgets.QLabel(_tr("Connect:")) pathconnectlabel.setToolTip( - "Draw lines between resulting\n" - "segments to minimize tool lifts." + _tr( "Draw lines between resulting\n" + "segments to minimize tool lifts.") ) grid.addWidget(pathconnectlabel, 4, 0) self.pathconnect_cb = FCCheckBox() grid.addWidget(self.pathconnect_cb, 4, 1) - contourlabel = QtWidgets.QLabel("Contour:") + contourlabel = QtWidgets.QLabel(_tr("Contour:")) contourlabel.setToolTip( - "Cut around the perimeter of the polygon\n" - "to trim rough edges." + _tr("Cut around the perimeter of the polygon\n" + "to trim rough edges.") ) grid.addWidget(contourlabel, 5, 0) self.paintcontour_cb = FCCheckBox() @@ -500,7 +500,7 @@ class PaintOptionsTool(FlatCAMTool): hlay = QtWidgets.QHBoxLayout() self.layout.addLayout(hlay) hlay.addStretch() - self.paint_button = QtWidgets.QPushButton("Paint") + self.paint_button = QtWidgets.QPushButton(_tr("Paint")) hlay.addWidget(self.paint_button) self.layout.addStretch() @@ -518,7 +518,7 @@ class PaintOptionsTool(FlatCAMTool): if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) - self.app.ui.notebook.setTabText(2, "Paint Tool") + self.app.ui.notebook.setTabText(2, _tr("Paint Tool")) def set_tool_ui(self): ## Init GUI @@ -554,7 +554,7 @@ class PaintOptionsTool(FlatCAMTool): def on_paint(self): if not self.fcdraw.selected: - self.app.inform.emit("[WARNING_NOTCL] Paint cancelled. No shape selected.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Paint cancelled. No shape selected.")) return try: @@ -565,8 +565,8 @@ class PaintOptionsTool(FlatCAMTool): tooldia = float(self.painttooldia_entry.get_value().replace(',', '.')) self.painttooldia_entry.set_value(tooldia) except ValueError: - self.app.inform.emit("[WARNING_NOTCL] Tool diameter value is missing or wrong format. " - "Add it and retry.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Tool diameter value is missing or wrong format. " + "Add it and retry.")) return try: overlap = float(self.paintoverlap_entry.get_value()) @@ -576,8 +576,8 @@ class PaintOptionsTool(FlatCAMTool): overlap = float(self.paintoverlap_entry.get_value().replace(',', '.')) self.paintoverlap_entry.set_value(overlap) except ValueError: - self.app.inform.emit("[WARNING_NOTCL] Overlap value is missing or wrong format. " - "Add it and retry.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Overlap value is missing or wrong format. " + "Add it and retry.")) return try: @@ -588,8 +588,8 @@ class PaintOptionsTool(FlatCAMTool): margin = float(self.paintmargin_entry.get_value().replace(',', '.')) self.paintmargin_entry.set_value(margin) except ValueError: - self.app.inform.emit("[WARNING_NOTCL] Margin distance value is missing or wrong format. " - "Add it and retry.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Margin distance value is missing or wrong format. " + "Add it and retry.")) return method = self.paintmethod_combo.get_value() contour = self.paintcontour_cb.get_value() @@ -597,7 +597,7 @@ class PaintOptionsTool(FlatCAMTool): self.fcdraw.paint(tooldia, overlap, margin, connect=connect, contour=contour, method=method) self.fcdraw.select_tool("select") - self.app.ui.notebook.setTabText(2, "Tools") + self.app.ui.notebook.setTabText(2, _tr("Tools")) self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab) self.app.ui.splitter.setSizes([0, 1]) @@ -608,12 +608,12 @@ class TransformEditorTool(FlatCAMTool): Inputs to specify how to paint the selected polygons. """ - toolName = "Transform Tool" - rotateName = "Rotate" - skewName = "Skew/Shear" - scaleName = "Scale" - flipName = "Mirror (Flip)" - offsetName = "Offset" + toolName = _tr("Transform Tool") + rotateName = _tr("Rotate") + skewName = _tr("Skew/Shear") + scaleName = _tr("Scale") + flipName = _tr("Mirror (Flip)") + offsetName = _tr("Offset") def __init__(self, app, draw_app): FlatCAMTool.__init__(self, app) @@ -624,7 +624,7 @@ class TransformEditorTool(FlatCAMTool): self.transform_lay = QtWidgets.QVBoxLayout() self.layout.addLayout(self.transform_lay) ## Title - title_label = QtWidgets.QLabel("%s" % ('Editor ' + self.toolName)) + title_label = QtWidgets.QLabel("%s" % (_tr('Editor %s') % self.toolName)) title_label.setStyleSheet(""" QLabel { @@ -656,12 +656,12 @@ class TransformEditorTool(FlatCAMTool): self.transform_lay.addLayout(form_layout) form_child = QtWidgets.QHBoxLayout() - self.rotate_label = QtWidgets.QLabel("Angle:") + self.rotate_label = QtWidgets.QLabel(_tr("Angle:")) self.rotate_label.setToolTip( - "Angle for Rotation action, in degrees.\n" + _tr( "Angle for Rotation action, in degrees.\n" "Float number between -360 and 359.\n" "Positive numbers for CW motion.\n" - "Negative numbers for CCW motion." + "Negative numbers for CCW motion.") ) self.rotate_label.setFixedWidth(50) @@ -670,11 +670,11 @@ class TransformEditorTool(FlatCAMTool): self.rotate_entry.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.rotate_button = FCButton() - self.rotate_button.set_value("Rotate") + self.rotate_button.set_value(_tr("Rotate")) self.rotate_button.setToolTip( - "Rotate the selected shape(s).\n" + _tr("Rotate the selected shape(s).\n" "The point of reference is the middle of\n" - "the bounding box for all selected shapes." + "the bounding box for all selected shapes.") ) self.rotate_button.setFixedWidth(60) @@ -695,10 +695,10 @@ class TransformEditorTool(FlatCAMTool): form1_child_1 = QtWidgets.QHBoxLayout() form1_child_2 = QtWidgets.QHBoxLayout() - self.skewx_label = QtWidgets.QLabel("Angle X:") + self.skewx_label = QtWidgets.QLabel(_tr("Angle X:")) self.skewx_label.setToolTip( - "Angle for Skew action, in degrees.\n" - "Float number between -360 and 359." + _tr( "Angle for Skew action, in degrees.\n" + "Float number between -360 and 359.") ) self.skewx_label.setFixedWidth(50) self.skewx_entry = FCEntry() @@ -706,17 +706,17 @@ class TransformEditorTool(FlatCAMTool): # self.skewx_entry.setFixedWidth(60) self.skewx_button = FCButton() - self.skewx_button.set_value("Skew X") + self.skewx_button.set_value(_tr("Skew X")) self.skewx_button.setToolTip( - "Skew/shear the selected shape(s).\n" + _tr( "Skew/shear the selected shape(s).\n" "The point of reference is the middle of\n" - "the bounding box for all selected shapes.") + "the bounding box for all selected shapes.")) self.skewx_button.setFixedWidth(60) - self.skewy_label = QtWidgets.QLabel("Angle Y:") + self.skewy_label = QtWidgets.QLabel(_tr("Angle Y:")) self.skewy_label.setToolTip( - "Angle for Skew action, in degrees.\n" - "Float number between -360 and 359." + _tr( "Angle for Skew action, in degrees.\n" + "Float number between -360 and 359.") ) self.skewy_label.setFixedWidth(50) self.skewy_entry = FCEntry() @@ -724,11 +724,11 @@ class TransformEditorTool(FlatCAMTool): # self.skewy_entry.setFixedWidth(60) self.skewy_button = FCButton() - self.skewy_button.set_value("Skew Y") + self.skewy_button.set_value(_tr("Skew Y")) self.skewy_button.setToolTip( - "Skew/shear the selected shape(s).\n" + _tr("Skew/shear the selected shape(s).\n" "The point of reference is the middle of\n" - "the bounding box for all selected shapes.") + "the bounding box for all selected shapes.")) self.skewy_button.setFixedWidth(60) form1_child_1.addWidget(self.skewx_entry) @@ -752,9 +752,9 @@ class TransformEditorTool(FlatCAMTool): form2_child_1 = QtWidgets.QHBoxLayout() form2_child_2 = QtWidgets.QHBoxLayout() - self.scalex_label = QtWidgets.QLabel("Factor X:") + self.scalex_label = QtWidgets.QLabel(_tr("Factor X:")) self.scalex_label.setToolTip( - "Factor for Scale action over X axis." + _tr("Factor for Scale action over X axis.") ) self.scalex_label.setFixedWidth(50) self.scalex_entry = FCEntry() @@ -762,16 +762,16 @@ class TransformEditorTool(FlatCAMTool): # self.scalex_entry.setFixedWidth(60) self.scalex_button = FCButton() - self.scalex_button.set_value("Scale X") + self.scalex_button.set_value(_tr("Scale X")) self.scalex_button.setToolTip( - "Scale the selected shape(s).\n" + _tr( "Scale the selected shape(s).\n" "The point of reference depends on \n" - "the Scale reference checkbox state.") + "the Scale reference checkbox state.")) self.scalex_button.setFixedWidth(60) - self.scaley_label = QtWidgets.QLabel("Factor Y:") + self.scaley_label = QtWidgets.QLabel(_tr("Factor Y:")) self.scaley_label.setToolTip( - "Factor for Scale action over Y axis." + _tr("Factor for Scale action over Y axis.") ) self.scaley_label.setFixedWidth(50) self.scaley_entry = FCEntry() @@ -779,29 +779,29 @@ class TransformEditorTool(FlatCAMTool): # self.scaley_entry.setFixedWidth(60) self.scaley_button = FCButton() - self.scaley_button.set_value("Scale Y") + self.scaley_button.set_value(_tr("Scale Y")) self.scaley_button.setToolTip( - "Scale the selected shape(s).\n" + _tr( "Scale the selected shape(s).\n" "The point of reference depends on \n" - "the Scale reference checkbox state.") + "the Scale reference checkbox state.")) self.scaley_button.setFixedWidth(60) self.scale_link_cb = FCCheckBox() self.scale_link_cb.set_value(True) - self.scale_link_cb.setText("Link") + self.scale_link_cb.setText(_tr("Link")) self.scale_link_cb.setToolTip( - "Scale the selected shape(s)\n" - "using the Scale Factor X for both axis.") + _tr("Scale the selected shape(s)\n" + "using the Scale Factor X for both axis.")) self.scale_link_cb.setFixedWidth(50) self.scale_zero_ref_cb = FCCheckBox() self.scale_zero_ref_cb.set_value(True) - self.scale_zero_ref_cb.setText("Scale Reference") + self.scale_zero_ref_cb.setText(_tr("Scale Reference")) self.scale_zero_ref_cb.setToolTip( - "Scale the selected shape(s)\n" + _tr("Scale the selected shape(s)\n" "using the origin reference when checked,\n" "and the center of the biggest bounding box\n" - "of the selected shapes when unchecked.") + "of the selected shapes when unchecked.")) form2_child_1.addWidget(self.scalex_entry) form2_child_1.addWidget(self.scalex_button) @@ -826,9 +826,9 @@ class TransformEditorTool(FlatCAMTool): form3_child_1 = QtWidgets.QHBoxLayout() form3_child_2 = QtWidgets.QHBoxLayout() - self.offx_label = QtWidgets.QLabel("Value X:") + self.offx_label = QtWidgets.QLabel(_tr("Value X:")) self.offx_label.setToolTip( - "Value for Offset action on X axis." + _tr("Value for Offset action on X axis.") ) self.offx_label.setFixedWidth(50) self.offx_entry = FCEntry() @@ -836,16 +836,17 @@ class TransformEditorTool(FlatCAMTool): # self.offx_entry.setFixedWidth(60) self.offx_button = FCButton() - self.offx_button.set_value("Offset X") + self.offx_button.set_value(_tr("Offset X")) self.offx_button.setToolTip( - "Offset the selected shape(s).\n" + _tr( "Offset the selected shape(s).\n" "The point of reference is the middle of\n" "the bounding box for all selected shapes.\n") + ) self.offx_button.setFixedWidth(60) - self.offy_label = QtWidgets.QLabel("Value Y:") + self.offy_label = QtWidgets.QLabel(_tr("Value Y:")) self.offy_label.setToolTip( - "Value for Offset action on Y axis." + _tr("Value for Offset action on Y axis.") ) self.offy_label.setFixedWidth(50) self.offy_entry = FCEntry() @@ -853,11 +854,12 @@ class TransformEditorTool(FlatCAMTool): # self.offy_entry.setFixedWidth(60) self.offy_button = FCButton() - self.offy_button.set_value("Offset Y") + self.offy_button.set_value(_tr("Offset Y")) self.offy_button.setToolTip( - "Offset the selected shape(s).\n" + _tr("Offset the selected shape(s).\n" "The point of reference is the middle of\n" "the bounding box for all selected shapes.\n") + ) self.offy_button.setFixedWidth(60) form3_child_1.addWidget(self.offx_entry) @@ -883,26 +885,26 @@ class TransformEditorTool(FlatCAMTool): form4_child_1 = QtWidgets.QHBoxLayout() self.flipx_button = FCButton() - self.flipx_button.set_value("Flip on X") + self.flipx_button.set_value(_tr("Flip on X")) self.flipx_button.setToolTip( - "Flip the selected shape(s) over the X axis.\n" - "Does not create a new shape.\n " + _tr("Flip the selected shape(s) over the X axis.\n" + "Does not create a new shape.") ) self.flipx_button.setFixedWidth(60) self.flipy_button = FCButton() - self.flipy_button.set_value("Flip on Y") + self.flipy_button.set_value(_tr("Flip on Y")) self.flipy_button.setToolTip( - "Flip the selected shape(s) over the X axis.\n" - "Does not create a new shape.\n " + _tr("Flip the selected shape(s) over the X axis.\n" + "Does not create a new shape.") ) self.flipy_button.setFixedWidth(60) self.flip_ref_cb = FCCheckBox() self.flip_ref_cb.set_value(True) - self.flip_ref_cb.setText("Ref Pt") + self.flip_ref_cb.setText(_tr("Ref Pt")) self.flip_ref_cb.setToolTip( - "Flip the selected shape(s)\n" + _tr("Flip the selected shape(s)\n" "around the point in Point Entry Field.\n" "\n" "The point coordinates can be captured by\n" @@ -911,13 +913,14 @@ class TransformEditorTool(FlatCAMTool): "Then click Add button to insert coordinates.\n" "Or enter the coords in format (x, y) in the\n" "Point Entry field and click Flip on X(Y)") + ) self.flip_ref_cb.setFixedWidth(50) - self.flip_ref_label = QtWidgets.QLabel("Point:") + self.flip_ref_label = QtWidgets.QLabel(_tr("Point:")) self.flip_ref_label.setToolTip( - "Coordinates in format (x, y) used as reference for mirroring.\n" + _tr("Coordinates in format (x, y) used as reference for mirroring.\n" "The 'x' in (x, y) will be used when using Flip on X and\n" - "the 'y' in (x, y) will be used when using Flip on Y and" + "the 'y' in (x, y) will be used when using Flip on Y.") ) self.flip_ref_label.setFixedWidth(50) self.flip_ref_entry = EvalEntry2("(0, 0)") @@ -925,11 +928,12 @@ class TransformEditorTool(FlatCAMTool): # self.flip_ref_entry.setFixedWidth(60) self.flip_ref_button = FCButton() - self.flip_ref_button.set_value("Add") + self.flip_ref_button.set_value(_tr("Add")) self.flip_ref_button.setToolTip( - "The point coordinates can be captured by\n" + _tr( "The point coordinates can be captured by\n" "left click on canvas together with pressing\n" "SHIFT key. Then click Add button to insert.") + ) self.flip_ref_button.setFixedWidth(60) form4_child_hlay.addStretch() @@ -977,7 +981,7 @@ class TransformEditorTool(FlatCAMTool): if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) - self.app.ui.notebook.setTabText(2, "Transform Tool") + self.app.ui.notebook.setTabText(2, _tr("Transform Tool")) def install(self, icon=None, separator=None, **kwargs): FlatCAMTool.install(self, icon, separator, shortcut='ALT+T', **kwargs) @@ -1041,7 +1045,7 @@ class TransformEditorTool(FlatCAMTool): def template(self): if not self.fcdraw.selected: - self.app.inform.emit("[WARNING_NOTCL] Transformation cancelled. No shape selected.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Transformation cancelled. No shape selected.")) return @@ -1062,8 +1066,8 @@ class TransformEditorTool(FlatCAMTool): try: value = float(self.rotate_entry.get_value().replace(',', '.')) except ValueError: - self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Rotate, " - "use a number.") + self.app.inform.emit(_tr("[ERROR_NOTCL]Wrong value format entered for Rotate, " + "use a number.")) return self.app.worker_task.emit({'fcn': self.on_rotate_action, 'params': [value]}) @@ -1099,8 +1103,8 @@ class TransformEditorTool(FlatCAMTool): try: value = float(self.skewx_entry.get_value().replace(',', '.')) except ValueError: - self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Skew X, " - "use a number.") + self.app.inform.emit(_tr("[ERROR_NOTCL]Wrong value format entered for Skew X, " + "use a number.")) return # self.on_skew("X", value) @@ -1120,8 +1124,8 @@ class TransformEditorTool(FlatCAMTool): try: value = float(self.skewy_entry.get_value().replace(',', '.')) except ValueError: - self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Skew Y, " - "use a number.") + self.app.inform.emit(_tr("[ERROR_NOTCL]Wrong value format entered for Skew Y, " + "use a number.")) return # self.on_skew("Y", value) @@ -1141,8 +1145,8 @@ class TransformEditorTool(FlatCAMTool): try: xvalue = float(self.scalex_entry.get_value().replace(',', '.')) except ValueError: - self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Scale X, " - "use a number.") + self.app.inform.emit(_tr("[ERROR_NOTCL]Wrong value format entered for Scale X, " + "use a number.")) return # scaling to zero has no sense so we remove it, because scaling with 1 does nothing @@ -1178,8 +1182,8 @@ class TransformEditorTool(FlatCAMTool): try: yvalue = float(self.scaley_entry.get_value().replace(',', '.')) except ValueError: - self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Scale Y, " - "use a number.") + self.app.inform.emit(_tr("[ERROR_NOTCL]Wrong value format entered for Scale Y, " + "use a number.")) return # scaling to zero has no sense so we remove it, because scaling with 1 does nothing @@ -1210,8 +1214,8 @@ class TransformEditorTool(FlatCAMTool): try: value = float(self.offx_entry.get_value().replace(',', '.')) except ValueError: - self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Offset X, " - "use a number.") + self.app.inform.emit(_tr("[ERROR_NOTCL]Wrong value format entered for Offset X, " + "use a number.")) return # self.on_offset("X", value) @@ -1231,8 +1235,8 @@ class TransformEditorTool(FlatCAMTool): try: value = float(self.offy_entry.get_value().replace(',', '.')) except ValueError: - self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered for Offset Y, " - "use a number.") + self.app.inform.emit(_tr("[ERROR_NOTCL]Wrong value format entered for Offset Y, " + "use a number.")) return # self.on_offset("Y", value) @@ -1249,10 +1253,10 @@ class TransformEditorTool(FlatCAMTool): ymaxlist = [] if not shape_list: - self.app.inform.emit("[WARNING_NOTCL] No shape selected. Please Select a shape to rotate!") + self.app.inform.emit(_tr("[WARNING_NOTCL] No shape selected. Please Select a shape to rotate!")) return else: - with self.app.proc_container.new("Appying Rotate"): + with self.app.proc_container.new(_tr("Appying Rotate")): try: # first get a bounding box to fit all for sha in shape_list: @@ -1280,12 +1284,12 @@ class TransformEditorTool(FlatCAMTool): # self.draw_app.transform_complete.emit() - self.app.inform.emit("[success] Done. Rotate completed.") + self.app.inform.emit(_tr("[success] Done. Rotate completed.")) self.app.progress.emit(100) except Exception as e: - self.app.inform.emit("[ERROR_NOTCL] Due of %s, rotation movement was not executed." % str(e)) + self.app.inform.emit(_tr("[ERROR_NOTCL] Due of %s, rotation movement was not executed.") % str(e)) return def on_flip(self, axis): @@ -1296,10 +1300,10 @@ class TransformEditorTool(FlatCAMTool): ymaxlist = [] if not shape_list: - self.app.inform.emit("[WARNING_NOTCL] No shape selected. Please Select a shape to flip!") + self.app.inform.emit(_tr("[WARNING_NOTCL] No shape selected. Please Select a shape to flip!")) return else: - with self.app.proc_container.new("Applying Flip"): + with self.app.proc_container.new(_tr("Applying Flip")): try: # get mirroring coords from the point entry if self.flip_ref_cb.isChecked(): @@ -1329,10 +1333,10 @@ class TransformEditorTool(FlatCAMTool): for sha in shape_list: if axis is 'X': sha.mirror('X', (px, py)) - self.app.inform.emit('[success] Flip on the Y axis done ...') + self.app.inform.emit(_tr('[success] Flip on the Y axis done ...')) elif axis is 'Y': sha.mirror('Y', (px, py)) - self.app.inform.emit('[success] Flip on the X axis done ...') + self.app.inform.emit(_tr('[success] Flip on the X axis done ...')) self.draw_app.replot() # self.draw_app.add_shape(DrawToolShape(sha.geo)) @@ -1342,7 +1346,7 @@ class TransformEditorTool(FlatCAMTool): self.app.progress.emit(100) except Exception as e: - self.app.inform.emit("[ERROR_NOTCL] Due of %s, Flip action was not executed." % str(e)) + self.app.inform.emit(_tr("[ERROR_NOTCL] Due of %s, Flip action was not executed.") % str(e)) return def on_skew(self, axis, num): @@ -1351,10 +1355,10 @@ class TransformEditorTool(FlatCAMTool): yminlist = [] if not shape_list: - self.app.inform.emit("[WARNING_NOTCL] No shape selected. Please Select a shape to shear/skew!") + self.app.inform.emit(_tr("[WARNING_NOTCL] No shape selected. Please Select a shape to shear/skew!")) return else: - with self.app.proc_container.new("Applying Skew"): + with self.app.proc_container.new(_tr("Applying Skew")): try: # first get a bounding box to fit all for sha in shape_list: @@ -1379,11 +1383,11 @@ class TransformEditorTool(FlatCAMTool): # # self.draw_app.transform_complete.emit() - self.app.inform.emit('[success] Skew on the %s axis done ...' % str(axis)) + self.app.inform.emit(_tr('[success] Skew on the %s axis done ...') % str(axis)) self.app.progress.emit(100) except Exception as e: - self.app.inform.emit("[ERROR_NOTCL] Due of %s, Skew action was not executed." % str(e)) + self.app.inform.emit(_tr("[ERROR_NOTCL] Due of %s, Skew action was not executed.") % str(e)) return def on_scale(self, axis, xfactor, yfactor, point=None): @@ -1394,10 +1398,10 @@ class TransformEditorTool(FlatCAMTool): ymaxlist = [] if not shape_list: - self.app.inform.emit("[WARNING_NOTCL] No shape selected. Please Select a shape to scale!") + self.app.inform.emit(_tr("[WARNING_NOTCL] No shape selected. Please Select a shape to scale!")) return else: - with self.app.proc_container.new("Applying Scale"): + with self.app.proc_container.new(_tr("Applying Scale")): try: # first get a bounding box to fit all for sha in shape_list: @@ -1430,10 +1434,10 @@ class TransformEditorTool(FlatCAMTool): # # self.draw_app.transform_complete.emit() - self.app.inform.emit('[success] Scale on the %s axis done ...' % str(axis)) + self.app.inform.emit(_tr('[success] Scale on the %s axis done ...') % str(axis)) self.app.progress.emit(100) except Exception as e: - self.app.inform.emit("[ERROR_NOTCL] Due of %s, Scale action was not executed." % str(e)) + self.app.inform.emit(_tr("[ERROR_NOTCL] Due of %s, Scale action was not executed.") % str(e)) return def on_offset(self, axis, num): @@ -1442,10 +1446,10 @@ class TransformEditorTool(FlatCAMTool): yminlist = [] if not shape_list: - self.app.inform.emit("[WARNING_NOTCL] No shape selected. Please Select a shape to offset!") + self.app.inform.emit(_tr("[WARNING_NOTCL] No shape selected. Please Select a shape to offset!")) return else: - with self.app.proc_container.new("Applying Offset"): + with self.app.proc_container.new(_tr("Applying Offset")): try: # first get a bounding box to fit all for sha in shape_list: @@ -1469,16 +1473,16 @@ class TransformEditorTool(FlatCAMTool): # # self.draw_app.transform_complete.emit() - self.app.inform.emit('[success] Offset on the %s axis done ...' % str(axis)) + self.app.inform.emit(_tr('[success] Offset on the %s axis done ...') % str(axis)) self.app.progress.emit(100) except Exception as e: - self.app.inform.emit("[ERROR_NOTCL] Due of %s, Offset action was not executed." % str(e)) + self.app.inform.emit(_tr("[ERROR_NOTCL] Due of %s, Offset action was not executed.") % str(e)) return def on_rotate_key(self): - val_box = FCInputDialog(title="Rotate ...", - text='Enter an Angle Value (degrees):', + val_box = FCInputDialog(title=_tr("Rotate ..."), + text=_tr('Enter an Angle Value (degrees):'), min=-359.9999, max=360.0000, decimals=4, init_val=float(self.app.defaults['tools_transform_rotate'])) val_box.setWindowIcon(QtGui.QIcon('share/rotate.png')) @@ -1487,17 +1491,19 @@ class TransformEditorTool(FlatCAMTool): if ok: self.on_rotate(val=val) self.app.inform.emit( - "[success] Geometry shape rotate done...") + _tr("[success] Geometry shape rotate done...") + ) return else: self.app.inform.emit( - "[WARNING_NOTCL] Geometry shape rotate cancelled...") + _tr("[WARNING_NOTCL] Geometry shape rotate cancelled...") + ) def on_offx_key(self): units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().lower() - val_box = FCInputDialog(title="Offset on X axis ...", - text=('Enter a distance Value (%s):' % str(units)), + val_box = FCInputDialog(title=_tr("Offset on X axis ..."), + text=(_tr('Enter a distance Value (%s):') % str(units)), min=-9999.9999, max=10000.0000, decimals=4, init_val=float(self.app.defaults['tools_transform_offset_x'])) val_box.setWindowIcon(QtGui.QIcon('share/offsetx32.png')) @@ -1506,17 +1512,17 @@ class TransformEditorTool(FlatCAMTool): if ok: self.on_offx(val=val) self.app.inform.emit( - "[success] Geometry shape offset on X axis done...") + _tr("[success] Geometry shape offset on X axis done...")) return else: self.app.inform.emit( - "[WARNING_NOTCL] Geometry shape offset X cancelled...") + _tr("[WARNING_NOTCL] Geometry shape offset X cancelled...")) def on_offy_key(self): units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().lower() - val_box = FCInputDialog(title="Offset on Y axis ...", - text=('Enter a distance Value (%s):' % str(units)), + val_box = FCInputDialog(title=_tr("Offset on Y axis ..."), + text=(_tr('Enter a distance Value (%s):') % str(units)), min=-9999.9999, max=10000.0000, decimals=4, init_val=float(self.app.defaults['tools_transform_offset_y'])) val_box.setWindowIcon(QtGui.QIcon('share/offsety32.png')) @@ -1525,15 +1531,15 @@ class TransformEditorTool(FlatCAMTool): if ok: self.on_offx(val=val) self.app.inform.emit( - "[success] Geometry shape offset on Y axis done...") + _tr("[success] Geometry shape offset on Y axis done...")) return else: self.app.inform.emit( - "[WARNING_NOTCL] Geometry shape offset Y cancelled...") + _tr("[WARNING_NOTCL] Geometry shape offset Y cancelled...")) def on_skewx_key(self): - val_box = FCInputDialog(title="Skew on X axis ...", - text='Enter an Angle Value (degrees):', + val_box = FCInputDialog(title=_tr("Skew on X axis ..."), + text=_tr('Enter an Angle Value (degrees):'), min=-359.9999, max=360.0000, decimals=4, init_val=float(self.app.defaults['tools_transform_skew_x'])) val_box.setWindowIcon(QtGui.QIcon('share/skewX.png')) @@ -1542,15 +1548,15 @@ class TransformEditorTool(FlatCAMTool): if ok: self.on_skewx(val=val) self.app.inform.emit( - "[success] Geometry shape skew on X axis done...") + _tr("[success] Geometry shape skew on X axis done...")) return else: self.app.inform.emit( - "[WARNING_NOTCL] Geometry shape skew X cancelled...") + _tr( "[WARNING_NOTCL] Geometry shape skew X cancelled...")) def on_skewy_key(self): - val_box = FCInputDialog(title="Skew on Y axis ...", - text='Enter an Angle Value (degrees):', + val_box = FCInputDialog(title=_tr("Skew on Y axis ..."), + text=_tr('Enter an Angle Value (degrees):'), min=-359.9999, max=360.0000, decimals=4, init_val=float(self.app.defaults['tools_transform_skew_y'])) val_box.setWindowIcon(QtGui.QIcon('share/skewY.png')) @@ -1559,11 +1565,11 @@ class TransformEditorTool(FlatCAMTool): if ok: self.on_skewx(val=val) self.app.inform.emit( - "[success] Geometry shape skew on Y axis done...") + _tr( "[success] Geometry shape skew on Y axis done...")) return else: self.app.inform.emit( - "[WARNING_NOTCL] Geometry shape skew Y cancelled...") + _tr("[WARNING_NOTCL] Geometry shape skew Y cancelled...")) class DrawToolShape(object): @@ -1894,14 +1900,14 @@ class FCCircle(FCShapeTool): DrawTool.__init__(self, draw_app) self.name = 'circle' - self.start_msg = "Click on CENTER ..." + self.start_msg = _tr("Click on CENTER ...") self.steps_per_circ = self.draw_app.app.defaults["geometry_circle_steps"] def click(self, point): self.points.append(point) if len(self.points) == 1: - self.draw_app.app.inform.emit("Click on Circle perimeter point to complete ...") + self.draw_app.app.inform.emit(_tr("Click on Circle perimeter point to complete ...")) return "Click on perimeter to complete ..." if len(self.points) == 2: @@ -1925,7 +1931,7 @@ class FCCircle(FCShapeTool): radius = distance(p1, p2) self.geometry = DrawToolShape(Point(p1).buffer(radius, int(self.steps_per_circ / 4))) self.complete = True - self.draw_app.app.inform.emit("[success]Done. Adding Circle completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Adding Circle completed.")) class FCArc(FCShapeTool): @@ -1933,7 +1939,7 @@ class FCArc(FCShapeTool): DrawTool.__init__(self, draw_app) self.name = 'arc' - self.start_msg = "Click on CENTER ..." + self.start_msg = _tr("Click on CENTER ...") # Direction of rotation between point 1 and 2. # 'cw' or 'ccw'. Switch direction by hitting the @@ -1952,11 +1958,11 @@ class FCArc(FCShapeTool): self.points.append(point) if len(self.points) == 1: - self.draw_app.app.inform.emit("Click on Start arc point ...") + self.draw_app.app.inform.emit(_tr("Click on Start arc point ...")) return "Click on 1st point ..." if len(self.points) == 2: - self.draw_app.app.inform.emit("Click on End arc point to complete ...") + self.draw_app.app.inform.emit(_tr("Click on End arc point to complete ...")) return "Click on 2nd point to complete ..." if len(self.points) == 3: @@ -2111,7 +2117,7 @@ class FCArc(FCShapeTool): self.geometry = DrawToolShape(LineString(arc(center, radius, startangle, stopangle, self.direction, self.steps_per_circ))) self.complete = True - self.draw_app.app.inform.emit("[success]Done. Arc completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Arc completed.")) class FCRectangle(FCShapeTool): @@ -2123,7 +2129,7 @@ class FCRectangle(FCShapeTool): DrawTool.__init__(self, draw_app) self.name = 'rectangle' - self.start_msg = "Click on 1st corner ..." + self.start_msg = _tr("Click on 1st corner ...") def click(self, point): self.points.append(point) @@ -2151,7 +2157,7 @@ class FCRectangle(FCShapeTool): # self.geometry = LinearRing([p1, (p2[0], p1[1]), p2, (p1[0], p2[1])]) self.geometry = DrawToolShape(Polygon([p1, (p2[0], p1[1]), p2, (p1[0], p2[1])])) self.complete = True - self.draw_app.app.inform.emit("[success]Done. Rectangle completed.") + self.draw_app.app.inform.emit("_tr([success]Done. Rectangle completed.") class FCPolygon(FCShapeTool): @@ -2163,14 +2169,14 @@ class FCPolygon(FCShapeTool): DrawTool.__init__(self, draw_app) self.name = 'polygon' - self.start_msg = "Click on 1st point ..." + self.start_msg = _tr("Click on 1st point ...") def click(self, point): self.draw_app.in_action = True self.points.append(point) if len(self.points) > 0: - self.draw_app.app.inform.emit("Click on next Point or click Right mouse button to complete ...") + self.draw_app.app.inform.emit(_tr("Click on next Point or click Right mouse button to complete ...")) return "Click on next point or hit ENTER to complete ..." return "" @@ -2193,7 +2199,7 @@ class FCPolygon(FCShapeTool): self.geometry = DrawToolShape(Polygon(self.points)) self.draw_app.in_action = False self.complete = True - self.draw_app.app.inform.emit("[success]Done. Polygon completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Polygon completed.")) def on_key(self, key): if key == 'backspace': @@ -2212,7 +2218,7 @@ class FCPath(FCPolygon): self.draw_app.in_action = False self.complete = True - self.draw_app.app.inform.emit("[success]Done. Path completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Path completed.")) def utility_geometry(self, data=None): if len(self.points) > 0: @@ -2472,14 +2478,14 @@ class FCMove(FCShapeTool): # self.shape_buffer = self.draw_app.shape_buffer if not self.draw_app.selected: - self.draw_app.app.inform.emit("[WARNING_NOTCL] Move cancelled. No shape selected.") + self.draw_app.app.inform.emit(_tr("[WARNING_NOTCL] Move cancelled. No shape selected.")) return self.origin = None self.destination = None - self.start_msg = "Click on reference point." + self.start_msg = _tr("Click on reference point.") def set_origin(self, origin): - self.draw_app.app.inform.emit("Click on destination point.") + self.draw_app.app.inform.emit(_tr("Click on destination point.")) self.origin = origin def click(self, point): @@ -2510,7 +2516,7 @@ class FCMove(FCShapeTool): # self.draw_app.set_selected(g) self.complete = True - self.draw_app.app.inform.emit("[success]Done. Geometry(s) Move completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Geometry(s) Move completed.")) def utility_geometry(self, data=None): """ @@ -2555,7 +2561,7 @@ class FCCopy(FCMove): self.geometry = [DrawToolShape(affinity.translate(geom.geo, xoff=dx, yoff=dy)) for geom in self.draw_app.get_selected()] self.complete = True - self.draw_app.app.inform.emit("[success]Done. Geometry(s) Copy completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Geometry(s) Copy completed.")) class FCText(FCShapeTool): @@ -2567,7 +2573,7 @@ class FCText(FCShapeTool): self.draw_app = draw_app self.app = draw_app.app - self.start_msg = "Click on the Destination point..." + self.start_msg = _tr("Click on the Destination point...") self.origin = (0, 0) self.text_gui = TextInputTool(self.app) @@ -2581,8 +2587,8 @@ class FCText(FCShapeTool): self.geometry = DrawToolShape(affinity.translate(self.text_gui.text_path, xoff=dx, yoff=dy)) except Exception as e: log.debug("Font geometry is empty or incorrect: %s" % str(e)) - self.draw_app.app.inform.emit("[ERROR]Font not supported. Only Regular, Bold, Italic and BoldItalic are " - "supported. Error: %s" % str(e)) + self.draw_app.app.inform.emit(_tr("[ERROR]Font not supported. Only Regular, Bold, Italic and BoldItalic are " + "supported. Error: %s") % str(e)) self.text_gui.text_path = [] self.text_gui.hide_tool() self.draw_app.select_tool('select') @@ -2591,7 +2597,7 @@ class FCText(FCShapeTool): self.text_gui.text_path = [] self.text_gui.hide_tool() self.complete = True - self.draw_app.app.inform.emit("[success]Done. Adding Text completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Adding Text completed.")) def utility_geometry(self, data=None): """ @@ -2619,18 +2625,18 @@ class FCBuffer(FCShapeTool): self.draw_app = draw_app self.app = draw_app.app - self.start_msg = "Create buffer geometry ..." + self.start_msg = _tr("Create buffer geometry ...") self.origin = (0, 0) self.buff_tool = BufferSelectionTool(self.app, self.draw_app) self.buff_tool.run() - self.app.ui.notebook.setTabText(2, "Buffer Tool") + self.app.ui.notebook.setTabText(2, _tr("Buffer Tool")) if self.draw_app.app.ui.splitter.sizes()[0] == 0: self.draw_app.app.ui.splitter.setSizes([1, 1]) self.activate() def on_buffer(self): if not self.draw_app.selected: - self.app.inform.emit("[WARNING_NOTCL] Buffer cancelled. No shape selected.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Buffer cancelled. No shape selected.")) return try: @@ -2641,22 +2647,22 @@ class FCBuffer(FCShapeTool): buffer_distance = float(self.buff_tool.buffer_distance_entry.get_value().replace(',', '.')) self.buff_tool.buffer_distance_entry.set_value(buffer_distance) except ValueError: - self.app.inform.emit("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " - "Add it and retry.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " + "Add it and retry.")) return # the cb index start from 0 but the join styles for the buffer start from 1 therefore the adjustment # I populated the combobox such that the index coincide with the join styles value (whcih is really an INT) join_style = self.buff_tool.buffer_corner_cb.currentIndex() + 1 self.draw_app.buffer(buffer_distance, join_style) - self.app.ui.notebook.setTabText(2, "Tools") + self.app.ui.notebook.setTabText(2, _tr("Tools")) self.draw_app.app.ui.splitter.setSizes([0, 1]) self.disactivate() - self.draw_app.app.inform.emit("[success]Done. Buffer Tool completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Buffer Tool completed.")) def on_buffer_int(self): if not self.draw_app.selected: - self.app.inform.emit("[WARNING_NOTCL] Buffer cancelled. No shape selected.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Buffer cancelled. No shape selected.")) return try: @@ -2667,22 +2673,22 @@ class FCBuffer(FCShapeTool): buffer_distance = float(self.buff_tool.buffer_distance_entry.get_value().replace(',', '.')) self.buff_tool.buffer_distance_entry.set_value(buffer_distance) except ValueError: - self.app.inform.emit("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " - "Add it and retry.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " + "Add it and retry.")) return # the cb index start from 0 but the join styles for the buffer start from 1 therefore the adjustment # I populated the combobox such that the index coincide with the join styles value (whcih is really an INT) join_style = self.buff_tool.buffer_corner_cb.currentIndex() + 1 self.draw_app.buffer_int(buffer_distance, join_style) - self.app.ui.notebook.setTabText(2, "Tools") + self.app.ui.notebook.setTabText(2, _tr("Tools")) self.draw_app.app.ui.splitter.setSizes([0, 1]) self.disactivate() - self.draw_app.app.inform.emit("[success]Done. Buffer Int Tool completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Buffer Int Tool completed.")) def on_buffer_ext(self): if not self.draw_app.selected: - self.app.inform.emit("[WARNING_NOTCL] Buffer cancelled. No shape selected.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Buffer cancelled. No shape selected.")) return try: @@ -2693,18 +2699,18 @@ class FCBuffer(FCShapeTool): buffer_distance = float(self.buff_tool.buffer_distance_entry.get_value().replace(',', '.')) self.buff_tool.buffer_distance_entry.set_value(buffer_distance) except ValueError: - self.app.inform.emit("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " - "Add it and retry.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Buffer distance value is missing or wrong format. " + "Add it and retry.")) return # the cb index start from 0 but the join styles for the buffer start from 1 therefore the adjustment # I populated the combobox such that the index coincide with the join styles value (whcih is really an INT) join_style = self.buff_tool.buffer_corner_cb.currentIndex() + 1 self.draw_app.buffer_ext(buffer_distance, join_style) - self.app.ui.notebook.setTabText(2, "Tools") + self.app.ui.notebook.setTabText(2, _tr("Tools")) self.draw_app.app.ui.splitter.setSizes([0, 1]) self.disactivate() - self.draw_app.app.inform.emit("[success]Done. Buffer Ext Tool completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Buffer Ext Tool completed.")) def activate(self): self.buff_tool.buffer_button.clicked.disconnect() @@ -2737,7 +2743,7 @@ class FCPaint(FCShapeTool): self.draw_app = draw_app self.app = draw_app.app - self.start_msg = "Create Paint geometry ..." + self.start_msg = _tr("Create Paint geometry ...") self.origin = (0, 0) self.draw_app.paint_tool.run() @@ -2751,7 +2757,7 @@ class FCTransform(FCShapeTool): self.draw_app = draw_app self.app = draw_app.app - self.start_msg = "Shape transformations ..." + self.start_msg = _tr("Shape transformations ...") self.origin = (0, 0) self.draw_app.transform_tool.run() @@ -2776,7 +2782,7 @@ class FCDrillAdd(FCShapeTool): self.draw_app.tools_table_exc.setCurrentItem(item) except KeyError: - self.draw_app.app.inform.emit("[WARNING_NOTCL] To add a drill first select a tool") + self.draw_app.app.inform.emit(_tr("[WARNING_NOTCL] To add a drill first select a tool")) self.draw_app.select_tool("select") return @@ -2785,7 +2791,7 @@ class FCDrillAdd(FCShapeTool): if isinstance(geo, DrawToolShape) and geo.geo is not None: self.draw_app.draw_utility_geometry(geo=geo) - self.draw_app.app.inform.emit("Click on target location ...") + self.draw_app.app.inform.emit(_tr("Click on target location ...")) # Switch notebook to Selected page self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab) @@ -2825,7 +2831,7 @@ class FCDrillAdd(FCShapeTool): self.draw_app.current_storage = self.draw_app.storage_dict[self.selected_dia] self.geometry = DrawToolShape(self.util_shape(self.points)) self.complete = True - self.draw_app.app.inform.emit("[success]Done. Drill added.") + self.draw_app.app.inform.emit(_tr("[success]Done. Drill added.")) class FCDrillArray(FCShapeTool): @@ -2867,7 +2873,7 @@ class FCDrillArray(FCShapeTool): item = self.draw_app.tools_table_exc.item((self.draw_app.last_tool_selected - 1), 1) self.draw_app.tools_table_exc.setCurrentItem(item) except KeyError: - self.draw_app.app.inform.emit("[WARNING_NOTCL] To add an Drill Array first select a tool in Tool Table") + self.draw_app.app.inform.emit(_tr("[WARNING_NOTCL] To add an Drill Array first select a tool in Tool Table")) return geo = self.utility_geometry(data=(self.draw_app.snap_x, self.draw_app.snap_y), static=True) @@ -2875,7 +2881,7 @@ class FCDrillArray(FCShapeTool): if isinstance(geo, DrawToolShape) and geo.geo is not None: self.draw_app.draw_utility_geometry(geo=geo) - self.draw_app.app.inform.emit("Click on target location ...") + self.draw_app.app.inform.emit(_tr("Click on target location ...")) # Switch notebook to Selected page self.draw_app.app.ui.notebook.setCurrentWidget(self.draw_app.app.ui.selected_tab) @@ -2892,7 +2898,7 @@ class FCDrillArray(FCShapeTool): self.flag_for_circ_array = True self.set_origin(point) - self.draw_app.app.inform.emit("Click on the Drill Circular Array Start position") + self.draw_app.app.inform.emit(_tr("Click on the Drill Circular Array Start position")) else: self.destination = point self.make() @@ -2914,10 +2920,10 @@ class FCDrillArray(FCShapeTool): self.drill_angle = float(self.draw_app.drill_angle_entry.get_value()) except TypeError: self.draw_app.app.inform.emit( - "[ERROR_NOTCL] The value is not Float. Check for comma instead of dot separator.") + _tr("[ERROR_NOTCL] The value is not Float. Check for comma instead of dot separator.")) return except Exception as e: - self.draw_app.app.inform.emit("[ERROR_NOTCL] The value is mistyped. Check the value.") + self.draw_app.app.inform.emit(_tr("[ERROR_NOTCL] The value is mistyped. Check the value.")) return if self.drill_array == 'Linear': @@ -3010,7 +3016,7 @@ class FCDrillArray(FCShapeTool): self.geometry.append(DrawToolShape(geo)) else: if (self.drill_angle * self.drill_array_size) > 360: - self.draw_app.app.inform.emit("[WARNING_NOTCL]Too many drills for the selected spacing angle.") + self.draw_app.app.inform.emit(_tr("[WARNING_NOTCL]Too many drills for the selected spacing angle.")) return radius = distance(self.destination, self.origin) @@ -3027,7 +3033,7 @@ class FCDrillArray(FCShapeTool): geo = self.util_shape((x, y)) self.geometry.append(DrawToolShape(geo)) self.complete = True - self.draw_app.app.inform.emit("[success]Done. Drill Array added.") + self.draw_app.app.inform.emit(_tr("[success]Done. Drill Array added.")) self.draw_app.in_action = True self.draw_app.array_frame.hide() return @@ -3038,7 +3044,7 @@ class FCDrillResize(FCShapeTool): DrawTool.__init__(self, draw_app) self.name = 'drill_resize' - self.draw_app.app.inform.emit("Click on the Drill(s) to resize ...") + self.draw_app.app.inform.emit(_tr("Click on the Drill(s) to resize ...")) self.resize_dia = None self.draw_app.resize_frame.show() self.points = None @@ -3058,7 +3064,7 @@ class FCDrillResize(FCShapeTool): try: new_dia = self.draw_app.resdrill_entry.get_value() except: - self.draw_app.app.inform.emit("[ERROR_NOTCL]Resize drill(s) failed. Please enter a diameter for resize.") + self.draw_app.app.inform.emit(_tr("[ERROR_NOTCL]Resize drill(s) failed. Please enter a diameter for resize.")) return if new_dia not in self.draw_app.olddia_newdia: @@ -3130,7 +3136,7 @@ class FCDrillResize(FCShapeTool): self.draw_app.resize_frame.hide() self.complete = True - self.draw_app.app.inform.emit("[success]Done. Drill Resize completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Drill Resize completed.")) # MS: always return to the Select Tool self.draw_app.select_tool("select") @@ -3148,9 +3154,9 @@ class FCDrillMove(FCShapeTool): if self.draw_app.launched_from_shortcuts is True: self.draw_app.launched_from_shortcuts = False - self.draw_app.app.inform.emit("Click on target location ...") + self.draw_app.app.inform.emit(_tr("Click on target location ...")) else: - self.draw_app.app.inform.emit("Click on reference location ...") + self.draw_app.app.inform.emit(_tr("Click on reference location ...")) self.current_storage = None self.geometry = [] @@ -3173,7 +3179,7 @@ class FCDrillMove(FCShapeTool): if self.origin is None: self.set_origin(point) - self.draw_app.app.inform.emit("Click on target location ...") + self.draw_app.app.inform.emit(_tr("Click on target location ...")) return else: self.destination = point @@ -3205,7 +3211,7 @@ class FCDrillMove(FCShapeTool): sel_shapes_to_be_deleted = [] self.draw_app.build_ui() - self.draw_app.app.inform.emit("[success]Done. Drill(s) Move completed.") + self.draw_app.app.inform.emit(_tr("[success]Done. Drill(s) Move completed.")) def utility_geometry(self, data=None): """ @@ -3258,7 +3264,7 @@ class FCDrillCopy(FCDrillMove): sel_shapes_to_be_deleted = [] self.draw_app.build_ui() - self.draw_app.app.inform.emit("[success]Done. Drill(s) copied.") + self.draw_app.app.inform.emit(_tr("[success]Done. Drill(s) copied.")) ######################## @@ -3908,7 +3914,7 @@ class FlatCAMGeoEditor(QtCore.QObject): self.active_tool.make() if self.active_tool.complete: self.on_shape_complete() - self.app.inform.emit("[success]Done.") + self.app.inform.emit(_tr("[success]Done.")) # MS: always return to the Select Tool if modifier key is not pressed # else return to the current tool @@ -4034,21 +4040,21 @@ class FlatCAMGeoEditor(QtCore.QObject): def on_move_click(self): if not self.selected: - self.app.inform.emit("[WARNING_NOTCL] Move cancelled. No shape selected.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Move cancelled. No shape selected.")) return self.on_move() self.active_tool.set_origin(self.snap(self.x, self.y)) def on_copy_click(self): if not self.selected: - self.app.inform.emit("[WARNING_NOTCL] Copy cancelled. No shape selected.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Copy cancelled. No shape selected.")) return self.app.ui.geo_copy_btn.setChecked(True) self.app.geo_editor.on_tool_select('copy') self.app.geo_editor.active_tool.set_origin(self.app.geo_editor.snap( self.app.geo_editor.x, self.app.geo_editor.y)) - self.app.inform.emit("Click on target point.") + self.app.inform.emit(_tr("Click on target point.")) def on_corner_snap(self): self.app.ui.corner_snap_btn.trigger() @@ -4289,7 +4295,7 @@ class FlatCAMGeoEditor(QtCore.QObject): results = shapes[0].geo except Exception as e: log.debug("FlatCAMGeoEditor.intersection() --> %s" % str(e)) - self.app.inform.emit("[WARNING_NOTCL]A selection of at least 2 geo items is required to do Intersection.") + self.app.inform.emit(_tr("[WARNING_NOTCL]A selection of at least 2 geo items is required to do Intersection.")) self.select_tool('select') return @@ -4327,7 +4333,7 @@ class FlatCAMGeoEditor(QtCore.QObject): if buf_distance < 0: self.app.inform.emit( - "[ERROR_NOTCL]Negative buffer value is not accepted. Use Buffer interior to generate an 'inside' shape") + _tr( "[ERROR_NOTCL]Negative buffer value is not accepted. Use Buffer interior to generate an 'inside' shape")) # deselect everything self.selected = [] @@ -4335,11 +4341,11 @@ class FlatCAMGeoEditor(QtCore.QObject): return if len(selected) == 0: - self.app.inform.emit("[WARNING_NOTCL] Nothing selected for buffering.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Nothing selected for buffering.")) return if not isinstance(buf_distance, float): - self.app.inform.emit("[WARNING_NOTCL] Invalid distance for buffering.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Invalid distance for buffering.")) # deselect everything self.selected = [] @@ -4349,7 +4355,7 @@ class FlatCAMGeoEditor(QtCore.QObject): pre_buffer = cascaded_union([t.geo for t in selected]) results = pre_buffer.buffer(buf_distance - 1e-10, resolution=32, join_style=join_style) if results.is_empty: - self.app.inform.emit("[ERROR_NOTCL]Failed, the result is empty. Choose a different buffer value.") + self.app.inform.emit(_tr("[ERROR_NOTCL]Failed, the result is empty. Choose a different buffer value.")) # deselect everything self.selected = [] self.replot() @@ -4357,25 +4363,27 @@ class FlatCAMGeoEditor(QtCore.QObject): self.add_shape(DrawToolShape(results)) self.replot() - self.app.inform.emit("[success]Full buffer geometry created.") + self.app.inform.emit(_tr("[success]Full buffer geometry created.")) def buffer_int(self, buf_distance, join_style): selected = self.get_selected() if buf_distance < 0: self.app.inform.emit( - "[ERROR_NOTCL]Negative buffer value is not accepted. Use Buffer interior to generate an 'inside' shape") + _tr("[ERROR_NOTCL]Negative buffer value is not accepted. " + "Use Buffer interior to generate an 'inside' shape") + ) # deselect everything self.selected = [] self.replot() return if len(selected) == 0: - self.app.inform.emit("[WARNING_NOTCL] Nothing selected for buffering.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Nothing selected for buffering.")) return if not isinstance(buf_distance, float): - self.app.inform.emit("[WARNING_NOTCL] Invalid distance for buffering.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Invalid distance for buffering.")) # deselect everything self.selected = [] self.replot() @@ -4384,7 +4392,7 @@ class FlatCAMGeoEditor(QtCore.QObject): pre_buffer = cascaded_union([t.geo for t in selected]) results = pre_buffer.buffer(-buf_distance + 1e-10, resolution=32, join_style=join_style) if results.is_empty: - self.app.inform.emit("[ERROR_NOTCL]Failed, the result is empty. Choose a smaller buffer value.") + self.app.inform.emit(_tr("[ERROR_NOTCL]Failed, the result is empty. Choose a smaller buffer value.")) # deselect everything self.selected = [] self.replot() @@ -4396,7 +4404,7 @@ class FlatCAMGeoEditor(QtCore.QObject): self.add_shape(DrawToolShape(results.exterior)) self.replot() - self.app.inform.emit("[success]Exterior buffer geometry created.") + self.app.inform.emit(_tr("[success]Exterior buffer geometry created.")) # selected = self.get_selected() # # if len(selected) == 0: @@ -4434,19 +4442,19 @@ class FlatCAMGeoEditor(QtCore.QObject): selected = self.get_selected() if buf_distance < 0: - self.app.inform.emit("[ERROR_NOTCL]Negative buffer value is not accepted. " - "Use Buffer interior to generate an 'inside' shape") + self.app.inform.emit(_tr("[ERROR_NOTCL]Negative buffer value is not accepted. " + "Use Buffer interior to generate an 'inside' shape")) # deselect everything self.selected = [] self.replot() return if len(selected) == 0: - self.app.inform.emit("[WARNING_NOTCL] Nothing selected for buffering.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Nothing selected for buffering.")) return if not isinstance(buf_distance, float): - self.app.inform.emit("[WARNING_NOTCL] Invalid distance for buffering.") + self.app.inform.emit(_tr("[WARNING_NOTCL] Invalid distance for buffering.")) # deselect everything self.selected = [] self.replot() @@ -4455,7 +4463,7 @@ class FlatCAMGeoEditor(QtCore.QObject): pre_buffer = cascaded_union([t.geo for t in selected]) results = pre_buffer.buffer(buf_distance - 1e-10, resolution=32, join_style=join_style) if results.is_empty: - self.app.inform.emit("[ERROR_NOTCL]Failed, the result is empty. Choose a different buffer value.") + self.app.inform.emit(_tr("[ERROR_NOTCL]Failed, the result is empty. Choose a different buffer value.")) # deselect everything self.selected = [] self.replot() @@ -4467,7 +4475,7 @@ class FlatCAMGeoEditor(QtCore.QObject): self.add_shape(DrawToolShape(results.exterior)) self.replot() - self.app.inform.emit("[success]Exterior buffer geometry created.") + self.app.inform.emit(_tr("[success]Exterior buffer geometry created.")) # def paint(self, tooldia, overlap, margin, method): # selected = self.get_selected() @@ -4531,19 +4539,19 @@ class FlatCAMGeoEditor(QtCore.QObject): selected = self.get_selected() if len(selected) == 0: - self.app.inform.emit("[WARNING_NOTCL]Nothing selected for painting.") + self.app.inform.emit(_tr("[WARNING_NOTCL]Nothing selected for painting.")) return for param in [tooldia, overlap, margin]: if not isinstance(param, float): param_name = [k for k, v in locals().items() if v is param][0] - self.app.inform.emit("[WARNING] Invalid value for {}".format(param)) + self.app.inform.emit(_tr("[WARNING] Invalid value for {}").format(param)) results = [] if overlap >= 1: self.app.inform.emit( - "[ERROR_NOTCL] Could not do Paint. Overlap value has to be less than 1.00 (100%).") + _tr("[ERROR_NOTCL] Could not do Paint. Overlap value has to be less than 1.00 (100%).")) return def recurse(geometry, reset=True): @@ -4602,8 +4610,8 @@ class FlatCAMGeoEditor(QtCore.QObject): except Exception as e: log.debug("Could not Paint the polygons. %s" % str(e)) self.app.inform.emit( - "[ERROR] Could not do Paint. Try a different combination of parameters. " - "Or a different method of Paint\n%s" % str(e)) + _tr("[ERROR] Could not do Paint. Try a different combination of parameters. " + "Or a different method of Paint\n%s") % str(e)) return # add the result to the results list @@ -4613,7 +4621,7 @@ class FlatCAMGeoEditor(QtCore.QObject): for r in results: self.add_shape(DrawToolShape(r)) self.app.inform.emit( - "[success] Paint done.") + _tr("[success] Paint done.")) self.replot() @@ -4645,14 +4653,14 @@ class FlatCAMExcEditor(QtCore.QObject): self.title_box.addWidget(self.icon, stretch=0) ## Title label - self.title_label = QtWidgets.QLabel("" + 'Excellon Editor' + "") + self.title_label = QtWidgets.QLabel("%s" % _tr('Excellon Editor')) self.title_label.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.title_box.addWidget(self.title_label, stretch=1) ## Object name self.name_box = QtWidgets.QHBoxLayout() layout.addLayout(self.name_box) - name_label = QtWidgets.QLabel("Name:") + name_label = QtWidgets.QLabel(_tr("Name:")) self.name_box.addWidget(name_label) self.name_entry = FCEntry() self.name_box.addWidget(self.name_entry) @@ -4672,10 +4680,10 @@ class FlatCAMExcEditor(QtCore.QObject): self.drills_frame.setLayout(self.tools_box) #### Tools Drills #### - self.tools_table_label = QtWidgets.QLabel('Tools Table') + self.tools_table_label = QtWidgets.QLabel("%s" % _tr('Tools Table')) self.tools_table_label.setToolTip( - "Tools in this Excellon object\n" - "when are used for drilling." + _tr( "Tools in this Excellon object\n" + "when are used for drilling.") ) self.tools_box.addWidget(self.tools_table_label) @@ -4683,7 +4691,7 @@ class FlatCAMExcEditor(QtCore.QObject): self.tools_box.addWidget(self.tools_table_exc) self.tools_table_exc.setColumnCount(4) - self.tools_table_exc.setHorizontalHeaderLabels(['#', 'Diameter', 'D', 'S']) + self.tools_table_exc.setHorizontalHeaderLabels(['#', _tr('Diameter'), 'D', 'S']) self.tools_table_exc.setSortingEnabled(False) self.tools_table_exc.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) @@ -4691,19 +4699,19 @@ class FlatCAMExcEditor(QtCore.QObject): self.tools_box.addWidget(self.empty_label) #### Add a new Tool #### - self.addtool_label = QtWidgets.QLabel('Add/Delete Tool') + self.addtool_label = QtWidgets.QLabel('%s' % _tr('Add/Delete Tool')) self.addtool_label.setToolTip( - "Add/Delete a tool to the tool list\n" - "for this Excellon object." + _tr("Add/Delete a tool to the tool list\n" + "for this Excellon object.") ) self.tools_box.addWidget(self.addtool_label) grid1 = QtWidgets.QGridLayout() self.tools_box.addLayout(grid1) - addtool_entry_lbl = QtWidgets.QLabel('Tool Dia:') + addtool_entry_lbl = QtWidgets.QLabel(_tr('Tool Dia:')) addtool_entry_lbl.setToolTip( - "Diameter for the new tool" + _tr("Diameter for the new tool") ) grid1.addWidget(addtool_entry_lbl, 0, 0) @@ -4712,10 +4720,10 @@ class FlatCAMExcEditor(QtCore.QObject): self.addtool_entry.setValidator(QtGui.QDoubleValidator(0.0001, 99.9999, 4)) hlay.addWidget(self.addtool_entry) - self.addtool_btn = QtWidgets.QPushButton('Add Tool') + self.addtool_btn = QtWidgets.QPushButton(_tr('Add Tool')) self.addtool_btn.setToolTip( - "Add a new tool to the tool list\n" - "with the diameter specified above." + _tr( "Add a new tool to the tool list\n" + "with the diameter specified above.") ) self.addtool_btn.setFixedWidth(80) hlay.addWidget(self.addtool_btn) @@ -4724,10 +4732,10 @@ class FlatCAMExcEditor(QtCore.QObject): grid2 = QtWidgets.QGridLayout() self.tools_box.addLayout(grid2) - self.deltool_btn = QtWidgets.QPushButton('Delete Tool') + self.deltool_btn = QtWidgets.QPushButton(_tr('Delete Tool')) self.deltool_btn.setToolTip( - "Delete a tool in the tool list\n" - "by selecting a row in the tool table." + _tr( "Delete a tool in the tool list\n" + "by selecting a row in the tool table.") ) grid2.addWidget(self.deltool_btn, 0, 1) @@ -4744,18 +4752,18 @@ class FlatCAMExcEditor(QtCore.QObject): self.emptyresize_label = QtWidgets.QLabel('') self.resize_box.addWidget(self.emptyresize_label) - self.drillresize_label = QtWidgets.QLabel('Resize Drill(s)') + self.drillresize_label = QtWidgets.QLabel('%s' % _tr("Resize Drill(s)")) self.drillresize_label.setToolTip( - "Resize a drill or a selection of drills." + _tr("Resize a drill or a selection of drills.") ) self.resize_box.addWidget(self.drillresize_label) grid3 = QtWidgets.QGridLayout() self.resize_box.addLayout(grid3) - res_entry_lbl = QtWidgets.QLabel('Resize Dia:') + res_entry_lbl = QtWidgets.QLabel(_tr('Resize Dia:')) res_entry_lbl.setToolTip( - "Diameter to resize to." + _tr( "Diameter to resize to.") ) grid3.addWidget(addtool_entry_lbl, 0, 0) @@ -4763,9 +4771,9 @@ class FlatCAMExcEditor(QtCore.QObject): self.resdrill_entry = LengthEntry() hlay2.addWidget(self.resdrill_entry) - self.resize_btn = QtWidgets.QPushButton('Resize') + self.resize_btn = QtWidgets.QPushButton(_tr('Resize')) self.resize_btn.setToolTip( - "Resize drill(s)" + _tr("Resize drill(s)") ) self.resize_btn.setFixedWidth(80) hlay2.addWidget(self.resize_btn) @@ -4787,28 +4795,28 @@ class FlatCAMExcEditor(QtCore.QObject): self.emptyarray_label = QtWidgets.QLabel('') self.array_box.addWidget(self.emptyarray_label) - self.drillarray_label = QtWidgets.QLabel('Add Drill Array') + self.drillarray_label = QtWidgets.QLabel('%s' % _tr("Add Drill Array")) self.drillarray_label.setToolTip( - "Add an array of drills (linear or circular array)" + _tr("Add an array of drills (linear or circular array)") ) self.array_box.addWidget(self.drillarray_label) self.array_type_combo = FCComboBox() self.array_type_combo.setToolTip( - "Select the type of drills array to create.\n" - "It can be Linear X(Y) or Circular" + _tr( "Select the type of drills array to create.\n" + "It can be Linear X(Y) or Circular") ) - self.array_type_combo.addItem("Linear") - self.array_type_combo.addItem("Circular") + self.array_type_combo.addItem(_tr("Linear")) + self.array_type_combo.addItem(_tr("Circular")) self.array_box.addWidget(self.array_type_combo) self.array_form = QtWidgets.QFormLayout() self.array_box.addLayout(self.array_form) - self.drill_array_size_label = QtWidgets.QLabel('Nr of drills:') + self.drill_array_size_label = QtWidgets.QLabel(_tr('Nr of drills:')) self.drill_array_size_label.setToolTip( - "Specify how many drills to be in the array." + _tr("Specify how many drills to be in the array.") ) self.drill_array_size_label.setFixedWidth(100) @@ -4825,36 +4833,36 @@ class FlatCAMExcEditor(QtCore.QObject): self.linear_form = QtWidgets.QFormLayout() self.linear_box.addLayout(self.linear_form) - self.drill_axis_label = QtWidgets.QLabel('Direction:') + self.drill_axis_label = QtWidgets.QLabel(_tr('Direction:')) self.drill_axis_label.setToolTip( - "Direction on which the linear array is oriented:\n" + _tr("Direction on which the linear array is oriented:\n" "- 'X' - horizontal axis \n" "- 'Y' - vertical axis or \n" - "- 'Angle' - a custom angle for the array inclination" + "- 'Angle' - a custom angle for the array inclination") ) self.drill_axis_label.setFixedWidth(100) self.drill_axis_radio = RadioSet([{'label': 'X', 'value': 'X'}, {'label': 'Y', 'value': 'Y'}, - {'label': 'Angle', 'value': 'A'}]) + {'label': _tr('Angle'), 'value': 'A'}]) self.drill_axis_radio.set_value('X') self.linear_form.addRow(self.drill_axis_label, self.drill_axis_radio) - self.drill_pitch_label = QtWidgets.QLabel('Pitch:') + self.drill_pitch_label = QtWidgets.QLabel(_tr('Pitch:')) self.drill_pitch_label.setToolTip( - "Pitch = Distance between elements of the array." + _tr("Pitch = Distance between elements of the array.") ) self.drill_pitch_label.setFixedWidth(100) self.drill_pitch_entry = LengthEntry() self.linear_form.addRow(self.drill_pitch_label, self.drill_pitch_entry) - self.linear_angle_label = QtWidgets.QLabel('Angle:') + self.linear_angle_label = QtWidgets.QLabel(_tr('Angle:')) self.linear_angle_label.setToolTip( - "Angle at which the linear array is placed.\n" + _tr( "Angle at which the linear array is placed.\n" "The precision is of max 2 decimals.\n" "Min value is: -359.99 degrees.\n" - "Max value is: 360.00 degrees." + "Max value is: 360.00 degrees.") ) self.linear_angle_label.setFixedWidth(100) @@ -4870,10 +4878,10 @@ class FlatCAMExcEditor(QtCore.QObject): self.circular_box.setContentsMargins(0, 0, 0, 0) self.array_circular_frame.setLayout(self.circular_box) - self.drill_direction_label = QtWidgets.QLabel('Direction:') + self.drill_direction_label = QtWidgets.QLabel(_tr('Direction:')) self.drill_direction_label.setToolTip( - "Direction for circular array." - "Can be CW = clockwise or CCW = counter clockwise." + _tr( "Direction for circular array." + "Can be CW = clockwise or CCW = counter clockwise.") ) self.drill_direction_label.setFixedWidth(100) @@ -4885,9 +4893,9 @@ class FlatCAMExcEditor(QtCore.QObject): self.drill_direction_radio.set_value('CW') self.circular_form.addRow(self.drill_direction_label, self.drill_direction_radio) - self.drill_angle_label = QtWidgets.QLabel('Angle:') + self.drill_angle_label = QtWidgets.QLabel(_tr('Angle:')) self.drill_angle_label.setToolTip( - "Angle at which each element in circular array is placed." + _tr("Angle at which each element in circular array is placed.") ) self.drill_angle_label.setFixedWidth(100) @@ -5208,7 +5216,7 @@ class FlatCAMExcEditor(QtCore.QObject): empty_b = QtWidgets.QTableWidgetItem('') empty_b.setFlags(empty_b.flags() ^ QtCore.Qt.ItemIsEnabled) - label_tot_drill_count = QtWidgets.QTableWidgetItem('Total Drills') + label_tot_drill_count = QtWidgets.QTableWidgetItem(_tr('Total Drills')) tot_drill_count = QtWidgets.QTableWidgetItem('%d' % self.tot_drill_cnt) label_tot_drill_count.setFlags(label_tot_drill_count.flags() ^ QtCore.Qt.ItemIsEnabled) @@ -5240,7 +5248,7 @@ class FlatCAMExcEditor(QtCore.QObject): empty_3 = QtWidgets.QTableWidgetItem('') empty_3.setFlags(empty_3.flags() ^ QtCore.Qt.ItemIsEnabled) - label_tot_slot_count = QtWidgets.QTableWidgetItem('Total Slots') + label_tot_slot_count = QtWidgets.QTableWidgetItem(_tr('Total Slots')) tot_slot_count = QtWidgets.QTableWidgetItem('%d' % self.tot_slot_cnt) label_tot_slot_count.setFlags(label_tot_slot_count.flags() ^ QtCore.Qt.ItemIsEnabled) tot_slot_count.setFlags(tot_slot_count.flags() ^ QtCore.Qt.ItemIsEnabled) @@ -5314,8 +5322,9 @@ class FlatCAMExcEditor(QtCore.QObject): try: tool_dia = float(self.addtool_entry.get_value().replace(',', '.')) except ValueError: - self.app.inform.emit("[ERROR_NOTCL]Wrong value format entered, " + self.app.inform.emit(_tr("[ERROR_NOTCL]Wrong value format entered, " "use a number.") + ) return if tool_dia not in self.olddia_newdia: @@ -5326,15 +5335,16 @@ class FlatCAMExcEditor(QtCore.QObject): # each time a tool diameter is edited or added self.olddia_newdia[tool_dia] = tool_dia else: - self.app.inform.emit("[WARNING_NOTCL]Tool already in the original or actual tool list.\n" + self.app.inform.emit(_tr("[WARNING_NOTCL]Tool already in the original or actual tool list.\n" "Save and reedit Excellon if you need to add this tool. ") + ) return # since we add a new tool, we update also the initial state of the tool_table through it's dictionary # we add a new entry in the tool2tooldia dict self.tool2tooldia[len(self.olddia_newdia)] = tool_dia - self.app.inform.emit("[success]Added new tool with dia: %s %s" % (str(tool_dia), str(self.units))) + self.app.inform.emit(_tr("[success]Added new tool with dia: %s %s") % (str(tool_dia), str(self.units))) self.build_ui() @@ -5365,7 +5375,7 @@ class FlatCAMExcEditor(QtCore.QObject): else: deleted_tool_dia_list.append(float('%.4f' % dia)) except: - self.app.inform.emit("[WARNING_NOTCL]Select a tool in Tool Table") + self.app.inform.emit(_tr("[WARNING_NOTCL]Select a tool in Tool Table")) return for deleted_tool_dia in deleted_tool_dia_list: @@ -5398,7 +5408,7 @@ class FlatCAMExcEditor(QtCore.QObject): self.olddia_newdia.pop(deleted_tool_dia, None) - self.app.inform.emit("[success]Deleted tool with dia: %s %s" % (str(deleted_tool_dia), str(self.units))) + self.app.inform.emit(_tr("[success]Deleted tool with dia: %s %s") % (str(deleted_tool_dia), str(self.units))) self.replot() # self.app.inform.emit("Could not delete selected tool") @@ -5741,7 +5751,7 @@ class FlatCAMExcEditor(QtCore.QObject): # reset the tool table self.tools_table_exc.clear() - self.tools_table_exc.setHorizontalHeaderLabels(['#', 'Diameter', 'D', 'S']) + self.tools_table_exc.setHorizontalHeaderLabels(['#', _tr('Diameter'), 'D', 'S']) self.last_tool_selected = None # delete the edited Excellon object which will be replaced by a new one having the edited content of the first @@ -5795,15 +5805,16 @@ class FlatCAMExcEditor(QtCore.QObject): excellon_obj.create_geometry() except KeyError: self.app.inform.emit( - "[ERROR_NOTCL] There are no Tools definitions in the file. Aborting Excellon creation.") + _tr( "[ERROR_NOTCL] There are no Tools definitions in the file. Aborting Excellon creation.") + ) except: - msg = "[ERROR] An internal error has ocurred. See shell.\n" + msg = _tr("[ERROR] An internal error has ocurred. See shell.\n") msg += traceback.format_exc() app_obj.inform.emit(msg) raise # raise - with self.app.proc_container.new("Creating Excellon."): + with self.app.proc_container.new(_tr("Creating Excellon.")): try: self.app.new_object("excellon", outname, obj_init) @@ -5812,7 +5823,7 @@ class FlatCAMExcEditor(QtCore.QObject): self.app.progress.emit(100) return - self.app.inform.emit("[success]Excellon editing finished.") + self.app.inform.emit(_tr("[success]Excellon editing finished.")) # self.progress.emit(100) def on_tool_select(self, tool): @@ -5829,7 +5840,7 @@ class FlatCAMExcEditor(QtCore.QObject): # self.draw_app.select_tool('select') self.complete = True current_tool = 'select' - self.app.inform.emit("[WARNING_NOTCL]Cancelled. There is no Tool/Drill selected") + self.app.inform.emit(_tr("[WARNING_NOTCL]Cancelled. There is no Tool/Drill selected")) # This is to make the group behave as radio group if current_tool in self.tools_exc: @@ -6219,7 +6230,8 @@ class FlatCAMExcEditor(QtCore.QObject): continue if shape_plus in self.selected: - self.plot_shape(geometry=shape_plus.geo, color=self.app.defaults['global_sel_draw_color'], linewidth=2) + self.plot_shape(geometry=shape_plus.geo, color=self.app.defaults['global_sel_draw_color'], + linewidth=2) continue self.plot_shape(geometry=shape_plus.geo, color=self.app.defaults['global_draw_color']) @@ -6310,7 +6322,7 @@ class FlatCAMExcEditor(QtCore.QObject): self.selected = [] self.build_ui() - self.app.inform.emit("[success]Done. Drill(s) deleted.") + self.app.inform.emit(_tr("[success]Done. Drill(s) deleted.")) def delete_shape(self, shape): self.is_modified = True @@ -6380,7 +6392,7 @@ class FlatCAMExcEditor(QtCore.QObject): self.delete_utility_geometry() self.array_circular_frame.show() self.array_linear_frame.hide() - self.app.inform.emit("Click on the circular array Center position") + self.app.inform.emit(_tr("Click on the circular array Center position")) def on_linear_angle_radio(self): val = self.drill_axis_radio.get_value() diff --git a/FlatCAMGUI.py b/FlatCAMGUI.py index 307f63e4..636afd4a 100644 --- a/FlatCAMGUI.py +++ b/FlatCAMGUI.py @@ -51,67 +51,69 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.menufile.setToolTipsVisible(True) # New Project - self.menufilenewproject = QtWidgets.QAction(QtGui.QIcon('share/file16.png'), '&New Project ...\tCTRL+N', self) + self.menufilenewproject = QtWidgets.QAction(QtGui.QIcon('share/file16.png'), + _tr('&New Project ...\tCTRL+N'), self) self.menufilenewproject.setToolTip( - "Will create a new, blank project" + _tr("Will create a new, blank project") ) self.menufile.addAction(self.menufilenewproject) # New Category (Excellon, Geometry) - self.menufilenew = self.menufile.addMenu(QtGui.QIcon('share/file16.png'), '&New') + self.menufilenew = self.menufile.addMenu(QtGui.QIcon('share/file16.png'), _tr('&New')) self.menufilenew.setToolTipsVisible(True) - self.menufilenewgeo = self.menufilenew.addAction(QtGui.QIcon('share/new_geo16.png'), '&New Geometry\tN') + self.menufilenewgeo = self.menufilenew.addAction(QtGui.QIcon('share/new_geo16.png'), _tr('&New Geometry\tN')) self.menufilenewgeo.setToolTip( - "Will create a new, empty Geometry Object." + _tr("Will create a new, empty Geometry Object.") ) - self.menufilenewexc = self.menufilenew.addAction(QtGui.QIcon('share/new_geo16.png'), 'New Excellon\tL') + self.menufilenewexc = self.menufilenew.addAction(QtGui.QIcon('share/new_geo16.png'), _tr('New Excellon\tL')) self.menufilenewexc.setToolTip( - "Will create a new, empty Excellon Object." + _tr("Will create a new, empty Excellon Object.") ) - self.menufile_open = self.menufile.addMenu(QtGui.QIcon('share/folder32_bis.png'), 'Open') + self.menufile_open = self.menufile.addMenu(QtGui.QIcon('share/folder32_bis.png'), _tr('Open')) self.menufile_open.setToolTipsVisible(True) # Open gerber ... self.menufileopengerber = QtWidgets.QAction(QtGui.QIcon('share/flatcam_icon24.png'), - 'Open &Gerber ...\tCTRL+G', self) + _tr('Open &Gerber ...\tCTRL+G'), self) self.menufile_open.addAction(self.menufileopengerber) self.menufile_open.addSeparator() # Open Excellon ... self.menufileopenexcellon = QtWidgets.QAction(QtGui.QIcon('share/open_excellon32.png'), - 'Open &Excellon ...\tCTRL+E', + _tr('Open &Excellon ...\tCTRL+E'), self) self.menufile_open.addAction(self.menufileopenexcellon) # Open G-Code ... - self.menufileopengcode = QtWidgets.QAction(QtGui.QIcon('share/code.png'), 'Open G-&Code ...', self) + self.menufileopengcode = QtWidgets.QAction(QtGui.QIcon('share/code.png'), _tr('Open G-&Code ...'), self) self.menufile_open.addAction(self.menufileopengcode) # Open Project ... - self.menufileopenproject = QtWidgets.QAction(QtGui.QIcon('share/folder16.png'), 'Open &Project ...', self) + self.menufileopenproject = QtWidgets.QAction(QtGui.QIcon('share/folder16.png'), _tr('Open &Project ...'), self) self.menufile_open.addAction(self.menufileopenproject) self.menufile_open.addSeparator() # Open Config File... - self.menufileopenconfig = QtWidgets.QAction(QtGui.QIcon('share/folder16.png'), 'Open Config ...', self) + self.menufileopenconfig = QtWidgets.QAction(QtGui.QIcon('share/folder16.png'), _tr('Open Config ...'), self) self.menufile_open.addAction(self.menufileopenconfig) # Recent - self.recent = self.menufile.addMenu(QtGui.QIcon('share/recent_files.png'), "Recent files") + self.recent = self.menufile.addMenu(QtGui.QIcon('share/recent_files.png'), _tr("Recent files")) # Separator self.menufile.addSeparator() # Run Scripts - self.menufilerunscript = QtWidgets.QAction(QtGui.QIcon('share/script16.png'), 'Run Script ...\tSHIFT+S', self) + self.menufilerunscript = QtWidgets.QAction(QtGui.QIcon('share/script16.png'), _tr('Run Script ...\tSHIFT+S'), + self) self.menufilerunscript.setToolTip( - "Will run the opened Tcl Script thus\n" + _tr( "Will run the opened Tcl Script thus\n" "enabling the automation of certain\n" - "functions of FlatCAM." + "functions of FlatCAM.") ) self.menufile.addAction(self.menufilerunscript) @@ -119,50 +121,51 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.menufile.addSeparator() # Import ... - self.menufileimport = self.menufile.addMenu(QtGui.QIcon('share/import.png'), 'Import') + self.menufileimport = self.menufile.addMenu(QtGui.QIcon('share/import.png'), _tr('Import')) self.menufileimportsvg = QtWidgets.QAction(QtGui.QIcon('share/svg16.png'), - '&SVG as Geometry Object ...', self) + _tr('&SVG as Geometry Object ...'), self) self.menufileimport.addAction(self.menufileimportsvg) self.menufileimportsvg_as_gerber = QtWidgets.QAction(QtGui.QIcon('share/svg16.png'), - '&SVG as Gerber Object ...', self) + _tr('&SVG as Gerber Object ...'), self) self.menufileimport.addAction(self.menufileimportsvg_as_gerber) self.menufileimport.addSeparator() self.menufileimportdxf = QtWidgets.QAction(QtGui.QIcon('share/dxf16.png'), - '&DXF as Geometry Object ...', self) + _tr('&DXF as Geometry Object ...'), self) self.menufileimport.addAction(self.menufileimportdxf) self.menufileimportdxf_as_gerber = QtWidgets.QAction(QtGui.QIcon('share/dxf16.png'), - '&DXF as Gerber Object ...', self) + _tr('&DXF as Gerber Object ...'), self) self.menufileimport.addAction(self.menufileimportdxf_as_gerber) self.menufileimport.addSeparator() # Export ... - self.menufileexport = self.menufile.addMenu(QtGui.QIcon('share/export.png'), 'Export') + self.menufileexport = self.menufile.addMenu(QtGui.QIcon('share/export.png'), _tr('Export')) self.menufileexport.setToolTipsVisible(True) - self.menufileexportsvg = QtWidgets.QAction(QtGui.QIcon('share/export.png'), 'Export &SVG ...', self) + self.menufileexportsvg = QtWidgets.QAction(QtGui.QIcon('share/export.png'), _tr('Export &SVG ...'), self) self.menufileexport.addAction(self.menufileexportsvg) - self.menufileexportdxf = QtWidgets.QAction(QtGui.QIcon('share/export.png'), 'Export DXF ...', self) + self.menufileexportdxf = QtWidgets.QAction(QtGui.QIcon('share/export.png'), _tr('Export DXF ...'), self) self.menufileexport.addAction(self.menufileexportdxf) self.menufileexport.addSeparator() - self.menufileexportpng = QtWidgets.QAction(QtGui.QIcon('share/export_png32.png'), 'Export &PNG ...', self) + self.menufileexportpng = QtWidgets.QAction(QtGui.QIcon('share/export_png32.png'), _tr('Export &PNG ...'), self) self.menufileexportpng.setToolTip( - "Will export an image in PNG format,\n" + _tr("Will export an image in PNG format,\n" "the saved image will contain the visual \n" - "information currently in FlatCAM Plot Area." + "information currently in FlatCAM Plot Area.") ) self.menufileexport.addAction(self.menufileexportpng) self.menufileexport.addSeparator() - self.menufileexportexcellon = QtWidgets.QAction(QtGui.QIcon('share/drill32.png'), 'Export &Excellon ...', self) + self.menufileexportexcellon = QtWidgets.QAction(QtGui.QIcon('share/drill32.png'), _tr('Export &Excellon ...'), + self) self.menufileexportexcellon.setToolTip( - "Will export an Excellon Object as Excellon file,\n" + _tr( "Will export an Excellon Object as Excellon file,\n" "the coordinates format, the file units and zeros\n" - "are set in Preferences -> Excellon Export." + "are set in Preferences -> Excellon Export.") ) self.menufileexport.addAction(self.menufileexportexcellon) @@ -171,24 +174,24 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.menufile.addSeparator() # Save Defaults - self.menufilesavedefaults = QtWidgets.QAction(QtGui.QIcon('share/defaults.png'), 'Save &Defaults', self) + self.menufilesavedefaults = QtWidgets.QAction(QtGui.QIcon('share/defaults.png'), _tr('Save &Defaults'), self) self.menufile.addAction(self.menufilesavedefaults) # Separator self.menufile.addSeparator() - self.menufile_save = self.menufile.addMenu(QtGui.QIcon('share/save_as.png'), 'Save') + self.menufile_save = self.menufile.addMenu(QtGui.QIcon('share/save_as.png'), _tr('Save')) # Save Project - self.menufilesaveproject = QtWidgets.QAction(QtGui.QIcon('share/floppy16.png'), '&Save Project ...', self) + self.menufilesaveproject = QtWidgets.QAction(QtGui.QIcon('share/floppy16.png'), _tr('&Save Project ...'), self) self.menufile_save.addAction(self.menufilesaveproject) # Save Project As ... self.menufilesaveprojectas = QtWidgets.QAction(QtGui.QIcon('share/save_as.png'), - 'Save Project &As ...\tCTRL+S', self) + _tr('Save Project &As ...\tCTRL+S'), self) self.menufile_save.addAction(self.menufilesaveprojectas) # Save Project Copy ... - self.menufilesaveprojectcopy = QtWidgets.QAction(QtGui.QIcon('share/floppy16.png'), 'Save Project C&opy ...', + self.menufilesaveprojectcopy = QtWidgets.QAction(QtGui.QIcon('share/floppy16.png'), _tr('Save Project C&opy ...'), self) self.menufile_save.addAction(self.menufilesaveprojectcopy) @@ -196,77 +199,82 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.menufile.addSeparator() # Quit - self.menufile_exit = QtWidgets.QAction(QtGui.QIcon('share/power16.png'), 'E&xit', self) + self.menufile_exit = QtWidgets.QAction(QtGui.QIcon('share/power16.png'), _tr('E&xit'), self) # exitAction.setShortcut('Ctrl+Q') # exitAction.setStatusTip('Exit application') self.menufile.addAction(self.menufile_exit) ### Edit ### - self.menuedit = self.menu.addMenu('&Edit') + self.menuedit = self.menu.addMenu(_tr('&Edit')) # Separator self.menuedit.addSeparator() - self.menueditedit = self.menuedit.addAction(QtGui.QIcon('share/edit16.png'), 'Edit Object\tE') - self.menueditok = self.menuedit.addAction(QtGui.QIcon('share/edit_ok16.png'), 'Save && Close Editor\tCTRL+S') + self.menueditedit = self.menuedit.addAction(QtGui.QIcon('share/edit16.png'), _tr('Edit Object\tE')) + self.menueditok = self.menuedit.addAction(QtGui.QIcon('share/edit_ok16.png'), _tr('Save && Close Editor\tCTRL+S')) # Separator self.menuedit.addSeparator() - self.menuedit_convert = self.menuedit.addMenu(QtGui.QIcon('share/convert24.png'), 'Conversion') + self.menuedit_convert = self.menuedit.addMenu(QtGui.QIcon('share/convert24.png'), _tr('Conversion')) self.menuedit_convertjoin = self.menuedit_convert.addAction( - QtGui.QIcon('share/join16.png'), '&Join Geo/Gerber/Exc -> Geo') + QtGui.QIcon('share/join16.png'), _tr('&Join Geo/Gerber/Exc -> Geo')) self.menuedit_convertjoin.setToolTip( - "Merge a selection of objects, which can be of type:\n" + _tr( "Merge a selection of objects, which can be of type:\n" "- Gerber\n" "- Excellon\n" "- Geometry\n" "into a new combo Geometry object.") + ) self.menuedit_convertjoinexc = self.menuedit_convert.addAction( - QtGui.QIcon('share/join16.png'), 'Join Excellon(s) -> Excellon') + QtGui.QIcon('share/join16.png'), _tr('Join Excellon(s) -> Excellon')) self.menuedit_convertjoinexc.setToolTip( - "Merge a selection of Excellon objects into a new combo Excellon object.") + _tr( "Merge a selection of Excellon objects into a new combo Excellon object.") + ) self.menuedit_convertjoingrb = self.menuedit_convert.addAction( - QtGui.QIcon('share/join16.png'), 'Join Gerber(s) -> Gerber') + QtGui.QIcon('share/join16.png'), _tr('Join Gerber(s) -> Gerber')) self.menuedit_convertjoingrb.setToolTip( - "Merge a selection of Gerber objects into a new combo Gerber object.") + _tr("Merge a selection of Gerber objects into a new combo Gerber object.") + ) # Separator self.menuedit_convert.addSeparator() self.menuedit_convert_sg2mg = self.menuedit_convert.addAction( - QtGui.QIcon('share/convert24.png'), 'Convert Single to MultiGeo') + QtGui.QIcon('share/convert24.png'), _tr('Convert Single to MultiGeo')) self.menuedit_convert_sg2mg.setToolTip( - "Will convert a Geometry object from single_geometry type\n" + _tr( "Will convert a Geometry object from single_geometry type\n" "to a multi_geometry type.") + ) self.menuedit_convert_mg2sg = self.menuedit_convert.addAction( - QtGui.QIcon('share/convert24.png'), 'Convert Multi to SingleGeo') + QtGui.QIcon('share/convert24.png'), _tr('Convert Multi to SingleGeo')) self.menuedit_convert_mg2sg.setToolTip( - "Will convert a Geometry object from multi_geometry type\n" + _tr( "Will convert a Geometry object from multi_geometry type\n" "to a single_geometry type.") + ) self.menuedit_convert.setToolTipsVisible(True) # Separator self.menuedit.addSeparator() - self.menueditcopyobject = self.menuedit.addAction(QtGui.QIcon('share/copy.png'), '&Copy Object\tCTRL+C') + self.menueditcopyobject = self.menuedit.addAction(QtGui.QIcon('share/copy.png'), _tr('&Copy Object\tCTRL+C')) self.menueditcopyobjectasgeom = self.menuedit.addAction(QtGui.QIcon('share/copy_geo.png'), - 'Copy as &Geom') + _tr('Copy as &Geom')) # Separator self.menuedit.addSeparator() - self.menueditdelete = self.menuedit.addAction(QtGui.QIcon('share/trash16.png'), '&Delete\tDEL') + self.menueditdelete = self.menuedit.addAction(QtGui.QIcon('share/trash16.png'), _tr('&Delete\tDEL')) # Separator self.menuedit.addSeparator() - self.menueditorigin = self.menuedit.addAction(QtGui.QIcon('share/origin.png'), 'Se&t Origin\tO') - self.menueditjump = self.menuedit.addAction(QtGui.QIcon('share/jump_to16.png'), 'Jump to Location\tJ') + self.menueditorigin = self.menuedit.addAction(QtGui.QIcon('share/origin.png'), _tr('Se&t Origin\tO')) + self.menueditjump = self.menuedit.addAction(QtGui.QIcon('share/jump_to16.png'), _tr('Jump to Location\tJ')) # Separator self.menuedit.addSeparator() self.menuedittoggleunits= self.menuedit.addAction(QtGui.QIcon('share/toggle_units16.png'), - 'Toggle Units\tQ') + _tr('Toggle Units\tQ')) self.menueditselectall = self.menuedit.addAction(QtGui.QIcon('share/select_all.png'), - '&Select All\tCTRL+A') + _tr('&Select All\tCTRL+A')) # Separator self.menuedit.addSeparator() - self.menueditpreferences = self.menuedit.addAction(QtGui.QIcon('share/pref.png'), '&Preferences\tSHIFT+P') + self.menueditpreferences = self.menuedit.addAction(QtGui.QIcon('share/pref.png'), _tr('&Preferences\tSHIFT+P')) ### Options ### - self.menuoptions = self.menu.addMenu('&Options') + self.menuoptions = self.menu.addMenu(_tr('&Options')) # self.menuoptions_transfer = self.menuoptions.addMenu(QtGui.QIcon('share/transfer.png'), 'Transfer options') # self.menuoptions_transfer_a2p = self.menuoptions_transfer.addAction("Application to Project") # self.menuoptions_transfer_p2a = self.menuoptions_transfer.addAction("Project to Application") @@ -281,73 +289,77 @@ class FlatCAMGUI(QtWidgets.QMainWindow): # self.menuoptions_transform = self.menuoptions.addMenu(QtGui.QIcon('share/transform.png'), # '&Transform Object') self.menuoptions_transform_rotate = self.menuoptions.addAction(QtGui.QIcon('share/rotate.png'), - "&Rotate Selection\tSHIFT+(R)") + _tr("&Rotate Selection\tSHIFT+(R)")) # Separator self.menuoptions.addSeparator() self.menuoptions_transform_skewx = self.menuoptions.addAction(QtGui.QIcon('share/skewX.png'), - "&Skew on X axis\tSHIFT+X") + _tr("&Skew on X axis\tSHIFT+X")) self.menuoptions_transform_skewy = self.menuoptions.addAction(QtGui.QIcon('share/skewY.png'), - "S&kew on Y axis\tSHIFT+Y") + _tr( "S&kew on Y axis\tSHIFT+Y")) # Separator self.menuoptions.addSeparator() self.menuoptions_transform_flipx = self.menuoptions.addAction(QtGui.QIcon('share/flipx.png'), - "Flip on &X axis\tX") + _tr("Flip on &X axis\tX")) self.menuoptions_transform_flipy = self.menuoptions.addAction(QtGui.QIcon('share/flipy.png'), - "Flip on &Y axis\tY") + _tr("Flip on &Y axis\tY")) # Separator self.menuoptions.addSeparator() self.menuoptions_view_source = self.menuoptions.addAction(QtGui.QIcon('share/source32.png'), - "View source\tALT+S") + _tr("View source\tALT+S")) # Separator self.menuoptions.addSeparator() ### View ### - self.menuview = self.menu.addMenu('&View') - self.menuviewenable = self.menuview.addAction(QtGui.QIcon('share/replot16.png'), 'Enable all plots\tALT+1') + self.menuview = self.menu.addMenu(_tr('&View')) + self.menuviewenable = self.menuview.addAction(QtGui.QIcon('share/replot16.png'), _tr('Enable all plots\tALT+1')) self.menuviewdisableall = self.menuview.addAction(QtGui.QIcon('share/clear_plot16.png'), - 'Disable all plots\tALT+2') + _tr('Disable all plots\tALT+2')) self.menuviewdisableother = self.menuview.addAction(QtGui.QIcon('share/clear_plot16.png'), - 'Disable non-selected\tALT+3') + _tr('Disable non-selected\tALT+3')) # Separator self.menuview.addSeparator() - self.menuview_zoom_fit = self.menuview.addAction(QtGui.QIcon('share/zoom_fit32.png'), "&Zoom Fit\tV") - self.menuview_zoom_in = self.menuview.addAction(QtGui.QIcon('share/zoom_in32.png'), "&Zoom In\t-") - self.menuview_zoom_out = self.menuview.addAction(QtGui.QIcon('share/zoom_out32.png'), "&Zoom Out\t=") + self.menuview_zoom_fit = self.menuview.addAction(QtGui.QIcon('share/zoom_fit32.png'), _tr("&Zoom Fit\tV")) + self.menuview_zoom_in = self.menuview.addAction(QtGui.QIcon('share/zoom_in32.png'), _tr("&Zoom In\t-")) + self.menuview_zoom_out = self.menuview.addAction(QtGui.QIcon('share/zoom_out32.png'), _tr("&Zoom Out\t=")) self.menuview.addSeparator() self.menuview_toggle_code_editor = self.menuview.addAction(QtGui.QIcon('share/code_editor32.png'), - 'Toggle Code Editor\tCTRL+E') + _tr('Toggle Code Editor\tCTRL+E')) self.menuview.addSeparator() self.menuview_toggle_fscreen = self.menuview.addAction( - QtGui.QIcon('share/fscreen32.png'), "&Toggle FullScreen\tALT+F10") + QtGui.QIcon('share/fscreen32.png'), _tr("&Toggle FullScreen\tALT+F10")) self.menuview_toggle_parea = self.menuview.addAction( - QtGui.QIcon('share/plot32.png'), "&Toggle Plot Area\tCTRL+F10") + QtGui.QIcon('share/plot32.png'), _tr("&Toggle Plot Area\tCTRL+F10")) self.menuview_toggle_notebook = self.menuview.addAction( - QtGui.QIcon('share/notebook32.png'), "&Toggle Project/Sel/Tool\t`") + QtGui.QIcon('share/notebook32.png'), _tr("&Toggle Project/Sel/Tool\t`")) self.menuview.addSeparator() - self.menuview_toggle_grid = self.menuview.addAction(QtGui.QIcon('share/grid32.png'), "&Toggle Grid Snap\tG") - self.menuview_toggle_axis = self.menuview.addAction(QtGui.QIcon('share/axis32.png'), "&Toggle Axis\tSHIFT+G") + self.menuview_toggle_grid = self.menuview.addAction(QtGui.QIcon('share/grid32.png'), _tr("&Toggle Grid Snap\tG") + ) + self.menuview_toggle_axis = self.menuview.addAction(QtGui.QIcon('share/axis32.png'), _tr("&Toggle Axis\tSHIFT+G") + ) self.menuview_toggle_workspace = self.menuview.addAction(QtGui.QIcon('share/workspace24.png'), - "Toggle Workspace\tSHIFT+W") + _tr("Toggle Workspace\tSHIFT+W")) ### Tool ### # self.menutool = self.menu.addMenu('&Tool') self.menutool = QtWidgets.QMenu('&Tool') self.menutoolaction = self.menu.addMenu(self.menutool) - self.menutoolshell = self.menutool.addAction(QtGui.QIcon('share/shell16.png'), '&Command Line\tS') + self.menutoolshell = self.menutool.addAction(QtGui.QIcon('share/shell16.png'), _tr('&Command Line\tS')) ### Help ### self.menuhelp = self.menu.addMenu('&Help') - self.menuhelp_manual = self.menuhelp.addAction(QtGui.QIcon('share/globe16.png'), 'Help\tF1') - self.menuhelp_home = self.menuhelp.addAction(QtGui.QIcon('share/home16.png'), 'FlatCAM.org') + self.menuhelp_manual = self.menuhelp.addAction(QtGui.QIcon('share/globe16.png'), _tr('Help\tF1')) + self.menuhelp_home = self.menuhelp.addAction(QtGui.QIcon('share/home16.png'), _tr('FlatCAM.org')) self.menuhelp.addSeparator() - self.menuhelp_shortcut_list = self.menuhelp.addAction(QtGui.QIcon('share/shortcuts24.png'), 'Shortcuts List\tF3') - self.menuhelp_videohelp = self.menuhelp.addAction(QtGui.QIcon('share/youtube32.png'), 'YouTube Channel\tF4') - self.menuhelp_about = self.menuhelp.addAction(QtGui.QIcon('share/about32.png'), 'About') + self.menuhelp_shortcut_list = self.menuhelp.addAction(QtGui.QIcon('share/shortcuts24.png'), + _tr('Shortcuts List\tF3')) + self.menuhelp_videohelp = self.menuhelp.addAction(QtGui.QIcon('share/youtube32.png'), _tr('YouTube Channel\tF4') + ) + self.menuhelp_about = self.menuhelp.addAction(QtGui.QIcon('share/about32.png'), _tr('About')) ### FlatCAM Editor menu ### @@ -358,68 +370,71 @@ class FlatCAMGUI(QtWidgets.QMainWindow): # self.select_menuitem = self.menu.addAction(QtGui.QIcon('share/pointer16.png'), "Select 'Esc'") self.geo_add_circle_menuitem = self.geo_editor_menu.addAction( - QtGui.QIcon('share/circle32.png'), 'Add Circle\tO' + QtGui.QIcon('share/circle32.png'), _tr('Add Circle\tO') ) - self.geo_add_arc_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/arc16.png'), 'Add Arc\tA') + self.geo_add_arc_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/arc16.png'), _tr('Add Arc\tA')) self.geo_editor_menu.addSeparator() self.geo_add_rectangle_menuitem = self.geo_editor_menu.addAction( - QtGui.QIcon('share/rectangle32.png'), 'Add Rectangle\tR' + QtGui.QIcon('share/rectangle32.png'), _tr('Add Rectangle\tR') ) self.geo_add_polygon_menuitem = self.geo_editor_menu.addAction( - QtGui.QIcon('share/polygon32.png'), 'Add Polygon\tN' + QtGui.QIcon('share/polygon32.png'), _tr('Add Polygon\tN') ) - self.geo_add_path_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/path32.png'), 'Add Path\tP') + self.geo_add_path_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/path32.png'), _tr('Add Path\tP')) self.geo_editor_menu.addSeparator() - self.geo_add_text_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/text32.png'), 'Add Text\tT') + self.geo_add_text_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/text32.png'), _tr('Add Text\tT')) self.geo_editor_menu.addSeparator() - self.geo_union_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/union16.png'), 'Polygon Union\tU') + self.geo_union_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/union16.png'), + _tr('Polygon Union\tU')) self.geo_intersection_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/intersection16.png'), - 'Polygon Intersection\tE') + _tr('Polygon Intersection\tE')) self.geo_subtract_menuitem = self.geo_editor_menu.addAction( - QtGui.QIcon('share/subtract16.png'), 'Polygon Subtraction\tS' + QtGui.QIcon('share/subtract16.png'), _tr('Polygon Subtraction\tS') ) self.geo_editor_menu.addSeparator() - self.geo_cutpath_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/cutpath16.png'), 'Cut Path\tX') + self.geo_cutpath_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/cutpath16.png'), + _tr('Cut Path\tX')) # self.move_menuitem = self.menu.addAction(QtGui.QIcon('share/move16.png'), "Move Objects 'm'") - self.geo_copy_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/copy16.png'), "Copy Geom\tC") + self.geo_copy_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/copy16.png'), _tr("Copy Geom\tC")) self.geo_delete_menuitem = self.geo_editor_menu.addAction( - QtGui.QIcon('share/deleteshape16.png'), "Delete Shape\tDEL" + QtGui.QIcon('share/deleteshape16.png'), _tr("Delete Shape\tDEL") ) self.geo_editor_menu.addSeparator() - self.geo_move_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/move32.png'), "Move\tM") + self.geo_move_menuitem = self.geo_editor_menu.addAction(QtGui.QIcon('share/move32.png'), _tr("Move\tM")) self.geo_buffer_menuitem = self.geo_editor_menu.addAction( - QtGui.QIcon('share/buffer16.png'), "Buffer Tool\tB" + QtGui.QIcon('share/buffer16.png'),_tr( "Buffer Tool\tB") ) self.geo_paint_menuitem = self.geo_editor_menu.addAction( - QtGui.QIcon('share/paint16.png'), "Paint Tool\tI" + QtGui.QIcon('share/paint16.png'), _tr("Paint Tool\tI") ) self.geo_transform_menuitem = self.geo_editor_menu.addAction( - QtGui.QIcon('share/transform.png'), "Transform Tool\tALT+R" + QtGui.QIcon('share/transform.png'),_tr( "Transform Tool\tALT+R") ) self.geo_editor_menu.addSeparator() self.geo_cornersnap_menuitem = self.geo_editor_menu.addAction( - QtGui.QIcon('share/corner32.png'), "Toggle Corner Snap\tK" + QtGui.QIcon('share/corner32.png'), _tr("Toggle Corner Snap\tK") ) - self.exc_editor_menu = QtWidgets.QMenu(">Excellon Editor<") + self.exc_editor_menu = QtWidgets.QMenu(_tr(">Excellon Editor<")) self.menu.addMenu(self.exc_editor_menu) self.exc_add_array_drill_menuitem = self.exc_editor_menu.addAction( - QtGui.QIcon('share/rectangle32.png'), 'Add Drill Array\tA') - self.exc_add_drill_menuitem = self.exc_editor_menu.addAction(QtGui.QIcon('share/plus16.png'), 'Add Drill\tD') + QtGui.QIcon('share/rectangle32.png'), _tr('Add Drill Array\tA')) + self.exc_add_drill_menuitem = self.exc_editor_menu.addAction(QtGui.QIcon('share/plus16.png'), + _tr('Add Drill\tD')) self.exc_editor_menu.addSeparator() self.exc_resize_drill_menuitem = self.exc_editor_menu.addAction( - QtGui.QIcon('share/resize16.png'), 'Resize Drill(S)\tR' + QtGui.QIcon('share/resize16.png'), _tr('Resize Drill(S)\tR') ) - self.exc_copy_drill_menuitem = self.exc_editor_menu.addAction(QtGui.QIcon('share/copy32.png'), 'Copy\tC') + self.exc_copy_drill_menuitem = self.exc_editor_menu.addAction(QtGui.QIcon('share/copy32.png'), _tr('Copy\tC')) self.exc_delete_drill_menuitem = self.exc_editor_menu.addAction( - QtGui.QIcon('share/deleteshape32.png'), 'Delete\tDEL' + QtGui.QIcon('share/deleteshape32.png'), _tr('Delete\tDEL') ) self.exc_editor_menu.addSeparator() self.exc_move_drill_menuitem = self.exc_editor_menu.addAction( - QtGui.QIcon('share/move32.png'), 'Move Drill(s)\tM') + QtGui.QIcon('share/move32.png'),_tr( 'Move Drill(s)\tM')) self.geo_editor_menu.menuAction().setVisible(False) self.geo_editor_menu.setDisabled(True) @@ -433,19 +448,19 @@ class FlatCAMGUI(QtWidgets.QMainWindow): ################################ self.menuproject = QtWidgets.QMenu() - self.menuprojectenable = self.menuproject.addAction(QtGui.QIcon('share/replot32.png'), 'Enable Plot') - self.menuprojectdisable = self.menuproject.addAction(QtGui.QIcon('share/clear_plot32.png'), 'Disable Plot') + self.menuprojectenable = self.menuproject.addAction(QtGui.QIcon('share/replot32.png'), _tr('Enable Plot')) + self.menuprojectdisable = self.menuproject.addAction(QtGui.QIcon('share/clear_plot32.png'), _tr('Disable Plot')) self.menuproject.addSeparator() - self.menuprojectgeneratecnc = self.menuproject.addAction(QtGui.QIcon('share/cnc32.png'), 'Generate CNC') - self.menuprojectviewsource = self.menuproject.addAction(QtGui.QIcon('share/source32.png'), 'View Source') + self.menuprojectgeneratecnc = self.menuproject.addAction(QtGui.QIcon('share/cnc32.png'), _tr('Generate CNC')) + self.menuprojectviewsource = self.menuproject.addAction(QtGui.QIcon('share/source32.png'), _tr('View Source')) - self.menuprojectedit = self.menuproject.addAction(QtGui.QIcon('share/edit_ok32.png'), 'Edit') - self.menuprojectcopy = self.menuproject.addAction(QtGui.QIcon('share/copy32.png'), 'Copy') - self.menuprojectdelete = self.menuproject.addAction(QtGui.QIcon('share/delete32.png'), 'Delete') - self.menuprojectsave= self.menuproject.addAction(QtGui.QIcon('share/save_as.png'), 'Save') + self.menuprojectedit = self.menuproject.addAction(QtGui.QIcon('share/edit_ok32.png'), _tr('Edit')) + self.menuprojectcopy = self.menuproject.addAction(QtGui.QIcon('share/copy32.png'), _tr('Copy')) + self.menuprojectdelete = self.menuproject.addAction(QtGui.QIcon('share/delete32.png'), _tr('Delete')) + self.menuprojectsave= self.menuproject.addAction(QtGui.QIcon('share/save_as.png'), _tr('Save')) self.menuproject.addSeparator() - self.menuprojectproperties = self.menuproject.addAction(QtGui.QIcon('share/properties32.png'), 'Properties') + self.menuprojectproperties = self.menuproject.addAction(QtGui.QIcon('share/properties32.png'), _tr('Properties')) ################ ### Splitter ### @@ -474,35 +489,35 @@ class FlatCAMGUI(QtWidgets.QMainWindow): ############### ### TOOLBAR INSTALLATION ### - self.toolbarfile = QtWidgets.QToolBar('File Toolbar') + self.toolbarfile = QtWidgets.QToolBar(_tr('File Toolbar')) self.toolbarfile.setObjectName('File_TB') self.addToolBar(self.toolbarfile) - self.toolbargeo = QtWidgets.QToolBar('Edit Toolbar') + self.toolbargeo = QtWidgets.QToolBar(_tr('Edit Toolbar')) self.toolbargeo.setObjectName('Edit_TB') self.addToolBar(self.toolbargeo) - self.toolbarview = QtWidgets.QToolBar('View Toolbar') + self.toolbarview = QtWidgets.QToolBar(_tr('View Toolbar')) self.toolbarview.setObjectName('View_TB') self.addToolBar(self.toolbarview) - self.toolbarshell = QtWidgets.QToolBar('Shell Toolbar') + self.toolbarshell = QtWidgets.QToolBar(_tr('Shell Toolbar')) self.toolbarshell.setObjectName('Shell_TB') self.addToolBar(self.toolbarshell) - self.toolbartools = QtWidgets.QToolBar('Tools Toolbar') + self.toolbartools = QtWidgets.QToolBar(_tr('Tools Toolbar')) self.toolbartools.setObjectName('Tools_TB') self.addToolBar(self.toolbartools) - self.exc_edit_toolbar = QtWidgets.QToolBar('Excellon Editor Toolbar') + self.exc_edit_toolbar = QtWidgets.QToolBar(_tr('Excellon Editor Toolbar')) self.exc_edit_toolbar.setObjectName('ExcEditor_TB') self.addToolBar(self.exc_edit_toolbar) - self.geo_edit_toolbar = QtWidgets.QToolBar('Geometry Editor Toolbar') + self.geo_edit_toolbar = QtWidgets.QToolBar(_tr('Geometry Editor Toolbar')) self.geo_edit_toolbar.setObjectName('GeoEditor_TB') self.addToolBar(self.geo_edit_toolbar) - self.snap_toolbar = QtWidgets.QToolBar('Grid Toolbar') + self.snap_toolbar = QtWidgets.QToolBar(_tr('Grid Toolbar')) self.snap_toolbar.setObjectName('Snap_TB') self.addToolBar(self.snap_toolbar) @@ -518,126 +533,127 @@ class FlatCAMGUI(QtWidgets.QMainWindow): ### File Toolbar ### self.file_open_gerber_btn = self.toolbarfile.addAction(QtGui.QIcon('share/flatcam_icon32.png'), - "Open GERBER") - self.file_open_excellon_btn = self.toolbarfile.addAction(QtGui.QIcon('share/drill32.png'), "Open EXCELLON") + _tr("Open Gerber")) + self.file_open_excellon_btn = self.toolbarfile.addAction(QtGui.QIcon('share/drill32.png'), _tr("Open Excellon")) self.toolbarfile.addSeparator() - self.file_open_btn = self.toolbarfile.addAction(QtGui.QIcon('share/folder32.png'), "Open project") - self.file_save_btn = self.toolbarfile.addAction(QtGui.QIcon('share/floppy32.png'), "Save project") + self.file_open_btn = self.toolbarfile.addAction(QtGui.QIcon('share/folder32.png'), _tr("Open project")) + self.file_save_btn = self.toolbarfile.addAction(QtGui.QIcon('share/floppy32.png'), _tr("Save project")) ### Edit Toolbar ### - self.newgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_geo32_bis.png'), "New Blank Geometry") - self.newexc_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_exc32.png'), "New Blank Excellon") + self.newgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_geo32_bis.png'), _tr("New Blank Geometry")) + self.newexc_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_exc32.png'), _tr("New Blank Excellon")) self.toolbargeo.addSeparator() - self.editgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/edit32.png'), "Editor") + self.editgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/edit32.png'), _tr("Editor")) self.update_obj_btn = self.toolbargeo.addAction( - QtGui.QIcon('share/edit_ok32_bis.png'), "Save Object and close the Editor" + QtGui.QIcon('share/edit_ok32_bis.png'), _tr("Save Object and close the Editor") ) self.toolbargeo.addSeparator() - self.delete_btn = self.toolbargeo.addAction(QtGui.QIcon('share/cancel_edit32.png'), "&Delete") + self.delete_btn = self.toolbargeo.addAction(QtGui.QIcon('share/cancel_edit32.png'), _tr("&Delete")) ### View Toolbar ### - self.replot_btn = self.toolbarview.addAction(QtGui.QIcon('share/replot32.png'), "&Replot") - self.clear_plot_btn = self.toolbarview.addAction(QtGui.QIcon('share/clear_plot32.png'), "&Clear plot") - self.zoom_in_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_in32.png'), "Zoom In") - self.zoom_out_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_out32.png'), "Zoom Out") - self.zoom_fit_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_fit32.png'), "Zoom Fit") + self.replot_btn = self.toolbarview.addAction(QtGui.QIcon('share/replot32.png'), _tr("&Replot")) + self.clear_plot_btn = self.toolbarview.addAction(QtGui.QIcon('share/clear_plot32.png'), _tr("&Clear plot")) + self.zoom_in_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_in32.png'), _tr("Zoom In")) + self.zoom_out_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_out32.png'), _tr("Zoom Out")) + self.zoom_fit_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_fit32.png'), _tr("Zoom Fit")) # self.toolbarview.setVisible(False) ### Shell Toolbar ### - self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), "&Command Line") + self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), _tr("&Command Line")) ### Tools Toolbar ### - self.dblsided_btn = self.toolbartools.addAction(QtGui.QIcon('share/doubleside32.png'), "2Sided Tool") - self.cutout_btn = self.toolbartools.addAction(QtGui.QIcon('share/cut16.png'), "&Cutout Tool") - self.ncc_btn = self.toolbartools.addAction(QtGui.QIcon('share/flatcam_icon32.png'), "NCC Tool") - self.paint_btn = self.toolbartools.addAction(QtGui.QIcon('share/paint20_1.png'), "Paint Tool") + self.dblsided_btn = self.toolbartools.addAction(QtGui.QIcon('share/doubleside32.png'), _tr("2Sided Tool")) + self.cutout_btn = self.toolbartools.addAction(QtGui.QIcon('share/cut16.png'), _tr("&Cutout Tool")) + self.ncc_btn = self.toolbartools.addAction(QtGui.QIcon('share/flatcam_icon32.png'), _tr("NCC Tool")) + self.paint_btn = self.toolbartools.addAction(QtGui.QIcon('share/paint20_1.png'), _tr("Paint Tool")) self.toolbartools.addSeparator() - self.panelize_btn = self.toolbartools.addAction(QtGui.QIcon('share/panel16.png'), "Panel Tool") - self.film_btn = self.toolbartools.addAction(QtGui.QIcon('share/film16.png'), "Film Tool") - self.solder_btn = self.toolbartools.addAction(QtGui.QIcon('share/solderpastebis32.png'), "SolderPaste Tool") + self.panelize_btn = self.toolbartools.addAction(QtGui.QIcon('share/panel16.png'), _tr("Panel Tool")) + self.film_btn = self.toolbartools.addAction(QtGui.QIcon('share/film16.png'),_tr( "Film Tool")) + self.solder_btn = self.toolbartools.addAction(QtGui.QIcon('share/solderpastebis32.png'), _tr("SolderPaste Tool")) self.toolbartools.addSeparator() - self.calculators_btn = self.toolbartools.addAction(QtGui.QIcon('share/calculator24.png'), "Calculators Tool") - self.transform_btn = self.toolbartools.addAction(QtGui.QIcon('share/transform.png'), "Transform Tool") + self.calculators_btn = self.toolbartools.addAction(QtGui.QIcon('share/calculator24.png'), _tr("Calculators Tool")) + self.transform_btn = self.toolbartools.addAction(QtGui.QIcon('share/transform.png'), _tr("Transform Tool")) ### Drill Editor Toolbar ### - self.select_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), "Select") - self.add_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/plus16.png'), 'Add Drill Hole') + self.select_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _tr("Select")) + self.add_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/plus16.png'), _tr('Add Drill Hole')) self.add_drill_array_btn = self.exc_edit_toolbar.addAction( QtGui.QIcon('share/addarray16.png'), 'Add Drill Hole Array') - self.resize_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/resize16.png'), 'Resize Drill') + self.resize_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/resize16.png'), _tr('Resize Drill')) self.exc_edit_toolbar.addSeparator() - self.copy_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), 'Copy Drill') - self.delete_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/deleteshape32.png'), "Delete Drill") + self.copy_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), _tr('Copy Drill')) + self.delete_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/deleteshape32.png'), _tr("Delete Drill")) self.exc_edit_toolbar.addSeparator() - self.move_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), "Move Drill") + self.move_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _tr("Move Drill")) ### Geometry Editor Toolbar ### - self.geo_select_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), "Select") - self.geo_add_circle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/circle32.png'), 'Add Circle') - self.geo_add_arc_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/arc32.png'), 'Add Arc') + self.geo_select_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _tr("Select")) + self.geo_add_circle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/circle32.png'), _tr('Add Circle')) + self.geo_add_arc_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/arc32.png'), _tr('Add Arc')) self.geo_add_rectangle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/rectangle32.png'), - 'Add Rectangle') + _tr('Add Rectangle')) self.geo_edit_toolbar.addSeparator() - self.geo_add_path_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/path32.png'), 'Add Path') - self.geo_add_polygon_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/polygon32.png'), 'Add Polygon') + self.geo_add_path_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/path32.png'), _tr('Add Path')) + self.geo_add_polygon_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/polygon32.png'), _tr('Add Polygon')) self.geo_edit_toolbar.addSeparator() - self.geo_add_text_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/text32.png'), 'Add Text') - self.geo_add_buffer_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/buffer16-2.png'), 'Add Buffer') - self.geo_add_paint_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/paint20_1.png'), 'Paint Shape') + self.geo_add_text_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/text32.png'), _tr('Add Text')) + self.geo_add_buffer_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/buffer16-2.png'), _tr('Add Buffer')) + self.geo_add_paint_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/paint20_1.png'), _tr('Paint Shape')) self.geo_edit_toolbar.addSeparator() - self.geo_union_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/union32.png'), 'Polygon Union') + self.geo_union_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/union32.png'), _tr('Polygon Union')) self.geo_intersection_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/intersection32.png'), - 'Polygon Intersection') + _tr('Polygon Intersection')) self.geo_subtract_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/subtract32.png'), - 'Polygon Subtraction') + _tr('Polygon Subtraction')) self.geo_edit_toolbar.addSeparator() - self.geo_cutpath_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/cutpath32.png'), 'Cut Path') - self.geo_copy_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), "Copy Shape(s)") + self.geo_cutpath_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/cutpath32.png'), _tr('Cut Path')) + self.geo_copy_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), _tr("Copy Shape(s)")) self.geo_delete_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/deleteshape32.png'), - "Delete Shape '-'") - self.geo_transform_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/transform.png'), "Transformations") + _tr("Delete Shape '-'")) + self.geo_transform_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/transform.png'), + _tr("Transformations")) self.geo_edit_toolbar.addSeparator() - self.geo_move_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), "Move Objects ") + self.geo_move_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _tr("Move Objects ")) ### Snap Toolbar ### # Snap GRID toolbar is always active to facilitate usage of measurements done on GRID # self.addToolBar(self.snap_toolbar) - self.grid_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/grid32.png'), 'Snap to grid') + self.grid_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/grid32.png'), _tr('Snap to grid')) self.grid_gap_x_entry = FCEntry2() self.grid_gap_x_entry.setMaximumWidth(70) - self.grid_gap_x_entry.setToolTip("Grid X distance") + self.grid_gap_x_entry.setToolTip(_tr("Grid X snapping distance")) self.snap_toolbar.addWidget(self.grid_gap_x_entry) self.grid_gap_y_entry = FCEntry2() self.grid_gap_y_entry.setMaximumWidth(70) - self.grid_gap_y_entry.setToolTip("Grid Y distance") + self.grid_gap_y_entry.setToolTip(_tr("Grid Y snapping distance")) self.snap_toolbar.addWidget(self.grid_gap_y_entry) self.grid_space_label = QtWidgets.QLabel(" ") self.snap_toolbar.addWidget(self.grid_space_label) self.grid_gap_link_cb = FCCheckBox() - self.grid_gap_link_cb.setToolTip("When active, value on Grid_X\n" - "is copied to the Grid_Y value.") + self.grid_gap_link_cb.setToolTip(_tr("When active, value on Grid_X\n" + "is copied to the Grid_Y value.")) self.snap_toolbar.addWidget(self.grid_gap_link_cb) self.ois_grid = OptionalInputSection(self.grid_gap_link_cb, [self.grid_gap_y_entry], logic=False) - self.corner_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/corner32.png'), 'Snap to corner') + self.corner_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/corner32.png'), _tr('Snap to corner')) self.snap_max_dist_entry = FCEntry() self.snap_max_dist_entry.setMaximumWidth(70) - self.snap_max_dist_entry.setToolTip("Max. magnet distance") + self.snap_max_dist_entry.setToolTip(_tr("Max. magnet distance")) self.snap_magnet = self.snap_toolbar.addWidget(self.snap_max_dist_entry) @@ -651,7 +667,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): # project_tab.setMinimumWidth(250) # Hack self.project_tab_layout = QtWidgets.QVBoxLayout(self.project_tab) self.project_tab_layout.setContentsMargins(2, 2, 2, 2) - self.notebook.addTab(self.project_tab, "Project") + self.notebook.addTab(self.project_tab,_tr( "Project")) ### Selected ### self.selected_tab = QtWidgets.QWidget() @@ -660,14 +676,14 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.selected_tab_layout.setContentsMargins(2, 2, 2, 2) self.selected_scroll_area = VerticalScrollArea() self.selected_tab_layout.addWidget(self.selected_scroll_area) - self.notebook.addTab(self.selected_tab, "Selected") + self.notebook.addTab(self.selected_tab, _tr("Selected")) ### Tool ### self.tool_tab = QtWidgets.QWidget() - self.tool_tab.setObjectName("tool_tab") + self.tool_tab.setObjectName(_tr("tool_tab")) self.tool_tab_layout = QtWidgets.QVBoxLayout(self.tool_tab) self.tool_tab_layout.setContentsMargins(2, 2, 2, 2) - self.notebook.addTab(self.tool_tab, "Tool") + self.notebook.addTab(self.tool_tab, _tr("Tool")) self.tool_scroll_area = VerticalScrollArea() self.tool_tab_layout.addWidget(self.tool_scroll_area) @@ -679,7 +695,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.right_lay.setContentsMargins(0, 0, 0, 0) self.right_widget.setLayout(self.right_lay) # self.plot_tab_area = FCTab() - self.plot_tab_area = FCDetachableTab(protect=False, protect_by_name=['Plot Area']) + self.plot_tab_area = FCDetachableTab(protect=False, protect_by_name=[_tr('Plot Area')]) self.plot_tab_area.useOldIndex(True) self.right_lay.addWidget(self.plot_tab_area) @@ -687,7 +703,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.plot_tab = QtWidgets.QWidget() self.plot_tab.setObjectName("plotarea") - self.plot_tab_area.addTab(self.plot_tab, "Plot Area") + self.plot_tab_area.addTab(self.plot_tab, _tr("Plot Area")) self.right_layout = QtWidgets.QVBoxLayout() self.right_layout.setContentsMargins(2, 2, 2, 2) @@ -711,7 +727,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.pref_tab_layout.addWidget(self.pref_tab_area) self.general_tab = QtWidgets.QWidget() - self.pref_tab_area.addTab(self.general_tab, "General") + self.pref_tab_area.addTab(self.general_tab, _tr("General")) self.general_tab_lay = QtWidgets.QVBoxLayout() self.general_tab_lay.setContentsMargins(2, 2, 2, 2) self.general_tab.setLayout(self.general_tab_lay) @@ -720,8 +736,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.general_tab_lay.addLayout(self.hlay1) self.options_combo = QtWidgets.QComboBox() - self.options_combo.addItem("APP. DEFAULTS") - self.options_combo.addItem("PROJ. OPTIONS ") + self.options_combo.addItem(_tr("APP. DEFAULTS")) + self.options_combo.addItem(_tr("PROJ. OPTIONS ")) self.hlay1.addWidget(self.options_combo) # disable this button as it may no longer be useful @@ -732,7 +748,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.general_tab_lay.addWidget(self.general_scroll_area) self.gerber_tab = QtWidgets.QWidget() - self.pref_tab_area.addTab(self.gerber_tab, "GERBER") + self.pref_tab_area.addTab(self.gerber_tab, _tr("GERBER")) self.gerber_tab_lay = QtWidgets.QVBoxLayout() self.gerber_tab_lay.setContentsMargins(2, 2, 2, 2) self.gerber_tab.setLayout(self.gerber_tab_lay) @@ -741,7 +757,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.gerber_tab_lay.addWidget(self.gerber_scroll_area) self.excellon_tab = QtWidgets.QWidget() - self.pref_tab_area.addTab(self.excellon_tab, "EXCELLON") + self.pref_tab_area.addTab(self.excellon_tab, _tr("EXCELLON")) self.excellon_tab_lay = QtWidgets.QVBoxLayout() self.excellon_tab_lay.setContentsMargins(2, 2, 2, 2) self.excellon_tab.setLayout(self.excellon_tab_lay) @@ -750,7 +766,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.excellon_tab_lay.addWidget(self.excellon_scroll_area) self.geometry_tab = QtWidgets.QWidget() - self.pref_tab_area.addTab(self.geometry_tab, "GEOMETRY") + self.pref_tab_area.addTab(self.geometry_tab, _tr("GEOMETRY")) self.geometry_tab_lay = QtWidgets.QVBoxLayout() self.geometry_tab_lay.setContentsMargins(2, 2, 2, 2) self.geometry_tab.setLayout(self.geometry_tab_lay) @@ -760,7 +776,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.cncjob_tab = QtWidgets.QWidget() self.cncjob_tab.setObjectName("cncjob_tab") - self.pref_tab_area.addTab(self.cncjob_tab, "CNC-JOB") + self.pref_tab_area.addTab(self.cncjob_tab, _tr("CNC-JOB")) self.cncjob_tab_lay = QtWidgets.QVBoxLayout() self.cncjob_tab_lay.setContentsMargins(2, 2, 2, 2) self.cncjob_tab.setLayout(self.cncjob_tab_lay) @@ -769,7 +785,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.cncjob_tab_lay.addWidget(self.cncjob_scroll_area) self.tools_tab = QtWidgets.QWidget() - self.pref_tab_area.addTab(self.tools_tab, "TOOLS") + self.pref_tab_area.addTab(self.tools_tab, _tr("TOOLS")) self.tools_tab_lay = QtWidgets.QVBoxLayout() self.tools_tab_lay.setContentsMargins(2, 2, 2, 2) self.tools_tab.setLayout(self.tools_tab_lay) @@ -786,28 +802,28 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_1) self.pref_import_button = QtWidgets.QPushButton() - self.pref_import_button.setText("Import Preferences") + self.pref_import_button.setText(_tr("Import Preferences")) self.pref_import_button.setFixedWidth(130) self.pref_import_button.setToolTip( - "Import a full set of FlatCAM settings from a file\n" + _tr("Import a full set of FlatCAM settings from a file\n" "previously saved on HDD.\n\n" "FlatCAM automatically save a 'factory_defaults' file\n" - "on the first start. Do not delete that file.") + "on the first start. Do not delete that file.")) self.pref_tab_bottom_layout_1.addWidget(self.pref_import_button) self.pref_export_button = QtWidgets.QPushButton() - self.pref_export_button.setText("Export Preferences") + self.pref_export_button.setText(_tr("Export Preferences")) self.pref_export_button.setFixedWidth(130) self.pref_export_button.setToolTip( - "Export a full set of FlatCAM settings in a file\n" - "that is saved on HDD.") + _tr( "Export a full set of FlatCAM settings in a file\n" + "that is saved on HDD.")) self.pref_tab_bottom_layout_1.addWidget(self.pref_export_button) self.pref_open_button = QtWidgets.QPushButton() - self.pref_open_button.setText("Open Pref Folder") + self.pref_open_button.setText(_tr("Open Pref Folder")) self.pref_open_button.setFixedWidth(130) self.pref_open_button.setToolTip( - "Open the folder where FlatCAM save the preferences files.") + _tr("Open the folder where FlatCAM save the preferences files.")) self.pref_tab_bottom_layout_1.addWidget(self.pref_open_button) self.pref_tab_bottom_layout_2 = QtWidgets.QHBoxLayout() @@ -815,11 +831,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_2) self.pref_save_button = QtWidgets.QPushButton() - self.pref_save_button.setText("Save Preferences") + self.pref_save_button.setText(_tr("Save Preferences")) self.pref_save_button.setFixedWidth(130) self.pref_save_button.setToolTip( - "Save the current settings in the 'current_defaults' file\n" - "which is the file storing the working default preferences.") + _tr("Save the current settings in the 'current_defaults' file\n" + "which is the file storing the working default preferences.")) self.pref_tab_bottom_layout_2.addWidget(self.pref_save_button) ######################################## @@ -832,7 +848,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.sh_hlay = QtWidgets.QHBoxLayout() self.sh_title = QtWidgets.QTextEdit( - 'Shortcut Key List') + _tr('Shortcut Key List')) self.sh_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.sh_title.setFrameStyle(QtWidgets.QFrame.NoFrame) self.sh_title.setMaximumHeight(30) @@ -843,273 +859,275 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.sh_tab_layout.addWidget(self.sh_title) self.sh_tab_layout.addLayout(self.sh_hlay) - self.app_sh_msg = '''General Shortcut list
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
F3 SHOW SHORTCUT LIST
  
1 Switch to Project Tab
2 Switch to Selected Tab
3 Switch to Tool Tab
  
E Edit Object (if selected)
G Grid On/Off
J Jump to Coordinates
L New Excellon
M Move Obj
N New Geometry
O Set Origin
Q Change Units
P Open Properties Tool
R Rotate by 90 degree CW
S Shell Toggle
T Add a Tool (when in Geometry Selected Tab or in Tools NCC or Tools Paint)
V Zoom Fit
X Flip on X_axis
Y Flip on Y_axis
'=' Zoom Out
'-' Zoom In
  
CTRL+A Select All
CTRL+C Copy Obj
CTRL+E Open Excellon File
CTRL+G Open Gerber File
CTRL+N New Project
CTRL+M Measurement Tool
CTRL+O Open Project
CTRL+S Save Project As
CTRL+F10 Toggle Plot Area
  
SHIFT+C Copy Obj_Name
SHIFT+E Toggle Code Editor
SHIFT+G Toggle the axis
SHIFT+P Open Preferences Window
SHIFT+R Rotate by 90 degree CCW
SHIFT+S Run a Script
SHIFT+W Toggle the workspace
SHIFT+X Skew on X axis
SHIFT+Y Skew on Y axis
  
ALT+C Calculators Tool
ALT+D 2-Sided PCB Tool
ALT+K Solder Paste Dispensing Tool
ALT+L Film PCB Tool
ALT+N Non-Copper Clearing Tool
ALT+P Paint Area Tool
ALT+R Transformations Tool
ALT+S View File Source
ALT+U Cutout PCB Tool
ALT+1 Enable all Plots
ALT+2 Disable all Plots
ALT+3 Disable Non-selected Plots
ALT+F10 Toggle Full Screen
  
F1 Open Online Manual
F4 Open Online Tutorials
Del Delete Object
Del Alternate: Delete Tool
'`' (left to Key_1)Toogle Notebook Area (Left Side)
SPACE En(Dis)able Obj Plot
Escape Deselects all objects
- -''' + self.app_sh_msg = _tr( + '''General Shortcut list
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
F3 SHOW SHORTCUT LIST
  
1 Switch to Project Tab
2 Switch to Selected Tab
3 Switch to Tool Tab
  
E Edit Object (if selected)
G Grid On/Off
J Jump to Coordinates
L New Excellon
M Move Obj
N New Geometry
O Set Origin
Q Change Units
P Open Properties Tool
R Rotate by 90 degree CW
S Shell Toggle
T Add a Tool (when in Geometry Selected Tab or in Tools NCC or Tools Paint)
V Zoom Fit
X Flip on X_axis
Y Flip on Y_axis
'=' Zoom Out
'-' Zoom In
  
CTRL+A Select All
CTRL+C Copy Obj
CTRL+E Open Excellon File
CTRL+G Open Gerber File
CTRL+N New Project
CTRL+M Measurement Tool
CTRL+O Open Project
CTRL+S Save Project As
CTRL+F10 Toggle Plot Area
  
SHIFT+C Copy Obj_Name
SHIFT+E Toggle Code Editor
SHIFT+G Toggle the axis
SHIFT+P Open Preferences Window
SHIFT+R Rotate by 90 degree CCW
SHIFT+S Run a Script
SHIFT+W Toggle the workspace
SHIFT+X Skew on X axis
SHIFT+Y Skew on Y axis
  
ALT+C Calculators Tool
ALT+D 2-Sided PCB Tool
ALT+K Solder Paste Dispensing Tool
ALT+L Film PCB Tool
ALT+N Non-Copper Clearing Tool
ALT+P Paint Area Tool
ALT+R Transformations Tool
ALT+S View File Source
ALT+U Cutout PCB Tool
ALT+1 Enable all Plots
ALT+2 Disable all Plots
ALT+3 Disable Non-selected Plots
ALT+F10 Toggle Full Screen
  
F1 Open Online Manual
F4 Open Online Tutorials
Del Delete Object
Del Alternate: Delete Tool
'`' (left to Key_1)Toogle Notebook Area (Left Side)
SPACE En(Dis)able Obj Plot
Escape Deselects all objects
+ + ''' + ) self.sh_app = QtWidgets.QTextEdit() self.sh_app.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) @@ -1118,206 +1136,208 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.sh_app.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.sh_hlay.addWidget(self.sh_app) - self.editor_sh_msg = '''Editor Shortcut list
-
-GEOMETRY EDITOR
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
A Draw an Arc
B Buffer Tool
C Copy Geo Item
E Polygon Intersection Tool
I Paint Tool
J Jump to Location (x, y)
K Toggle Corner Snap
M Move Geo Item
N Draw a Polygon
O Draw a Circle
P Draw a Path
R Draw Rectangle
S Polygon Substraction Tool
T Add Text Tool
U Polygon Union Tool
X Flip shape on X axis
Y Flip shape on Y axis
  
SHIFT+X Skew shape on X axis
SHIFT+Y Skew shape on Y axis
  
ALT+R Editor Transformation Tool
ALT+X Offset shape on X axis
ALT+Y Offset shape on Y axis
  
CTRL+M Measurement Tool
CTRL+S Save Object and Exit Editor
CTRL+X Polygon Cut Tool
  
Space Rotate Geometry
ENTER Finish drawing for certain tools
ESC Abort and return to Select
Del Delete Shape
-
-
-EXCELLON EDITOR
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
A Add Drill Array
C Copy Drill(s)
D Add Drill
J Jump to Location (x, y)
M Move Drill(s)
R Resize Drill(s)
T Add a new Tool
  
Del Delete Drill(s)
Del Alternate: Delete Tool(s)
  
ESC Abort and return to Select
CTRL+S Save Object and Exit Editor
- ''' + self.editor_sh_msg = _tr( + '''Editor Shortcut list
+
+ GEOMETRY EDITOR
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
A Draw an Arc
B Buffer Tool
C Copy Geo Item
E Polygon Intersection Tool
I Paint Tool
J Jump to Location (x, y)
K Toggle Corner Snap
M Move Geo Item
N Draw a Polygon
O Draw a Circle
P Draw a Path
R Draw Rectangle
S Polygon Substraction Tool
T Add Text Tool
U Polygon Union Tool
X Flip shape on X axis
Y Flip shape on Y axis
  
SHIFT+X Skew shape on X axis
SHIFT+Y Skew shape on Y axis
  
ALT+R Editor Transformation Tool
ALT+X Offset shape on X axis
ALT+Y Offset shape on Y axis
  
CTRL+M Measurement Tool
CTRL+S Save Object and Exit Editor
CTRL+X Polygon Cut Tool
  
Space Rotate Geometry
ENTER Finish drawing for certain tools
ESC Abort and return to Select
Del Delete Shape
+
+
+ EXCELLON EDITOR
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
A Add Drill Array
C Copy Drill(s)
D Add Drill
J Jump to Location (x, y)
M Move Drill(s)
R Resize Drill(s)
T Add a new Tool
  
Del Delete Drill(s)
Del Alternate: Delete Tool(s)
  
ESC Abort and return to Select
CTRL+S Save Object and Exit Editor
+ ''' + ) self.sh_editor = QtWidgets.QTextEdit() self.sh_editor.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.sh_editor.setText(self.editor_sh_msg) @@ -1330,45 +1350,45 @@ class FlatCAMGUI(QtWidgets.QMainWindow): ############################################################## self.popMenu = QtWidgets.QMenu() - self.popmenu_disable = self.popMenu.addAction(QtGui.QIcon('share/clear_plot32.png'), "Disable") + self.popmenu_disable = self.popMenu.addAction(QtGui.QIcon('share/clear_plot32.png'), _tr("Disable")) self.popMenu.addSeparator() - self.cmenu_newmenu = self.popMenu.addMenu(QtGui.QIcon('share/file32.png'), "New") - self.popmenu_new_geo = self.cmenu_newmenu.addAction(QtGui.QIcon('share/new_geo32_bis.png'), "Geometry") - self.popmenu_new_exc = self.cmenu_newmenu.addAction(QtGui.QIcon('share/new_exc32.png'), "Excellon") + self.cmenu_newmenu = self.popMenu.addMenu(QtGui.QIcon('share/file32.png'), _tr("New")) + self.popmenu_new_geo = self.cmenu_newmenu.addAction(QtGui.QIcon('share/new_geo32_bis.png'), _tr("Geometry")) + self.popmenu_new_exc = self.cmenu_newmenu.addAction(QtGui.QIcon('share/new_exc32.png'), _tr("Excellon")) self.cmenu_newmenu.addSeparator() - self.popmenu_new_prj = self.cmenu_newmenu.addAction(QtGui.QIcon('share/file16.png'), "Project") + self.popmenu_new_prj = self.cmenu_newmenu.addAction(QtGui.QIcon('share/file16.png'), _tr("Project")) self.popMenu.addSeparator() - self.cmenu_gridmenu = self.popMenu.addMenu(QtGui.QIcon('share/grid32_menu.png'), "Grids") + self.cmenu_gridmenu = self.popMenu.addMenu(QtGui.QIcon('share/grid32_menu.png'), _tr("Grids")) - self.cmenu_viewmenu = self.popMenu.addMenu(QtGui.QIcon('share/view64.png'), "View") - self.zoomfit = self.cmenu_viewmenu.addAction(QtGui.QIcon('share/zoom_fit32.png'), "Zoom Fit") - self.clearplot = self.cmenu_viewmenu.addAction(QtGui.QIcon('share/clear_plot32.png'), "Clear Plot") - self.replot = self.cmenu_viewmenu.addAction(QtGui.QIcon('share/replot32.png'), "Replot") + self.cmenu_viewmenu = self.popMenu.addMenu(QtGui.QIcon('share/view64.png'), _tr("View")) + self.zoomfit = self.cmenu_viewmenu.addAction(QtGui.QIcon('share/zoom_fit32.png'), _tr("Zoom Fit")) + self.clearplot = self.cmenu_viewmenu.addAction(QtGui.QIcon('share/clear_plot32.png'), _tr("Clear Plot")) + self.replot = self.cmenu_viewmenu.addAction(QtGui.QIcon('share/replot32.png'), _tr("Replot")) self.popMenu.addSeparator() - self.g_editor_cmenu = self.popMenu.addMenu(QtGui.QIcon('share/draw32.png'), "Geo Editor") - self.draw_line = self.g_editor_cmenu.addAction(QtGui.QIcon('share/path32.png'), "Line") - self.draw_rect = self.g_editor_cmenu.addAction(QtGui.QIcon('share/rectangle32.png'), "Rectangle") - self.draw_cut = self.g_editor_cmenu.addAction(QtGui.QIcon('share/cutpath32.png'), "Cut") + self.g_editor_cmenu = self.popMenu.addMenu(QtGui.QIcon('share/draw32.png'), _tr("Geo Editor")) + self.draw_line = self.g_editor_cmenu.addAction(QtGui.QIcon('share/path32.png'), _tr("Line")) + self.draw_rect = self.g_editor_cmenu.addAction(QtGui.QIcon('share/rectangle32.png'), _tr("Rectangle")) + self.draw_cut = self.g_editor_cmenu.addAction(QtGui.QIcon('share/cutpath32.png'), _tr("Cut")) self.g_editor_cmenu.addSeparator() - self.draw_move = self.g_editor_cmenu.addAction(QtGui.QIcon('share/move32.png'), "Move") + self.draw_move = self.g_editor_cmenu.addAction(QtGui.QIcon('share/move32.png'), _tr("Move")) - self.e_editor_cmenu = self.popMenu.addMenu(QtGui.QIcon('share/drill32.png'), "Exc Editor") - self.drill = self.e_editor_cmenu.addAction(QtGui.QIcon('share/drill32.png'), "Add Drill") - self.drill_array = self.e_editor_cmenu.addAction(QtGui.QIcon('share/addarray32.png'), "Add Drill Array") - self.drill_copy = self.e_editor_cmenu.addAction(QtGui.QIcon('share/copy32.png'), "Copy Drill(s)") + self.e_editor_cmenu = self.popMenu.addMenu(QtGui.QIcon('share/drill32.png'), _tr("Exc Editor")) + self.drill = self.e_editor_cmenu.addAction(QtGui.QIcon('share/drill32.png'), _tr("Add Drill")) + self.drill_array = self.e_editor_cmenu.addAction(QtGui.QIcon('share/addarray32.png'), _tr("Add Drill Array")) + self.drill_copy = self.e_editor_cmenu.addAction(QtGui.QIcon('share/copy32.png'), _tr("Copy Drill(s)")) self.popMenu.addSeparator() - self.popmenu_copy = self.popMenu.addAction(QtGui.QIcon('share/copy32.png'), "Copy") - self.popmenu_delete = self.popMenu.addAction(QtGui.QIcon('share/delete32.png'), "Delete") - self.popmenu_edit = self.popMenu.addAction(QtGui.QIcon('share/edit32.png'), "Edit") - self.popmenu_save = self.popMenu.addAction(QtGui.QIcon('share/floppy32.png'), "Save && Close Edit") + self.popmenu_copy = self.popMenu.addAction(QtGui.QIcon('share/copy32.png'), _tr("Copy")) + self.popmenu_delete = self.popMenu.addAction(QtGui.QIcon('share/delete32.png'), _tr("Delete")) + self.popmenu_edit = self.popMenu.addAction(QtGui.QIcon('share/edit32.png'), _tr("Edit")) + self.popmenu_save = self.popMenu.addAction(QtGui.QIcon('share/floppy32.png'), _tr("Save && Close Edit")) self.popmenu_save.setVisible(False) self.popMenu.addSeparator() - self.popmenu_move = self.popMenu.addAction(QtGui.QIcon('share/move32.png'), "Move") - self.popmenu_properties = self.popMenu.addAction(QtGui.QIcon('share/properties32.png'), "Properties") + self.popmenu_move = self.popMenu.addAction(QtGui.QIcon('share/move32.png'), _tr("Move")) + self.popmenu_properties = self.popMenu.addAction(QtGui.QIcon('share/properties32.png'), _tr("Properties")) #################################### @@ -1388,24 +1408,24 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.code_editor.setStyleSheet(stylesheet) - self.buttonPreview = QtWidgets.QPushButton('Print Preview') - self.buttonPrint = QtWidgets.QPushButton('Print Code') - self.buttonFind = QtWidgets.QPushButton('Find in Code') + self.buttonPreview = QtWidgets.QPushButton(_tr('Print Preview')) + self.buttonPrint = QtWidgets.QPushButton(_tr('Print Code')) + self.buttonFind = QtWidgets.QPushButton(_tr('Find in Code')) self.buttonFind.setFixedWidth(100) self.buttonPreview.setFixedWidth(100) self.entryFind = FCEntry() self.entryFind.setMaximumWidth(200) - self.buttonReplace = QtWidgets.QPushButton('Replace With') + self.buttonReplace = QtWidgets.QPushButton(_tr('Replace With')) self.buttonReplace.setFixedWidth(100) self.entryReplace = FCEntry() self.entryReplace.setMaximumWidth(200) - self.sel_all_cb = QtWidgets.QCheckBox('All') + self.sel_all_cb = QtWidgets.QCheckBox(_tr('All')) self.sel_all_cb.setToolTip( - "When checked it will replace all instances in the 'Find' box\n" - "with the text in the 'Replace' box.." + _tr("When checked it will replace all instances in the 'Find' box\n" + "with the text in the 'Replace' box..") ) - self.buttonOpen = QtWidgets.QPushButton('Open Code') - self.buttonSave = QtWidgets.QPushButton('Save Code') + self.buttonOpen = QtWidgets.QPushButton(_tr('Open Code')) + self.buttonSave = QtWidgets.QPushButton(_tr('Save Code')) self.cncjob_tab_layout.addWidget(self.code_editor, 0, 0, 1, 5) @@ -1440,13 +1460,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.rel_position_label = QtWidgets.QLabel( "Dx: 0.0000   Dy: 0.0000    ") self.rel_position_label.setMinimumWidth(110) - self.rel_position_label.setToolTip("Relative neasurement.\nReference is last click position") + self.rel_position_label.setToolTip(_tr("Relative neasurement.\nReference is last click position")) self.infobar.addWidget(self.rel_position_label) self.position_label = QtWidgets.QLabel( "    X: 0.0000   Y: 0.0000") self.position_label.setMinimumWidth(110) - self.position_label.setToolTip("Absolute neasurement.\nReference is (X=0, Y= 0) position") + self.position_label.setToolTip(_tr("Absolute neasurement.\nReference is (X=0, Y= 0) position")) self.infobar.addWidget(self.position_label) self.units_label = QtWidgets.QLabel("[in]") @@ -1562,123 +1582,132 @@ class FlatCAMGUI(QtWidgets.QMainWindow): ### File Toolbar ### self.file_open_gerber_btn = self.toolbarfile.addAction(QtGui.QIcon('share/flatcam_icon32.png'), - "Open GERBER") - self.file_open_excellon_btn = self.toolbarfile.addAction(QtGui.QIcon('share/drill32.png'), "Open EXCELLON") + _tr("Open Gerber")) + self.file_open_excellon_btn = self.toolbarfile.addAction(QtGui.QIcon('share/drill32.png'), _tr("Open Excellon")) self.toolbarfile.addSeparator() - self.file_open_btn = self.toolbarfile.addAction(QtGui.QIcon('share/folder32.png'), "Open project") - self.file_save_btn = self.toolbarfile.addAction(QtGui.QIcon('share/floppy32.png'), "Save project") + self.file_open_btn = self.toolbarfile.addAction(QtGui.QIcon('share/folder32.png'), _tr("Open project")) + self.file_save_btn = self.toolbarfile.addAction(QtGui.QIcon('share/floppy32.png'), _tr("Save project")) ### Edit Toolbar ### - self.newgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_geo32_bis.png'), "New Blank Geometry") - self.newexc_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_exc32.png'), "New Blank Excellon") + self.newgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_geo32_bis.png'), _tr("New Blank Geometry")) + self.newexc_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_exc32.png'), _tr("New Blank Excellon")) self.toolbargeo.addSeparator() - self.editgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/edit32.png'), "Editor") + self.editgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/edit32.png'), _tr("Editor")) self.update_obj_btn = self.toolbargeo.addAction( - QtGui.QIcon('share/edit_ok32_bis.png'), "Save Object and close the Editor" + QtGui.QIcon('share/edit_ok32_bis.png'), _tr("Save Object and close the Editor") ) self.toolbargeo.addSeparator() - self.delete_btn = self.toolbargeo.addAction(QtGui.QIcon('share/cancel_edit32.png'), "&Delete") + self.delete_btn = self.toolbargeo.addAction(QtGui.QIcon('share/cancel_edit32.png'), _tr("&Delete")) ### View Toolbar ### - self.replot_btn = self.toolbarview.addAction(QtGui.QIcon('share/replot32.png'), "&Replot") - self.clear_plot_btn = self.toolbarview.addAction(QtGui.QIcon('share/clear_plot32.png'), "&Clear plot") - self.zoom_in_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_in32.png'), "Zoom In") - self.zoom_out_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_out32.png'), "Zoom Out") - self.zoom_fit_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_fit32.png'), "Zoom Fit") + self.replot_btn = self.toolbarview.addAction(QtGui.QIcon('share/replot32.png'), _tr("&Replot")) + self.clear_plot_btn = self.toolbarview.addAction(QtGui.QIcon('share/clear_plot32.png'), _tr("&Clear plot")) + self.zoom_in_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_in32.png'), _tr("Zoom In")) + self.zoom_out_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_out32.png'), _tr("Zoom Out")) + self.zoom_fit_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_fit32.png'), _tr("Zoom Fit")) # self.toolbarview.setVisible(False) ### Shell Toolbar ### - self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), "&Command Line") + self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), _tr("&Command Line")) ### Tools Toolbar ### - self.dblsided_btn = self.toolbartools.addAction(QtGui.QIcon('share/doubleside32.png'), "2Sided Tool") - self.cutout_btn = self.toolbartools.addAction(QtGui.QIcon('share/cut16.png'), "&Cutout Tool") - self.ncc_btn = self.toolbartools.addAction(QtGui.QIcon('share/flatcam_icon32.png'), "NCC Tool") - self.paint_btn = self.toolbartools.addAction(QtGui.QIcon('share/paint20_1.png'), "Paint Tool") + self.dblsided_btn = self.toolbartools.addAction(QtGui.QIcon('share/doubleside32.png'), _tr("2Sided Tool")) + self.cutout_btn = self.toolbartools.addAction(QtGui.QIcon('share/cut16.png'), _tr("&Cutout Tool")) + self.ncc_btn = self.toolbartools.addAction(QtGui.QIcon('share/flatcam_icon32.png'), _tr("NCC Tool")) + self.paint_btn = self.toolbartools.addAction(QtGui.QIcon('share/paint20_1.png'), _tr("Paint Tool")) self.toolbartools.addSeparator() - self.panelize_btn = self.toolbartools.addAction(QtGui.QIcon('share/panel16.png'), "Panel Tool") - self.film_btn = self.toolbartools.addAction(QtGui.QIcon('share/film16.png'), "Film Tool") - self.solder_btn = self.toolbartools.addAction(QtGui.QIcon('share/solderpastebis32.png'), "SolderPaste Tool") + self.panelize_btn = self.toolbartools.addAction(QtGui.QIcon('share/panel16.png'), _tr("Panel Tool")) + self.film_btn = self.toolbartools.addAction(QtGui.QIcon('share/film16.png'), _tr("Film Tool")) + self.solder_btn = self.toolbartools.addAction(QtGui.QIcon('share/solderpastebis32.png'), + _tr("SolderPaste Tool")) self.toolbartools.addSeparator() - self.calculators_btn = self.toolbartools.addAction(QtGui.QIcon('share/calculator24.png'), "Calculators Tool") - self.transform_btn = self.toolbartools.addAction(QtGui.QIcon('share/transform.png'), "Transform Tool") + self.calculators_btn = self.toolbartools.addAction(QtGui.QIcon('share/calculator24.png'), + _tr("Calculators Tool")) + self.transform_btn = self.toolbartools.addAction(QtGui.QIcon('share/transform.png'), _tr("Transform Tool")) ### Drill Editor Toolbar ### - self.select_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), "Select") - self.add_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/plus16.png'), 'Add Drill Hole') + self.select_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _tr("Select")) + self.add_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/plus16.png'), _tr('Add Drill Hole')) self.add_drill_array_btn = self.exc_edit_toolbar.addAction( - QtGui.QIcon('share/addarray16.png'), 'Add Drill Hole Array') - self.resize_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/resize16.png'), 'Resize Drill') + QtGui.QIcon('share/addarray16.png'), _tr('Add Drill Hole Array')) + self.resize_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/resize16.png'), _tr('Resize Drill')) self.exc_edit_toolbar.addSeparator() - self.copy_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), 'Copy Drill') - self.delete_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/deleteshape32.png'), "Delete Drill") + self.copy_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), _tr('Copy Drill')) + self.delete_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/deleteshape32.png'), + _tr("Delete Drill")) self.exc_edit_toolbar.addSeparator() - self.move_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), "Move Drill") + self.move_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _tr("Move Drill")) ### Geometry Editor Toolbar ### - self.geo_select_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), "Select 'Esc'") - self.geo_add_circle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/circle32.png'), 'Add Circle') - self.geo_add_arc_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/arc32.png'), 'Add Arc') - self.geo_add_rectangle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/rectangle32.png'), 'Add Rectangle') + self.geo_select_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _tr("Select 'Esc'")) + self.geo_add_circle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/circle32.png'), _tr('Add Circle')) + self.geo_add_arc_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/arc32.png'), _tr('Add Arc')) + self.geo_add_rectangle_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/rectangle32.png'), + _tr('Add Rectangle')) self.geo_edit_toolbar.addSeparator() - self.geo_add_path_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/path32.png'), 'Add Path') - self.geo_add_polygon_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/polygon32.png'), 'Add Polygon') + self.geo_add_path_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/path32.png'), _tr('Add Path')) + self.geo_add_polygon_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/polygon32.png'), + _tr('Add Polygon')) self.geo_edit_toolbar.addSeparator() - self.geo_add_text_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/text32.png'), 'Add Text') - self.geo_add_buffer_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/buffer16-2.png'), 'Add Buffer') - self.geo_add_paint_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/paint20_1.png'), 'Paint Shape') + self.geo_add_text_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/text32.png'), _tr('Add Text')) + self.geo_add_buffer_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/buffer16-2.png'), + _tr('Add Buffer')) + self.geo_add_paint_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/paint20_1.png'), _tr('Paint Shape')) self.geo_edit_toolbar.addSeparator() - self.geo_union_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/union32.png'), 'Polygon Union') + self.geo_union_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/union32.png'), _tr('Polygon Union')) self.geo_intersection_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/intersection32.png'), - 'Polygon Intersection') - self.geo_subtract_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/subtract32.png'), 'Polygon Subtraction') + _tr('Polygon Intersection')) + self.geo_subtract_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/subtract32.png'), + _tr('Polygon Subtraction')) self.geo_edit_toolbar.addSeparator() - self.geo_cutpath_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/cutpath32.png'), 'Cut Path') - self.geo_copy_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), "Copy Objects") - self.geo_delete_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/deleteshape32.png'), "Delete Shape") - self.geo_transform_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/transform.png'), "Transformations") + self.geo_cutpath_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/cutpath32.png'), _tr('Cut Path')) + self.geo_copy_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/copy32.png'), _tr("Copy Objects")) + self.geo_delete_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/deleteshape32.png'), + _tr("Delete Shape")) + self.geo_transform_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/transform.png'), + _tr("Transformations")) self.geo_edit_toolbar.addSeparator() - self.geo_move_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), "Move Objects") + self.geo_move_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/move32.png'), _tr("Move Objects")) ### Snap Toolbar ### # Snap GRID toolbar is always active to facilitate usage of measurements done on GRID # self.addToolBar(self.snap_toolbar) - self.grid_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/grid32.png'), 'Snap to grid') + self.grid_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/grid32.png'), _tr('Snap to grid')) self.grid_gap_x_entry = FCEntry2() self.grid_gap_x_entry.setMaximumWidth(70) - self.grid_gap_x_entry.setToolTip("Grid X distance") + self.grid_gap_x_entry.setToolTip(_tr("Grid X snapping distance")) self.snap_toolbar.addWidget(self.grid_gap_x_entry) self.grid_gap_y_entry = FCEntry2() self.grid_gap_y_entry.setMaximumWidth(70) - self.grid_gap_y_entry.setToolTip("Grid Y distance") + self.grid_gap_y_entry.setToolTip(_tr("Grid Y snapping distance")) self.snap_toolbar.addWidget(self.grid_gap_y_entry) self.grid_space_label = QtWidgets.QLabel(" ") self.snap_toolbar.addWidget(self.grid_space_label) self.grid_gap_link_cb = FCCheckBox() - self.grid_gap_link_cb.setToolTip("When active, value on Grid_X\n" - "is copied to the Grid_Y value.") + self.grid_gap_link_cb.setToolTip(_tr("When active, value on Grid_X\n" + "is copied to the Grid_Y value.")) self.snap_toolbar.addWidget(self.grid_gap_link_cb) self.ois_grid = OptionalInputSection(self.grid_gap_link_cb, [self.grid_gap_y_entry], logic=False) - self.corner_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/corner32.png'), 'Snap to corner') + self.corner_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/corner32.png'), _tr('Snap to corner')) self.snap_max_dist_entry = FCEntry() self.snap_max_dist_entry.setMaximumWidth(70) - self.snap_max_dist_entry.setToolTip("Max. magnet distance") + self.snap_max_dist_entry.setToolTip(_tr("Max. magnet distance")) self.snap_magnet = self.snap_toolbar.addWidget(self.snap_max_dist_entry) self.grid_snap_btn.setCheckable(True) @@ -2023,14 +2052,14 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if self.app.geo_editor.get_selected() is not None: self.app.geo_editor.cutpath() else: - msg = 'Please first select a geometry item to be cutted\n' \ + msg = _tr('Please first select a geometry item to be cutted\n' \ 'then select the geometry item that will be cutted\n' \ 'out of the first item. In the end press ~X~ key or\n' \ - 'the toolbar button.' + 'the toolbar button.') messagebox = QtWidgets.QMessageBox() messagebox.setText(msg) - messagebox.setWindowTitle("Warning") + messagebox.setWindowTitle(_tr("Warning")) messagebox.setWindowIcon(QtGui.QIcon('share/warning.png')) messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok) messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok) @@ -2077,7 +2106,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if self.app.geo_editor.active_tool.complete: self.app.geo_editor.on_shape_complete() - self.app.inform.emit("[success]Done.") + self.app.inform.emit(_tr("[success]Done.")) # automatically make the selection tool active after completing current action self.app.geo_editor.select_tool('select') return @@ -2089,7 +2118,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if self.app.geo_editor.active_tool.complete: self.app.geo_editor.on_shape_complete() - self.app.inform.emit("[success]Done.") + self.app.inform.emit(_tr("[success]Done.")) # automatically make the selection tool active after completing current action self.app.geo_editor.select_tool('select') @@ -2097,7 +2126,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if key == QtCore.Qt.Key_Escape or key == 'Escape': # TODO: ...? # self.on_tool_select("select") - self.app.inform.emit("[WARNING_NOTCL]Cancelled.") + self.app.inform.emit(_tr("[WARNING_NOTCL]Cancelled.")) self.app.geo_editor.delete_utility_geometry() @@ -2157,12 +2186,12 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if self.app.geo_editor.get_selected() is not None: self.app.geo_editor.intersection() else: - msg = "Please select geometry items \n" \ - "on which to perform Intersection Tool." + msg = _tr("Please select geometry items \n" \ + "on which to perform Intersection Tool.") messagebox = QtWidgets.QMessageBox() messagebox.setText(msg) - messagebox.setWindowTitle("Warning") + messagebox.setWindowTitle(_tr("Warning")) messagebox.setWindowIcon(QtGui.QIcon('share/warning.png')) messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok) messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok) @@ -2215,12 +2244,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if self.app.geo_editor.get_selected() is not None: self.app.geo_editor.subtract() else: - msg = "Please select geometry items \n" \ - "on which to perform Substraction Tool." + msg = _tr( + "Please select geometry items \n" + "on which to perform Substraction Tool.") messagebox = QtWidgets.QMessageBox() messagebox.setText(msg) - messagebox.setWindowTitle("Warning") + messagebox.setWindowTitle(_tr("Warning")) messagebox.setWindowIcon(QtGui.QIcon('share/warning.png')) messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok) messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok) @@ -2235,12 +2265,12 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if self.app.geo_editor.get_selected() is not None: self.app.geo_editor.union() else: - msg = "Please select geometry items \n" \ - "on which to perform union." + msg = _tr("Please select geometry items \n" + "on which to perform union.") messagebox = QtWidgets.QMessageBox() messagebox.setText(msg) - messagebox.setWindowTitle("Warning") + messagebox.setWindowTitle(_tr("Warning")) messagebox.setWindowIcon(QtGui.QIcon('share/warning.png')) messagebox.setStandardButtons(QtWidgets.QMessageBox.Ok) messagebox.setDefaultButton(QtWidgets.QMessageBox.Ok) @@ -2290,7 +2320,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if key == QtCore.Qt.Key_Escape or key == 'Escape': # TODO: ...? # self.on_tool_select("select") - self.app.inform.emit("[WARNING_NOTCL]Cancelled.") + self.app.inform.emit(_tr("[WARNING_NOTCL]Cancelled.")) self.app.exc_editor.delete_utility_geometry() @@ -2307,7 +2337,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.app.exc_editor.delete_selected() self.app.exc_editor.replot() else: - self.app.inform.emit("[WARNING_NOTCL]Cancelled. Nothing selected to delete.") + self.app.inform.emit(_tr("[WARNING_NOTCL]Cancelled. Nothing selected to delete.")) return # Delete tools in tools table if delete key event comes from the Selected Tab @@ -2368,19 +2398,19 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if key == QtCore.Qt.Key_C or key == 'C': self.app.exc_editor.launched_from_shortcuts = True if self.app.exc_editor.selected: - self.app.inform.emit("Click on target point.") + self.app.inform.emit(_tr("Click on target point.")) self.app.ui.copy_drill_btn.setChecked(True) self.app.exc_editor.on_tool_select('drill_copy') self.app.exc_editor.active_tool.set_origin( (self.app.exc_editor.snap_x, self.app.exc_editor.snap_y)) else: - self.app.inform.emit("[WARNING_NOTCL]Cancelled. Nothing selected to copy.") + self.app.inform.emit(_tr("[WARNING_NOTCL]Cancelled. Nothing selected to copy.")) return # Add Drill Hole Tool if key == QtCore.Qt.Key_D or key == 'D': self.app.exc_editor.launched_from_shortcuts = True - self.app.inform.emit("Click on target point.") + self.app.inform.emit(_tr("Click on target point.")) self.app.ui.add_drill_btn.setChecked(True) self.app.exc_editor.x = self.app.mouse[0] @@ -2414,13 +2444,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if key == QtCore.Qt.Key_M or key == 'M': self.app.exc_editor.launched_from_shortcuts = True if self.app.exc_editor.selected: - self.app.inform.emit("Click on target point.") + self.app.inform.emit(_tr("Click on target point.")) self.app.ui.move_drill_btn.setChecked(True) self.app.exc_editor.on_tool_select('drill_move') self.app.exc_editor.active_tool.set_origin( (self.app.exc_editor.snap_x, self.app.exc_editor.snap_y)) else: - self.app.inform.emit("[WARNING_NOTCL]Cancelled. Nothing selected to move.") + self.app.inform.emit(_tr("[WARNING_NOTCL]Cancelled. Nothing selected to move.")) return # Resize Tool @@ -2434,8 +2464,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.app.exc_editor.launched_from_shortcuts = True ## Current application units in Upper Case self.units = self.general_defaults_group.general_app_group.units_radio.get_value().upper() - tool_add_popup = FCInputDialog(title="New Tool ...", - text='Enter a Tool Diameter:', + tool_add_popup = FCInputDialog(title=_tr("New Tool ..."), + text=_tr('Enter a Tool Diameter:'), min=0.0000, max=99.9999, decimals=4) tool_add_popup.setWindowIcon(QtGui.QIcon('share/letter_t_32.png')) @@ -2443,10 +2473,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow): if ok: self.app.exc_editor.on_tool_add(tooldia=val) self.app.inform.emit( - "[success]Added new tool with dia: %s %s" % ('%.4f' % float(val), str(self.units))) + _tr("[success]Added new tool with dia: %s %s") % ('%.4f' % float(val), str(self.units))) else: self.app.inform.emit( - "[WARNING_NOTCL] Adding Tool cancelled ...") + _tr("[WARNING_NOTCL] Adding Tool cancelled ...")) return # Zoom Fit @@ -2751,34 +2781,34 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box = QtWidgets.QFormLayout() # Grid X Entry - self.gridx_label = QtWidgets.QLabel('Grid X value:') + self.gridx_label = QtWidgets.QLabel(_tr('Grid X value:')) self.gridx_label.setToolTip( - "This is the Grid snap value on X axis." + _tr( "This is the Grid snap value on X axis.") ) self.gridx_entry = LengthEntry() # Grid Y Entry - self.gridy_label = QtWidgets.QLabel('Grid Y value:') + self.gridy_label = QtWidgets.QLabel(_tr('Grid Y value:')) self.gridy_label.setToolTip( - "This is the Grid snap value on Y axis." + _tr("This is the Grid snap value on Y axis.") ) self.gridy_entry = LengthEntry() # Snap Max Entry - self.snap_max_label = QtWidgets.QLabel('Snap Max:') - self.snap_max_label.setToolTip("Max. magnet distance") + self.snap_max_label = QtWidgets.QLabel(_tr('Snap Max:')) + self.snap_max_label.setToolTip(_tr("Max. magnet distance")) self.snap_max_dist_entry = FCEntry() # Workspace - self.workspace_lbl = QtWidgets.QLabel('Workspace:') + self.workspace_lbl = QtWidgets.QLabel(_tr('Workspace:')) self.workspace_lbl.setToolTip( - "Draw a delimiting rectangle on canvas.\n" - "The purpose is to illustrate the limits for our work." + _tr( "Draw a delimiting rectangle on canvas.\n" + "The purpose is to illustrate the limits for our work.") ) - self.workspace_type_lbl = QtWidgets.QLabel('Wk. format:') + self.workspace_type_lbl = QtWidgets.QLabel(_tr('Wk. format:')) self.workspace_type_lbl.setToolTip( - "Select the type of rectangle to be used on canvas,\n" - "as valid workspace." + _tr( "Select the type of rectangle to be used on canvas,\n" + "as valid workspace.") ) self.workspace_cb = FCCheckBox() self.wk_cb = FCComboBox() @@ -2790,11 +2820,11 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.wks = OptionalInputSection(self.workspace_cb, [self.workspace_type_lbl, self.wk_cb]) # Plot Fill Color - self.pf_color_label = QtWidgets.QLabel('Plot Fill:') + self.pf_color_label = QtWidgets.QLabel(_tr('Plot Fill:')) self.pf_color_label.setToolTip( - "Set the fill color for plotted objects.\n" + _tr( "Set the fill color for plotted objects.\n" "First 6 digits are the color and the last 2\n" - "digits are for alpha (transparency) level." + "digits are for alpha (transparency) level.") ) self.pf_color_entry = FCEntry() self.pf_color_button = QtWidgets.QPushButton() @@ -2806,9 +2836,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box_child_1.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) # Plot Fill Transparency Level - self.pf_alpha_label = QtWidgets.QLabel('Alpha Level:') + self.pf_alpha_label = QtWidgets.QLabel(_tr('Alpha Level:')) self.pf_alpha_label.setToolTip( - "Set the fill transparency for plotted objects." + _tr( "Set the fill transparency for plotted objects.") ) self.pf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.pf_color_alpha_slider.setMinimum(0) @@ -2825,9 +2855,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box_child_2.addWidget(self.pf_color_alpha_spinner) # Plot Line Color - self.pl_color_label = QtWidgets.QLabel('Plot Line:') + self.pl_color_label = QtWidgets.QLabel(_tr('Plot Line:')) self.pl_color_label.setToolTip( - "Set the line color for plotted objects." + _tr( "Set the line color for plotted objects.") ) self.pl_color_entry = FCEntry() self.pl_color_button = QtWidgets.QPushButton() @@ -2839,12 +2869,12 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box_child_3.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) # Plot Selection (left - right) Fill Color - self.sf_color_label = QtWidgets.QLabel('Sel. Fill:') + self.sf_color_label = QtWidgets.QLabel(_tr('Sel. Fill:')) self.sf_color_label.setToolTip( - "Set the fill color for the selection box\n" + _tr("Set the fill color for the selection box\n" "in case that the selection is done from left to right.\n" "First 6 digits are the color and the last 2\n" - "digits are for alpha (transparency) level." + "digits are for alpha (transparency) level.") ) self.sf_color_entry = FCEntry() self.sf_color_button = QtWidgets.QPushButton() @@ -2856,9 +2886,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box_child_4.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) # Plot Selection (left - right) Fill Transparency Level - self.sf_alpha_label = QtWidgets.QLabel('Alpha Level:') + self.sf_alpha_label = QtWidgets.QLabel(_tr('Alpha Level:')) self.sf_alpha_label.setToolTip( - "Set the fill transparency for the 'left to right' selection box." + _tr("Set the fill transparency for the 'left to right' selection box.") ) self.sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.sf_color_alpha_slider.setMinimum(0) @@ -2875,9 +2905,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box_child_5.addWidget(self.sf_color_alpha_spinner) # Plot Selection (left - right) Line Color - self.sl_color_label = QtWidgets.QLabel('Sel. Line:') + self.sl_color_label = QtWidgets.QLabel(_tr('Sel. Line:')) self.sl_color_label.setToolTip( - "Set the line color for the 'left to right' selection box." + _tr("Set the line color for the 'left to right' selection box.") ) self.sl_color_entry = FCEntry() self.sl_color_button = QtWidgets.QPushButton() @@ -2889,12 +2919,12 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box_child_6.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) # Plot Selection (right - left) Fill Color - self.alt_sf_color_label = QtWidgets.QLabel('Sel2. Fill:') + self.alt_sf_color_label = QtWidgets.QLabel(_tr('Sel2. Fill:')) self.alt_sf_color_label.setToolTip( - "Set the fill color for the selection box\n" + _tr("Set the fill color for the selection box\n" "in case that the selection is done from right to left.\n" "First 6 digits are the color and the last 2\n" - "digits are for alpha (transparency) level." + "digits are for alpha (transparency) level.") ) self.alt_sf_color_entry = FCEntry() self.alt_sf_color_button = QtWidgets.QPushButton() @@ -2906,9 +2936,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box_child_7.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) # Plot Selection (right - left) Fill Transparency Level - self.alt_sf_alpha_label = QtWidgets.QLabel('Alpha Level:') + self.alt_sf_alpha_label = QtWidgets.QLabel(_tr('Alpha Level:')) self.alt_sf_alpha_label.setToolTip( - "Set the fill transparency for selection 'right to left' box." + _tr("Set the fill transparency for selection 'right to left' box.") ) self.alt_sf_color_alpha_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.alt_sf_color_alpha_slider.setMinimum(0) @@ -2925,9 +2955,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box_child_8.addWidget(self.alt_sf_color_alpha_spinner) # Plot Selection (right - left) Line Color - self.alt_sl_color_label = QtWidgets.QLabel('Sel2. Line:') + self.alt_sl_color_label = QtWidgets.QLabel(_tr('Sel2. Line:')) self.alt_sl_color_label.setToolTip( - "Set the line color for the 'right to left' selection box." + _tr("Set the line color for the 'right to left' selection box.") ) self.alt_sl_color_entry = FCEntry() self.alt_sl_color_button = QtWidgets.QPushButton() @@ -2939,9 +2969,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box_child_9.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) # Editor Draw Color - self.draw_color_label = QtWidgets.QLabel('Editor Draw:') + self.draw_color_label = QtWidgets.QLabel(_tr('Editor Draw:')) self.alt_sf_color_label.setToolTip( - "Set the color for the shape." + _tr("Set the color for the shape.") ) self.draw_color_entry = FCEntry() self.draw_color_button = QtWidgets.QPushButton() @@ -2953,9 +2983,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.form_box_child_10.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) # Editor Draw Selection Color - self.sel_draw_color_label = QtWidgets.QLabel('Editor Draw Sel.:') + self.sel_draw_color_label = QtWidgets.QLabel(_tr('Editor Draw Sel.:')) self.sel_draw_color_label.setToolTip( - "Set the color of the shape when selected." + _tr("Set the color of the shape when selected.") ) self.sel_draw_color_entry = FCEntry() self.sel_draw_color_button = QtWidgets.QPushButton() @@ -3002,29 +3032,29 @@ class GeneralGUISetGroupUI(OptionsGroupUI): def __init__(self, parent=None): super(GeneralGUISetGroupUI, self).__init__(self) - self.setTitle(str("GUI Settings")) + self.setTitle(str(_tr("GUI Settings"))) # Create a form layout for the Application general settings self.form_box = QtWidgets.QFormLayout() # Layout selection - self.layout_label = QtWidgets.QLabel('Layout:') + self.layout_label = QtWidgets.QLabel(_tr('Layout:')) self.layout_label.setToolTip( - "Select an layout for FlatCAM.\n" - "It is applied immediately." + _tr("Select an layout for FlatCAM.\n" + "It is applied immediately.") ) self.layout_combo = FCComboBox() - self.layout_combo.addItem("Choose ...") - self.layout_combo.addItem("Standard") - self.layout_combo.addItem("Compact") + self.layout_combo.addItem(_tr("Choose ...")) + self.layout_combo.addItem(_tr("Standard")) + self.layout_combo.addItem(_tr("Compact")) self.layout_combo.setCurrentIndex(0) # Style selection - self.style_label = QtWidgets.QLabel('Style:') + self.style_label = QtWidgets.QLabel(_tr('Style:')) self.style_label.setToolTip( - "Select an style for FlatCAM.\n" - "It will be applied at the next app start." + _tr("Select an style for FlatCAM.\n" + "It will be applied at the next app start.") ) self.style_combo = FCComboBox() self.style_combo.addItems(QtWidgets.QStyleFactory.keys()) @@ -3034,12 +3064,13 @@ class GeneralGUISetGroupUI(OptionsGroupUI): self.style_combo.activated[str].connect(self.handle_style) # Enable High DPI Support - self.hdpi_label = QtWidgets.QLabel('HDPI Support:') + self.hdpi_label = QtWidgets.QLabel(_tr('HDPI Support:')) self.hdpi_label.setToolTip( - "Enable High DPI support for FlatCAM.\n" - "It will be applied at the next app start." + _tr("Enable High DPI support for FlatCAM.\n" + "It will be applied at the next app start.") ) self.hdpi_cb = FCCheckBox() + settings = QSettings("Open Source", "FlatCAM") if settings.contains("hdpi"): self.hdpi_cb.set_value(settings.value('hdpi', type=int)) @@ -3048,20 +3079,20 @@ class GeneralGUISetGroupUI(OptionsGroupUI): self.hdpi_cb.stateChanged.connect(self.handle_hdpi) # Clear Settings - self.clear_label = QtWidgets.QLabel('Clear GUI Settings:') + self.clear_label = QtWidgets.QLabel(_tr('Clear GUI Settings:')) self.clear_label.setToolTip( - "Clear the GUI settings for FlatCAM,\n" - "such as: layout, gui state, style, hdpi support etc." + _tr("Clear the GUI settings for FlatCAM,\n" + "such as: layout, gui state, style, hdpi support etc.") ) - self.clear_btn = FCButton("Clear") + self.clear_btn = FCButton(_tr("Clear")) self.clear_btn.clicked.connect(self.handle_clear) # Enable Hover box - self.hover_label = QtWidgets.QLabel('Hover Shape:') + self.hover_label = QtWidgets.QLabel(_tr('Hover Shape:')) self.hover_label.setToolTip( - "Enable display of a hover shape for FlatCAM objects.\n" + _tr("Enable display of a hover shape for FlatCAM objects.\n" "It is displayed whenever the mouse cursor is hovering\n" - "over any kind of not-selected object." + "over any kind of not-selected object.") ) self.hover_cb = FCCheckBox() @@ -3100,10 +3131,10 @@ class GeneralGUISetGroupUI(OptionsGroupUI): def handle_clear(self): msgbox = QtWidgets.QMessageBox() # msgbox.setText("Save changes ...") - msgbox.setText("Are you sure you want to delete the GUI Settings? " - "\n" + msgbox.setText(_tr("Are you sure you want to delete the GUI Settings? " + "\n") ) - msgbox.setWindowTitle("Clear GUI Settings") + msgbox.setWindowTitle(_tr("Clear GUI Settings")) msgbox.setWindowIcon(QtGui.QIcon('share/trash32.png')) msgbox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) msgbox.setDefaultButton(QtWidgets.QMessageBox.No) @@ -3116,131 +3147,131 @@ class GeneralGUISetGroupUI(OptionsGroupUI): settings.remove(key) # This will write the setting to the platform specific storage. del settings - self.app.inform.emit("[success] GUI settings deleted ...") + self.app.inform.emit(_tr("[success] GUI settings deleted ...")) class GeneralAppPrefGroupUI(OptionsGroupUI): def __init__(self, parent=None): super(GeneralAppPrefGroupUI, self).__init__(self) - self.setTitle(str("App Preferences")) + self.setTitle(str(_tr("App Preferences"))) # Create a form layout for the Application general settings self.form_box = QtWidgets.QFormLayout() # Units for FlatCAM - self.unitslabel = QtWidgets.QLabel('Units:') - self.unitslabel.setToolTip("The default value for FlatCAM units.\n" + self.unitslabel = QtWidgets.QLabel(_tr('Units:')) + self.unitslabel.setToolTip(_tr("The default value for FlatCAM units.\n" "Whatever is selected here is set every time\n" - "FLatCAM is started.") + "FLatCAM is started.")) self.units_radio = RadioSet([{'label': 'IN', 'value': 'IN'}, {'label': 'MM', 'value': 'MM'}]) # Application Level for FlatCAM - self.app_level_label = QtWidgets.QLabel('APP. LEVEL:') - self.app_level_label.setToolTip("Choose the default level of usage for FlatCAM.\n" + self.app_level_label = QtWidgets.QLabel(_tr('APP. LEVEL:')) + self.app_level_label.setToolTip(_tr("Choose the default level of usage for FlatCAM.\n" "BASIC level -> reduced functionality, best for beginner's.\n" "ADVANCED level -> full functionality.\n\n" "The choice here will influence the parameters in\n" - "the Selected Tab for all kinds of FlatCAM objects.") - self.app_level_radio = RadioSet([{'label': 'Basic', 'value': 'b'}, - {'label': 'Advanced', 'value': 'a'}]) + "the Selected Tab for all kinds of FlatCAM objects.")) + self.app_level_radio = RadioSet([{'label': _tr('Basic'), 'value': 'b'}, + {'label': _tr('Advanced'), 'value': 'a'}]) # Languages for FlatCAM - self.languagelabel = QtWidgets.QLabel('Languages:') - self.languagelabel.setToolTip("Set the language used throughout FlatCAM.") + self.languagelabel = QtWidgets.QLabel(_tr('Languages:')) + self.languagelabel.setToolTip(_tr("Set the language used throughout FlatCAM.")) self.language_cb = FCComboBox() self.languagespace = QtWidgets.QLabel('') - self.language_apply_btn = FCButton("Apply Language") + self.language_apply_btn = FCButton(_tr("Apply Language")) # Shell StartUp CB - self.shell_startup_label = QtWidgets.QLabel('Shell at StartUp:') + self.shell_startup_label = QtWidgets.QLabel(_tr('Shell at StartUp:')) self.shell_startup_label.setToolTip( - "Check this box if you want the shell to\n" - "start automatically at startup." + _tr("Check this box if you want the shell to\n" + "start automatically at startup.") ) self.shell_startup_cb = FCCheckBox(label='') self.shell_startup_cb.setToolTip( - "Check this box if you want the shell to\n" - "start automatically at startup." + _tr("Check this box if you want the shell to\n" + "start automatically at startup.") ) # Version Check CB - self.version_check_label = QtWidgets.QLabel('Version Check:') + self.version_check_label = QtWidgets.QLabel(_tr('Version Check:')) self.version_check_label.setToolTip( - "Check this box if you want to check\n" - "for a new version automatically at startup." + _tr("Check this box if you want to check\n" + "for a new version automatically at startup.") ) self.version_check_cb = FCCheckBox(label='') self.version_check_cb.setToolTip( - "Check this box if you want to check\n" - "for a new version automatically at startup." + _tr("Check this box if you want to check\n" + "for a new version automatically at startup.") ) # Send Stats CB - self.send_stats_label = QtWidgets.QLabel('Send Stats:') + self.send_stats_label = QtWidgets.QLabel(_tr('Send Stats:')) self.send_stats_label.setToolTip( - "Check this box if you agree to send anonymous\n" - "stats automatically at startup, to help improve FlatCAM." + _tr("Check this box if you agree to send anonymous\n" + "stats automatically at startup, to help improve FlatCAM.") ) self.send_stats_cb= FCCheckBox(label='') self.send_stats_cb.setToolTip( - "Check this box if you agree to send anonymous\n" - "stats automatically at startup, to help improve FlatCAM." + _tr("Check this box if you agree to send anonymous\n" + "stats automatically at startup, to help improve FlatCAM.") ) self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb]) # Select mouse pan button - self.panbuttonlabel = QtWidgets.QLabel('Pan Button:') - self.panbuttonlabel.setToolTip("Select the mouse button to use for panning:\n" + self.panbuttonlabel = QtWidgets.QLabel(_tr('Pan Button:')) + self.panbuttonlabel.setToolTip(_tr("Select the mouse button to use for panning:\n" "- MMB --> Middle Mouse Button\n" - "- RMB --> Right Mouse Button") - self.pan_button_radio = RadioSet([{'label': 'MMB', 'value': '3'}, - {'label': 'RMB', 'value': '2'}]) + "- RMB --> Right Mouse Button")) + self.pan_button_radio = RadioSet([{'label': _tr('MMB'), 'value': '3'}, + {'label': _tr('RMB'), 'value': '2'}]) # Multiple Selection Modifier Key - self.mselectlabel = QtWidgets.QLabel('Multiple Sel:') - self.mselectlabel.setToolTip("Select the key used for multiple selection.") - self.mselect_radio = RadioSet([{'label': 'CTRL', 'value': 'Control'}, - {'label': 'SHIFT', 'value': 'Shift'}]) + self.mselectlabel = QtWidgets.QLabel(_tr('Multiple Sel:')) + self.mselectlabel.setToolTip(_tr("Select the key used for multiple selection.")) + self.mselect_radio = RadioSet([{'label': _tr('CTRL'), 'value': 'Control'}, + {'label': _tr('SHIFT'), 'value': 'Shift'}]) # Project at StartUp CB - self.project_startup_label = QtWidgets.QLabel('Project at StartUp:') + self.project_startup_label = QtWidgets.QLabel(_tr('Project at StartUp:')) self.project_startup_label.setToolTip( - "Check this box if you want the project/selected/tool tab area to\n" - "to be shown automatically at startup." + _tr("Check this box if you want the project/selected/tool tab area to\n" + "to be shown automatically at startup.") ) self.project_startup_cb = FCCheckBox(label='') self.project_startup_cb.setToolTip( - "Check this box if you want the project/selected/tool tab area to\n" - "to be shown automatically at startup." + _tr("Check this box if you want the project/selected/tool tab area to\n" + "to be shown automatically at startup.") ) # Project autohide CB - self.project_autohide_label = QtWidgets.QLabel('Project AutoHide:') + self.project_autohide_label = QtWidgets.QLabel(_tr('Project AutoHide:')) self.project_autohide_label.setToolTip( - "Check this box if you want the project/selected/tool tab area to\n" + _tr( "Check this box if you want the project/selected/tool tab area to\n" "hide automatically when there are no objects loaded and\n" - "to show whenever a new object is created." + "to show whenever a new object is created.") ) self.project_autohide_cb = FCCheckBox(label='') self.project_autohide_cb.setToolTip( - "Check this box if you want the project/selected/tool tab area to\n" + _tr("Check this box if you want the project/selected/tool tab area to\n" "hide automatically when there are no objects loaded and\n" - "to show whenever a new object is created." + "to show whenever a new object is created.") ) # Enable/Disable ToolTips globally - self.toggle_tooltips_label = QtWidgets.QLabel('Enable ToolTips:') + self.toggle_tooltips_label = QtWidgets.QLabel(_tr('Enable ToolTips:')) self.toggle_tooltips_label.setToolTip( - "Check this box if you want to have toolTips displayed\n" - "when hovering with mouse over items throughout the App." + _tr( "Check this box if you want to have toolTips displayed\n" + "when hovering with mouse over items throughout the App.") ) self.toggle_tooltips_cb = FCCheckBox(label='') self.toggle_tooltips_cb.setToolTip( - "Check this box if you want to have toolTips displayed\n" - "when hovering with mouse over items throughout the App." + _tr( "Check this box if you want to have toolTips displayed\n" + "when hovering with mouse over items throughout the App.") ) # Just to add empty rows @@ -3273,10 +3304,10 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): # hlay.addStretch() # Save compressed project CB - self.save_type_cb = FCCheckBox('Save Compressed Project') + self.save_type_cb = FCCheckBox(_tr('Save Compressed Project')) self.save_type_cb.setToolTip( - "Whether to save a compressed or uncompressed project.\n" - "When checked it will save a compressed FlatCAM project." + _tr("Whether to save a compressed or uncompressed project.\n" + "When checked it will save a compressed FlatCAM project.") ) # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft) self.layout.addWidget(self.save_type_cb) @@ -3286,11 +3317,11 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): # Project LZMA Comppression Level self.compress_combo = FCComboBox() - self.compress_label = QtWidgets.QLabel('Compress Level:') + self.compress_label = QtWidgets.QLabel(_tr('Compression Level:')) self.compress_label.setToolTip( - "The level of compression used when saving\n" + _tr("The level of compression used when saving\n" "a FlatCAM project. Higher value means better compression\n" - "but require more RAM and time." + "but require more RAM usage and more processing time.") ) # self.advanced_cb.setLayoutDirection(QtCore.Qt.RightToLeft) self.compress_combo.addItems([str(i) for i in range(10)]) @@ -3314,38 +3345,38 @@ class GerberGenPrefGroupUI(OptionsGroupUI): self.setTitle(str("Gerber General")) ## Plot options - self.plot_options_label = QtWidgets.QLabel("Plot Options:") + self.plot_options_label = QtWidgets.QLabel(_tr("Plot Options:")) self.layout.addWidget(self.plot_options_label) grid0 = QtWidgets.QGridLayout() self.layout.addLayout(grid0) # Solid CB - self.solid_cb = FCCheckBox(label='Solid') + self.solid_cb = FCCheckBox(label=_tr('Solid')) self.solid_cb.setToolTip( - "Solid color polygons." + _tr("Solid color polygons.") ) grid0.addWidget(self.solid_cb, 0, 0) # Multicolored CB - self.multicolored_cb = FCCheckBox(label='M-Color') + self.multicolored_cb = FCCheckBox(label=_tr('M-Color')) self.multicolored_cb.setToolTip( - "Draw polygons in different colors." + _tr("Draw polygons in different colors.") ) grid0.addWidget(self.multicolored_cb, 0, 1) # Plot CB - self.plot_cb = FCCheckBox(label='Plot') + self.plot_cb = FCCheckBox(label=_tr('Plot')) self.plot_options_label.setToolTip( - "Plot (show) this object." + _tr("Plot (show) this object.") ) grid0.addWidget(self.plot_cb, 0, 2) # Number of circle steps for circular aperture linear approximation - self.circle_steps_label = QtWidgets.QLabel("Circle Steps:") + self.circle_steps_label = QtWidgets.QLabel(_tr("Circle Steps:")) self.circle_steps_label.setToolTip( - "The number of circle steps for Gerber \n" - "circular aperture linear approximation." + _tr("The number of circle steps for Gerber \n" + "circular aperture linear approximation.") ) grid0.addWidget(self.circle_steps_label, 1, 0) self.circle_steps_entry = IntEntry() @@ -3359,14 +3390,14 @@ class GerberOptPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent) super(GerberOptPrefGroupUI, self).__init__(self) - self.setTitle(str("Gerber Options")) + self.setTitle(str(_tr("Gerber Options"))) ## Isolation Routing - self.isolation_routing_label = QtWidgets.QLabel("Isolation Routing:") + self.isolation_routing_label = QtWidgets.QLabel(_tr("Isolation Routing:")) self.isolation_routing_label.setToolTip( - "Create a Geometry object with\n" - "toolpaths to cut outside polygons." + _tr("Create a Geometry object with\n" + "toolpaths to cut outside polygons.") ) self.layout.addWidget(self.isolation_routing_label) @@ -3374,58 +3405,58 @@ class GerberOptPrefGroupUI(OptionsGroupUI): grid0 = QtWidgets.QGridLayout() self.layout.addLayout(grid0) - tdlabel = QtWidgets.QLabel('Tool dia:') + tdlabel = QtWidgets.QLabel(_tr('Tool dia:')) tdlabel.setToolTip( - "Diameter of the cutting tool." + _tr("Diameter of the cutting tool.") ) grid0.addWidget(tdlabel, 0, 0) self.iso_tool_dia_entry = LengthEntry() grid0.addWidget(self.iso_tool_dia_entry, 0, 1) # Nr of passes - passlabel = QtWidgets.QLabel('Width (# passes):') + passlabel = QtWidgets.QLabel(_tr('Width (# passes):')) passlabel.setToolTip( - "Width of the isolation gap in\n" - "number (integer) of tool widths." + _tr("Width of the isolation gap in\n" + "number (integer) of tool widths.") ) grid0.addWidget(passlabel, 1, 0) self.iso_width_entry = IntEntry() grid0.addWidget(self.iso_width_entry, 1, 1) # Pass overlap - overlabel = QtWidgets.QLabel('Pass overlap:') + overlabel = QtWidgets.QLabel(_tr('Pass overlap:')) overlabel.setToolTip( - "How much (fraction) of the tool width to overlap each tool pass.\n" + _tr("How much (fraction) of the tool width to overlap each tool pass.\n" "Example:\n" - "A value here of 0.25 means an overlap of 25% from the tool diameter found above." + "A value here of 0.25 means an overlap of 25% from the tool diameter found above.") ) grid0.addWidget(overlabel, 2, 0) self.iso_overlap_entry = FloatEntry() grid0.addWidget(self.iso_overlap_entry, 2, 1) - milling_type_label = QtWidgets.QLabel('Milling Type:') + milling_type_label = QtWidgets.QLabel(_tr('Milling Type:')) milling_type_label.setToolTip( - "Milling type:\n" + _tr("Milling type:\n" "- climb / best for precision milling and to reduce tool usage\n" - "- conventional / useful when there is no backlash compensation" + "- conventional / useful when there is no backlash compensation") ) grid0.addWidget(milling_type_label, 3, 0) - self.milling_type_radio = RadioSet([{'label': 'Climb', 'value': 'cl'}, - {'label': 'Conv.', 'value': 'cv'}]) + self.milling_type_radio = RadioSet([{'label': _tr('Climb'), 'value': 'cl'}, + {'label': _tr('Conv.'), 'value': 'cv'}]) grid0.addWidget(self.milling_type_radio, 3, 1) # Combine passes - self.combine_passes_cb = FCCheckBox(label='Combine Passes') + self.combine_passes_cb = FCCheckBox(label=_tr('Combine Passes')) self.combine_passes_cb.setToolTip( - "Combine all passes into one object" + _tr("Combine all passes into one object") ) grid0.addWidget(self.combine_passes_cb, 4, 0) ## Clear non-copper regions - self.clearcopper_label = QtWidgets.QLabel("Clear non-copper:") + self.clearcopper_label = QtWidgets.QLabel(_tr("Clear non-copper:")) self.clearcopper_label.setToolTip( - "Create a Geometry object with\n" - "toolpaths to cut all non-copper regions." + _tr("Create a Geometry object with\n" + "toolpaths to cut all non-copper regions.") ) self.layout.addWidget(self.clearcopper_label) @@ -3433,47 +3464,47 @@ class GerberOptPrefGroupUI(OptionsGroupUI): self.layout.addLayout(grid1) # Margin - bmlabel = QtWidgets.QLabel('Boundary Margin:') + bmlabel = QtWidgets.QLabel(_tr('Boundary Margin:')) bmlabel.setToolTip( - "Specify the edge of the PCB\n" + _tr("Specify the edge of the PCB\n" "by drawing a box around all\n" "objects with this minimum\n" - "distance." + "distance.") ) grid1.addWidget(bmlabel, 0, 0) self.noncopper_margin_entry = LengthEntry() grid1.addWidget(self.noncopper_margin_entry, 0, 1) # Rounded corners - self.noncopper_rounded_cb = FCCheckBox(label="Rounded corners") + self.noncopper_rounded_cb = FCCheckBox(label=_tr("Rounded corners")) self.noncopper_rounded_cb.setToolTip( - "Creates a Geometry objects with polygons\n" - "covering the copper-free areas of the PCB." + _tr("Creates a Geometry objects with polygons\n" + "covering the copper-free areas of the PCB.") ) grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2) ## Bounding box - self.boundingbox_label = QtWidgets.QLabel('Bounding Box:') + self.boundingbox_label = QtWidgets.QLabel(_tr('Bounding Box:')) self.layout.addWidget(self.boundingbox_label) grid2 = QtWidgets.QGridLayout() self.layout.addLayout(grid2) - bbmargin = QtWidgets.QLabel('Boundary Margin:') + bbmargin = QtWidgets.QLabel(_tr('Boundary Margin:')) bbmargin.setToolTip( - "Distance of the edges of the box\n" - "to the nearest polygon." + _tr("Distance of the edges of the box\n" + "to the nearest polygon.") ) grid2.addWidget(bbmargin, 0, 0) self.bbmargin_entry = LengthEntry() grid2.addWidget(self.bbmargin_entry, 0, 1) - self.bbrounded_cb = FCCheckBox(label="Rounded corners") + self.bbrounded_cb = FCCheckBox(label=_tr("Rounded corners")) self.bbrounded_cb.setToolTip( - "If the bounding box is \n" + _tr("If the bounding box is \n" "to have rounded corners\n" "their radius is equal to\n" - "the margin." + "the margin.") ) grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2) self.layout.addStretch() @@ -3484,15 +3515,15 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent) super(GerberAdvOptPrefGroupUI, self).__init__(self) - self.setTitle(str("Gerber Adv. Options")) + self.setTitle(str(_tr("Gerber Adv. Options"))) ## Advanced Gerber Parameters - self.adv_param_label = QtWidgets.QLabel("Advanced Param.:") + self.adv_param_label = QtWidgets.QLabel(_tr("Advanced Param.:")) self.adv_param_label.setToolTip( - "A list of Gerber advanced parameters.\n" + _tr("A list of Gerber advanced parameters.\n" "Those parameters are available only for\n" - "Advanced App. Level." + "Advanced App. Level.") ) self.layout.addWidget(self.adv_param_label) @@ -3500,31 +3531,31 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): self.layout.addLayout(grid0) # Follow Attribute - self.follow_cb = FCCheckBox(label='"Follow"') + self.follow_cb = FCCheckBox(label=_tr('"Follow"')) self.follow_cb.setToolTip( - "Generate a 'Follow' geometry.\n" + _tr("Generate a 'Follow' geometry.\n" "This means that it will cut through\n" - "the middle of the trace." + "the middle of the trace.") ) grid0.addWidget(self.follow_cb, 0, 0) # Aperture Table Visibility CB - self.aperture_table_visibility_cb = FCCheckBox(label='Table Show/Hide') + self.aperture_table_visibility_cb = FCCheckBox(label=_tr('Table Show/Hide')) self.aperture_table_visibility_cb.setToolTip( - "Toggle the display of the Gerber Apertures Table.\n" + _tr("Toggle the display of the Gerber Apertures Table.\n" "Also, on hide, it will delete all mark shapes\n" - "that are drawn on canvas." + "that are drawn on canvas.") ) grid0.addWidget(self.aperture_table_visibility_cb, 1, 0) # Scale Aperture Factor - self.scale_aperture_label = QtWidgets.QLabel('Ap. Scale Factor:') + self.scale_aperture_label = QtWidgets.QLabel(_tr('Ap. Scale Factor:')) self.scale_aperture_label.setToolTip( - "Change the size of the selected apertures.\n" + _tr("Change the size of the selected apertures.\n" "Factor by which to multiply\n" - "geometric features of this object." + "geometric features of this object.") ) grid0.addWidget(self.scale_aperture_label, 2, 0) @@ -3532,11 +3563,11 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.scale_aperture_entry, 2, 1) # Buffer Aperture Factor - self.buffer_aperture_label = QtWidgets.QLabel('Ap. Buffer Factor:') + self.buffer_aperture_label = QtWidgets.QLabel(_tr('Ap. Buffer Factor:')) self.buffer_aperture_label.setToolTip( - "Change the size of the selected apertures.\n" + _tr("Change the size of the selected apertures.\n" "Factor by which to expand/shrink\n" - "geometric features of this object." + "geometric features of this object.") ) grid0.addWidget(self.buffer_aperture_label, 3, 0) @@ -3552,31 +3583,31 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent) super(ExcellonGenPrefGroupUI, self).__init__(self) - self.setTitle(str("Excellon General")) + self.setTitle(str(_tr("Excellon General"))) # Plot options - self.plot_options_label = QtWidgets.QLabel("Plot Options:") + self.plot_options_label = QtWidgets.QLabel(_tr("Plot Options:")) self.layout.addWidget(self.plot_options_label) grid1 = QtWidgets.QGridLayout() self.layout.addLayout(grid1) - self.plot_cb = FCCheckBox(label='Plot') + self.plot_cb = FCCheckBox(label=_tr('Plot')) self.plot_cb.setToolTip( "Plot (show) this object." ) grid1.addWidget(self.plot_cb, 0, 0) - self.solid_cb = FCCheckBox(label='Solid') + self.solid_cb = FCCheckBox(label=_tr('Solid')) self.solid_cb.setToolTip( "Plot as solid circles." ) grid1.addWidget(self.solid_cb, 0, 1) # Excellon format - self.excellon_format_label = QtWidgets.QLabel("Excellon Format:") + self.excellon_format_label = QtWidgets.QLabel(_tr("Excellon Format:")) self.excellon_format_label.setToolTip( - "The NC drill files, usually named Excellon files\n" + _tr("The NC drill files, usually named Excellon files\n" "are files that can be found in different formats.\n" "Here we set the format used when the provided\n" "coordinates are not using period.\n" @@ -3595,16 +3626,16 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): "ALTIUM 2:4 INCH LZ\n" "Sprint Layout 2:4 INCH LZ" "\n" - "KiCAD 3:5 INCH TZ" + "KiCAD 3:5 INCH TZ") ) self.layout.addWidget(self.excellon_format_label) hlay1 = QtWidgets.QHBoxLayout() self.layout.addLayout(hlay1) - self.excellon_format_in_label = QtWidgets.QLabel("INCH:") + self.excellon_format_in_label = QtWidgets.QLabel(_tr("INCH:")) self.excellon_format_in_label.setAlignment(QtCore.Qt.AlignLeft) self.excellon_format_in_label.setToolTip( - "Default values for INCH are 2:4") + _tr("Default values for INCH are 2:4")) hlay1.addWidget(self.excellon_format_in_label, QtCore.Qt.AlignLeft) self.excellon_format_upper_in_entry = IntEntry() @@ -3612,8 +3643,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): self.excellon_format_upper_in_entry.setAlignment(QtCore.Qt.AlignRight) self.excellon_format_upper_in_entry.setFixedWidth(30) self.excellon_format_upper_in_entry.setToolTip( - "This numbers signify the number of digits in\n" - "the whole part of Excellon coordinates." + _tr( "This numbers signify the number of digits in\n" + "the whole part of Excellon coordinates.") ) hlay1.addWidget(self.excellon_format_upper_in_entry, QtCore.Qt.AlignLeft) @@ -3626,18 +3657,18 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): self.excellon_format_lower_in_entry.setAlignment(QtCore.Qt.AlignRight) self.excellon_format_lower_in_entry.setFixedWidth(30) self.excellon_format_lower_in_entry.setToolTip( - "This numbers signify the number of digits in\n" - "the decimal part of Excellon coordinates." + _tr("This numbers signify the number of digits in\n" + "the decimal part of Excellon coordinates.") ) hlay1.addWidget(self.excellon_format_lower_in_entry, QtCore.Qt.AlignLeft) hlay1.addStretch() hlay2 = QtWidgets.QHBoxLayout() self.layout.addLayout(hlay2) - self.excellon_format_mm_label = QtWidgets.QLabel("METRIC:") + self.excellon_format_mm_label = QtWidgets.QLabel(_tr("METRIC:")) self.excellon_format_mm_label.setAlignment(QtCore.Qt.AlignLeft) self.excellon_format_mm_label.setToolTip( - "Default values for METRIC are 3:3") + _tr("Default values for METRIC are 3:3")) hlay2.addWidget(self.excellon_format_mm_label, QtCore.Qt.AlignLeft) self.excellon_format_upper_mm_entry = IntEntry() @@ -3645,8 +3676,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): self.excellon_format_upper_mm_entry.setAlignment(QtCore.Qt.AlignRight) self.excellon_format_upper_mm_entry.setFixedWidth(30) self.excellon_format_upper_mm_entry.setToolTip( - "This numbers signify the number of digits in\n" - "the whole part of Excellon coordinates." + _tr("This numbers signify the number of digits in\n" + "the whole part of Excellon coordinates.") ) hlay2.addWidget(self.excellon_format_upper_mm_entry, QtCore.Qt.AlignLeft) @@ -3659,8 +3690,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): self.excellon_format_lower_mm_entry.setAlignment(QtCore.Qt.AlignRight) self.excellon_format_lower_mm_entry.setFixedWidth(30) self.excellon_format_lower_mm_entry.setToolTip( - "This numbers signify the number of digits in\n" - "the decimal part of Excellon coordinates." + _tr("This numbers signify the number of digits in\n" + "the decimal part of Excellon coordinates.") ) hlay2.addWidget(self.excellon_format_lower_mm_entry, QtCore.Qt.AlignLeft) hlay2.addStretch() @@ -3668,27 +3699,27 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): hlay3 = QtWidgets.QHBoxLayout() self.layout.addLayout(hlay3) - self.excellon_zeros_label = QtWidgets.QLabel('Default Zeros:') + self.excellon_zeros_label = QtWidgets.QLabel(_tr('Default Zeros:')) self.excellon_zeros_label.setAlignment(QtCore.Qt.AlignLeft) self.excellon_zeros_label.setToolTip( - "This sets the type of Excellon zeros.\n" + _tr("This sets the type of Excellon zeros.\n" "If LZ then Leading Zeros are kept and\n" "Trailing Zeros are removed.\n" "If TZ is checked then Trailing Zeros are kept\n" - "and Leading Zeros are removed." + "and Leading Zeros are removed.") ) hlay3.addWidget(self.excellon_zeros_label) - self.excellon_zeros_radio = RadioSet([{'label': 'LZ', 'value': 'L'}, - {'label': 'TZ', 'value': 'T'}]) + self.excellon_zeros_radio = RadioSet([{'label': _tr('LZ'), 'value': 'L'}, + {'label': _tr('TZ'), 'value': 'T'}]) self.excellon_zeros_radio.setToolTip( - "This sets the default type of Excellon zeros.\n" + _tr("This sets the default type of Excellon zeros.\n" "If it is not detected in the parsed file the value here\n" "will be used." "If LZ then Leading Zeros are kept and\n" "Trailing Zeros are removed.\n" "If TZ is checked then Trailing Zeros are kept\n" - "and Leading Zeros are removed." + "and Leading Zeros are removed.") ) hlay3.addStretch() hlay3.addWidget(self.excellon_zeros_radio, QtCore.Qt.AlignRight) @@ -3696,23 +3727,23 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): hlay4 = QtWidgets.QHBoxLayout() self.layout.addLayout(hlay4) - self.excellon_units_label = QtWidgets.QLabel('Default Units:') + self.excellon_units_label = QtWidgets.QLabel(_tr('Default Units:')) self.excellon_units_label.setAlignment(QtCore.Qt.AlignLeft) self.excellon_units_label.setToolTip( - "This sets the default units of Excellon files.\n" + _tr("This sets the default units of Excellon files.\n" "If it is not detected in the parsed file the value here\n" "will be used." "Some Excellon files don't have an header\n" - "therefore this parameter will be used.\n" + "therefore this parameter will be used.") ) hlay4.addWidget(self.excellon_units_label) - self.excellon_units_radio = RadioSet([{'label': 'INCH', 'value': 'INCH'}, - {'label': 'MM', 'value': 'METRIC'}]) + self.excellon_units_radio = RadioSet([{'label': _tr('INCH'), 'value': 'INCH'}, + {'label': _tr('MM'), 'value': 'METRIC'}]) self.excellon_units_radio.setToolTip( - "This sets the units of Excellon files.\n" + _tr("This sets the units of Excellon files.\n" "Some Excellon files don't have an header\n" - "therefore this parameter will be used.\n" + "therefore this parameter will be used.") ) hlay4.addStretch() hlay4.addWidget(self.excellon_units_radio, QtCore.Qt.AlignRight) @@ -3726,48 +3757,48 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): hlay6 = QtWidgets.QVBoxLayout() self.layout.addLayout(hlay6) - self.excellon_general_label = QtWidgets.QLabel("Excellon Optimization:") + self.excellon_general_label = QtWidgets.QLabel(_tr("Excellon Optimization:")) hlay6.addWidget(self.excellon_general_label) # Create a form layout for the Excellon general settings form_box_excellon = QtWidgets.QFormLayout() hlay6.addLayout(form_box_excellon) - self.excellon_optimization_label = QtWidgets.QLabel('Algorithm: ') + self.excellon_optimization_label = QtWidgets.QLabel(_tr('Algorithm: ')) self.excellon_optimization_label.setAlignment(QtCore.Qt.AlignLeft) self.excellon_optimization_label.setToolTip( - "This sets the optimization type for the Excellon drill path.\n" + _tr("This sets the optimization type for the Excellon drill path.\n" "If MH is checked then Google OR-Tools algorithm with MetaHeuristic\n" "Guided Local Path is used. Default search time is 3sec.\n" "Use set_sys excellon_search_time value Tcl Command to set other values.\n" "If Basic is checked then Google OR-Tools Basic algorithm is used.\n" "\n" "If DISABLED, then FlatCAM works in 32bit mode and it uses \n" - "Travelling Salesman algorithm for path optimization." + "Travelling Salesman algorithm for path optimization.") ) - self.excellon_optimization_radio = RadioSet([{'label': 'MH', 'value': 'M'}, - {'label': 'Basic', 'value': 'B'}]) + self.excellon_optimization_radio = RadioSet([{'label': _tr('MH'), 'value': 'M'}, + {'label': _tr('Basic'), 'value': 'B'}]) self.excellon_optimization_radio.setToolTip( - "This sets the optimization type for the Excellon drill path.\n" + _tr("This sets the optimization type for the Excellon drill path.\n" "If MH is checked then Google OR-Tools algorithm with MetaHeuristic\n" "Guided Local Path is used. Default search time is 3sec.\n" "Use set_sys excellon_search_time value Tcl Command to set other values.\n" "If Basic is checked then Google OR-Tools Basic algorithm is used.\n" "\n" "If DISABLED, then FlatCAM works in 32bit mode and it uses \n" - "Travelling Salesman algorithm for path optimization." + "Travelling Salesman algorithm for path optimization.") ) form_box_excellon.addRow(self.excellon_optimization_label, self.excellon_optimization_radio) - self.optimization_time_label = QtWidgets.QLabel('Optimization Time: ') + self.optimization_time_label = QtWidgets.QLabel(_tr('Optimization Time: ')) self.optimization_time_label.setAlignment(QtCore.Qt.AlignLeft) self.optimization_time_label.setToolTip( - "When OR-Tools Metaheuristic (MH) is enabled there is a\n" + _tr("When OR-Tools Metaheuristic (MH) is enabled there is a\n" "maximum threshold for how much time is spent doing the\n" "path optimization. This max duration is set here.\n" - "In seconds." + "In seconds.") ) @@ -3805,83 +3836,83 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Excellon Options", parent=parent) super(ExcellonOptPrefGroupUI, self).__init__(self) - self.setTitle(str("Excellon Options")) + self.setTitle(str(_tr("Excellon Options"))) ## Create CNC Job - self.cncjob_label = QtWidgets.QLabel('Create CNC Job') + self.cncjob_label = QtWidgets.QLabel(_tr('Create CNC Job')) self.cncjob_label.setToolTip( - "Parameters used to create a CNC Job object\n" - "for this drill object." + _tr("Parameters used to create a CNC Job object\n" + "for this drill object.") ) self.layout.addWidget(self.cncjob_label) grid2 = QtWidgets.QGridLayout() self.layout.addLayout(grid2) - cutzlabel = QtWidgets.QLabel('Cut Z:') + cutzlabel = QtWidgets.QLabel(_tr('Cut Z:')) cutzlabel.setToolTip( - "Drill depth (negative)\n" - "below the copper surface." + _tr("Drill depth (negative)\n" + "below the copper surface.") ) grid2.addWidget(cutzlabel, 0, 0) self.cutz_entry = LengthEntry() grid2.addWidget(self.cutz_entry, 0, 1) - travelzlabel = QtWidgets.QLabel('Travel Z:') + travelzlabel = QtWidgets.QLabel(_tr('Travel Z:')) travelzlabel.setToolTip( - "Tool height when travelling\n" - "across the XY plane." + _tr("Tool height when travelling\n" + "across the XY plane.") ) grid2.addWidget(travelzlabel, 1, 0) self.travelz_entry = LengthEntry() grid2.addWidget(self.travelz_entry, 1, 1) # Tool change: - toolchlabel = QtWidgets.QLabel("Tool change:") + toolchlabel = QtWidgets.QLabel(_tr("Tool change:")) toolchlabel.setToolTip( - "Include tool-change sequence\n" - "in G-Code (Pause for tool change)." + _tr("Include tool-change sequence\n" + "in G-Code (Pause for tool change).") ) self.toolchange_cb = FCCheckBox() grid2.addWidget(toolchlabel, 2, 0) grid2.addWidget(self.toolchange_cb, 2, 1) - toolchangezlabel = QtWidgets.QLabel('Toolchange Z:') + toolchangezlabel = QtWidgets.QLabel(_tr('Toolchange Z:')) toolchangezlabel.setToolTip( - "Toolchange Z position." + _tr("Toolchange Z position.") ) grid2.addWidget(toolchangezlabel, 3, 0) self.toolchangez_entry = LengthEntry() grid2.addWidget(self.toolchangez_entry, 3, 1) - frlabel = QtWidgets.QLabel('Feedrate:') + frlabel = QtWidgets.QLabel(_tr('Feedrate:')) frlabel.setToolTip( - "Tool speed while drilling\n" - "(in units per minute)." + _tr("Tool speed while drilling\n" + "(in units per minute).") ) grid2.addWidget(frlabel, 4, 0) self.feedrate_entry = LengthEntry() grid2.addWidget(self.feedrate_entry, 4, 1) # Spindle speed - spdlabel = QtWidgets.QLabel('Spindle Speed:') + spdlabel = QtWidgets.QLabel(_tr('Spindle Speed:')) spdlabel.setToolTip( - "Speed of the spindle\n" - "in RPM (optional)" + _tr("Speed of the spindle\n" + "in RPM (optional)") ) grid2.addWidget(spdlabel, 5, 0) self.spindlespeed_entry = IntEntry(allow_empty=True) grid2.addWidget(self.spindlespeed_entry, 5, 1) # Dwell - dwelllabel = QtWidgets.QLabel('Dwell:') + dwelllabel = QtWidgets.QLabel(_tr('Dwell:')) dwelllabel.setToolTip( - "Pause to allow the spindle to reach its\n" - "speed before cutting." + _tr("Pause to allow the spindle to reach its\n" + "speed before cutting.") ) - dwelltime = QtWidgets.QLabel('Duration:') + dwelltime = QtWidgets.QLabel(_tr('Duration:')) dwelltime.setToolTip( - "Number of milliseconds for spindle to dwell." + _tr("Number of milliseconds for spindle to dwell.") ) self.dwell_cb = FCCheckBox() self.dwelltime_entry = FCEntry() @@ -3893,10 +3924,10 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry]) # postprocessor selection - pp_excellon_label = QtWidgets.QLabel("Postprocessor:") + pp_excellon_label = QtWidgets.QLabel(_tr("Postprocessor:")) pp_excellon_label.setToolTip( - "The postprocessor file that dictates\n" - "gcode output." + _tr("The postprocessor file that dictates\n" + "gcode output.") ) grid2.addWidget(pp_excellon_label, 8, 0) self.pp_excellon_name_cb = FCComboBox() @@ -3905,16 +3936,16 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): #### Choose what to use for Gcode creation: Drills, Slots or Both - excellon_gcode_type_label = QtWidgets.QLabel('Gcode: ') + excellon_gcode_type_label = QtWidgets.QLabel(_tr('Gcode: ')) excellon_gcode_type_label.setToolTip( - "Choose what to use for GCode generation:\n" + _tr("Choose what to use for GCode generation:\n" "'Drills', 'Slots' or 'Both'.\n" "When choosing 'Slots' or 'Both', slots will be\n" - "converted to drills." + "converted to drills.") ) - self.excellon_gcode_type_radio = RadioSet([{'label': 'Drills', 'value': 'drills'}, - {'label': 'Slots', 'value': 'slots'}, - {'label': 'Both', 'value': 'both'}]) + self.excellon_gcode_type_radio = RadioSet([{'label': _tr('Drills'), 'value': 'drills'}, + {'label': _tr('Slots'), 'value': 'slots'}, + {'label': _tr('Both'), 'value': 'both'}]) grid2.addWidget(excellon_gcode_type_label, 9, 0) grid2.addWidget(self.excellon_gcode_type_radio, 9, 1) @@ -3923,25 +3954,25 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): self.excellon_gcode_type_radio.setVisible(False) #### Milling Holes #### - self.mill_hole_label = QtWidgets.QLabel('Mill Holes') + self.mill_hole_label = QtWidgets.QLabel(_tr('Mill Holes')) self.mill_hole_label.setToolTip( - "Create Geometry for milling holes." + _tr("Create Geometry for milling holes.") ) self.layout.addWidget(self.mill_hole_label) grid3 = QtWidgets.QGridLayout() self.layout.addLayout(grid3) - tdlabel = QtWidgets.QLabel('Drill Tool dia:') + tdlabel = QtWidgets.QLabel(_tr('Drill Tool dia:')) tdlabel.setToolTip( - "Diameter of the cutting tool." + _tr("Diameter of the cutting tool.") ) grid3.addWidget(tdlabel, 0, 0) self.tooldia_entry = LengthEntry() grid3.addWidget(self.tooldia_entry, 0, 1) - stdlabel = QtWidgets.QLabel('Slot Tool dia:') + stdlabel = QtWidgets.QLabel(_tr('Slot Tool dia:')) stdlabel.setToolTip( - "Diameter of the cutting tool\n" - "when milling slots." + _tr("Diameter of the cutting tool\n" + "when milling slots.") ) grid3.addWidget(stdlabel, 1, 0) self.slot_tooldia_entry = LengthEntry() @@ -3952,7 +3983,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI): # Adding the Excellon Format Defaults Button self.excellon_defaults_button = QtWidgets.QPushButton() - self.excellon_defaults_button.setText(str("Defaults")) + self.excellon_defaults_button.setText(str(_tr("Defaults"))) self.excellon_defaults_button.setFixedWidth(80) grid4.addWidget(self.excellon_defaults_button, 0, 0, QtCore.Qt.AlignRight) @@ -3965,105 +3996,105 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent) super(ExcellonAdvOptPrefGroupUI, self).__init__(self) - self.setTitle(str("Excellon Adv. Options")) + self.setTitle(str(_tr("Excellon Adv. Options"))) ###################### ## ADVANCED OPTIONS ## ###################### - self.cncjob_label = QtWidgets.QLabel('Advanced Options:') + self.cncjob_label = QtWidgets.QLabel(_tr('Advanced Options:')) self.cncjob_label.setToolTip( - "Parameters used to create a CNC Job object\n" - "for this drill object that are shown when App Level is Advanced." + _tr("Parameters used to create a CNC Job object\n" + "for this drill object that are shown when App Level is Advanced.") ) self.layout.addWidget(self.cncjob_label) grid1 = QtWidgets.QGridLayout() self.layout.addLayout(grid1) - offsetlabel = QtWidgets.QLabel('Offset Z:') + offsetlabel = QtWidgets.QLabel(_tr('Offset Z:')) offsetlabel.setToolTip( - "Some drill bits (the larger ones) need to drill deeper\n" + _tr("Some drill bits (the larger ones) need to drill deeper\n" "to create the desired exit hole diameter due of the tip shape.\n" - "The value here can compensate the Cut Z parameter.") + "The value here can compensate the Cut Z parameter.")) grid1.addWidget(offsetlabel, 0, 0) self.offset_entry = LengthEntry() grid1.addWidget(self.offset_entry, 0, 1) - toolchange_xy_label = QtWidgets.QLabel('Toolchange X,Y:') + toolchange_xy_label = QtWidgets.QLabel(_tr('Toolchange X,Y:')) toolchange_xy_label.setToolTip( - "Toolchange X,Y position." + _tr("Toolchange X,Y position.") ) grid1.addWidget(toolchange_xy_label, 1, 0) self.toolchangexy_entry = FCEntry() grid1.addWidget(self.toolchangexy_entry, 1, 1) - startzlabel = QtWidgets.QLabel('Start move Z:') + startzlabel = QtWidgets.QLabel(_tr('Start move Z:')) startzlabel.setToolTip( - "Height of the tool just after start.\n" - "Delete the value if you don't need this feature." + _tr("Height of the tool just after start.\n" + "Delete the value if you don't need this feature.") ) grid1.addWidget(startzlabel, 2, 0) self.estartz_entry = FloatEntry() grid1.addWidget(self.estartz_entry, 2, 1) - endzlabel = QtWidgets.QLabel('End move Z:') + endzlabel = QtWidgets.QLabel(_tr('End move Z:')) endzlabel.setToolTip( - "Height of the tool after\n" - "the last move at the end of the job." + _tr("Height of the tool after\n" + "the last move at the end of the job.") ) grid1.addWidget(endzlabel, 3, 0) self.eendz_entry = LengthEntry() grid1.addWidget(self.eendz_entry, 3, 1) - fr_rapid_label = QtWidgets.QLabel('Feedrate Rapids:') + fr_rapid_label = QtWidgets.QLabel(_tr('Feedrate Rapids:')) fr_rapid_label.setToolTip( - "Tool speed while drilling\n" + _tr("Tool speed while drilling\n" "with rapid move\n" - "(in units per minute)." + "(in units per minute).") ) grid1.addWidget(fr_rapid_label, 4, 0) self.feedrate_rapid_entry = LengthEntry() grid1.addWidget(self.feedrate_rapid_entry, 4, 1) # Probe depth - self.pdepth_label = QtWidgets.QLabel("Probe Z depth:") + self.pdepth_label = QtWidgets.QLabel(_tr("Probe Z depth:")) self.pdepth_label.setToolTip( - "The maximum depth that the probe is allowed\n" - "to probe. Negative value, in current units." + _tr("The maximum depth that the probe is allowed\n" + "to probe. Negative value, in current units.") ) grid1.addWidget(self.pdepth_label, 5, 0) self.pdepth_entry = FCEntry() grid1.addWidget(self.pdepth_entry, 5, 1) # Probe feedrate - self.feedrate_probe_label = QtWidgets.QLabel("Feedrate Probe:") + self.feedrate_probe_label = QtWidgets.QLabel(_tr("Feedrate Probe:")) self.feedrate_probe_label.setToolTip( - "The feedrate used while the probe is probing." + _tr( "The feedrate used while the probe is probing.") ) grid1.addWidget(self.feedrate_probe_label, 6, 0) self.feedrate_probe_entry = FCEntry() grid1.addWidget(self.feedrate_probe_entry, 6, 1) - fplungelabel = QtWidgets.QLabel('Fast Plunge:') + fplungelabel = QtWidgets.QLabel(_tr('Fast Plunge:')) fplungelabel.setToolTip( - "By checking this, the vertical move from\n" + _tr("By checking this, the vertical move from\n" "Z_Toolchange to Z_move is done with G0,\n" "meaning the fastest speed available.\n" - "WARNING: the move is done at Toolchange X,Y coords." + "WARNING: the move is done at Toolchange X,Y coords.") ) self.fplunge_cb = FCCheckBox() grid1.addWidget(fplungelabel, 7, 0) grid1.addWidget(self.fplunge_cb, 7, 1) - fretractlabel = QtWidgets.QLabel('Fast Retract:') + fretractlabel = QtWidgets.QLabel(_tr('Fast Retract:')) fretractlabel.setToolTip( - "Exit hole strategy.\n" + _tr("Exit hole strategy.\n" " - When uncheked, while exiting the drilled hole the drill bit\n" "will travel slow, with set feedrate (G1), up to zero depth and then\n" "travel as fast as possible (G0) to the Z Move (travel height).\n" " - When checked the travel from Z cut (cut depth) to Z_move\n" - "(travel height) is done as fast as possible (G0) in one move." + "(travel height) is done as fast as possible (G0) in one move.") ) self.fretract_cb = FCCheckBox() grid1.addWidget(fretractlabel, 8, 0) @@ -4077,13 +4108,13 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): def __init__(self, parent=None): super(ExcellonExpPrefGroupUI, self).__init__(self) - self.setTitle(str("Excellon Export")) + self.setTitle(str(_tr("Excellon Export"))) # Plot options - self.export_options_label = QtWidgets.QLabel("Export Options:") + self.export_options_label = QtWidgets.QLabel(_tr("Export Options:")) self.export_options_label.setToolTip( - "The parameters set here are used in the file exported\n" - "when using the File -> Export -> Export Excellon menu entry." + _tr("The parameters set here are used in the file exported\n" + "when using the File -> Export -> Export Excellon menu entry.") ) self.layout.addWidget(self.export_options_label) @@ -4091,25 +4122,26 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): self.layout.addLayout(form) # Excellon Units - self.excellon_units_label = QtWidgets.QLabel('Units:') + self.excellon_units_label = QtWidgets.QLabel(_tr('Units:')) self.excellon_units_label.setToolTip( - "The units used in the Excellon file." + _tr("The units used in the Excellon file.") ) - self.excellon_units_radio = RadioSet([{'label': 'INCH', 'value': 'INCH'}, {'label': 'MM', 'value': 'METRIC'}]) + self.excellon_units_radio = RadioSet([{'label': _tr('INCH'), 'value': 'INCH'}, + {'label': _tr('MM'), 'value': 'METRIC'}]) self.excellon_units_radio.setToolTip( - "The units used in the Excellon file." + _tr("The units used in the Excellon file.") ) form.addRow(self.excellon_units_label, self.excellon_units_radio) # Excellon non-decimal format - self.digits_label = QtWidgets.QLabel("Int/Decimals:") + self.digits_label = QtWidgets.QLabel(_tr("Int/Decimals:")) self.digits_label.setToolTip( - "The NC drill files, usually named Excellon files\n" + _tr("The NC drill files, usually named Excellon files\n" "are files that can be found in different formats.\n" "Here we set the format used when the provided\n" - "coordinates are not using period." + "coordinates are not using period.") ) hlay1 = QtWidgets.QHBoxLayout() @@ -4119,8 +4151,8 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): self.format_whole_entry.setAlignment(QtCore.Qt.AlignRight) self.format_whole_entry.setFixedWidth(30) self.format_whole_entry.setToolTip( - "This numbers signify the number of digits in\n" - "the whole part of Excellon coordinates." + _tr("This numbers signify the number of digits in\n" + "the whole part of Excellon coordinates.") ) hlay1.addWidget(self.format_whole_entry, QtCore.Qt.AlignLeft) @@ -4133,8 +4165,8 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): self.format_dec_entry.setAlignment(QtCore.Qt.AlignRight) self.format_dec_entry.setFixedWidth(30) self.format_dec_entry.setToolTip( - "This numbers signify the number of digits in\n" - "the decimal part of Excellon coordinates." + _tr("This numbers signify the number of digits in\n" + "the decimal part of Excellon coordinates.") ) hlay1.addWidget(self.format_dec_entry, QtCore.Qt.AlignLeft) hlay1.addStretch() @@ -4142,46 +4174,47 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI): form.addRow(self.digits_label, hlay1) # Select the Excellon Format - self.format_label = QtWidgets.QLabel("Format:") + self.format_label = QtWidgets.QLabel(_tr("Format:")) self.format_label.setToolTip( - "Select the kind of coordinates format used.\n" + _tr("Select the kind of coordinates format used.\n" "Coordinates can be saved with decimal point or without.\n" "When there is no decimal point, it is required to specify\n" "the number of digits for integer part and the number of decimals.\n" "Also it will have to be specified if LZ = leading zeros are kept\n" - "or TZ = trailing zeros are kept." + "or TZ = trailing zeros are kept.") ) - self.format_radio = RadioSet([{'label': 'Decimal', 'value': 'dec'}, {'label': 'No-Decimal', 'value': 'ndec'}]) + self.format_radio = RadioSet([{'label': _tr('Decimal'), 'value': 'dec'}, + {'label': _tr('No-Decimal'), 'value': 'ndec'}]) self.format_radio.setToolTip( - "Select the kind of coordinates format used.\n" + _tr("Select the kind of coordinates format used.\n" "Coordinates can be saved with decimal point or without.\n" "When there is no decimal point, it is required to specify\n" "the number of digits for integer part and the number of decimals.\n" "Also it will have to be specified if LZ = leading zeros are kept\n" - "or TZ = trailing zeros are kept." + "or TZ = trailing zeros are kept.") ) form.addRow(self.format_label, self.format_radio) # Excellon Zeros - self.zeros_label = QtWidgets.QLabel('Zeros:') + self.zeros_label = QtWidgets.QLabel(_tr('Zeros:')) self.zeros_label.setAlignment(QtCore.Qt.AlignLeft) self.zeros_label.setToolTip( - "This sets the type of Excellon zeros.\n" + _tr("This sets the type of Excellon zeros.\n" "If LZ then Leading Zeros are kept and\n" "Trailing Zeros are removed.\n" "If TZ is checked then Trailing Zeros are kept\n" - "and Leading Zeros are removed." + "and Leading Zeros are removed.") ) - self.zeros_radio = RadioSet([{'label': 'LZ', 'value': 'LZ'}, - {'label': 'TZ', 'value': 'TZ'}]) + self.zeros_radio = RadioSet([{'label': _tr('LZ'), 'value': 'LZ'}, + {'label': _tr('TZ'), 'value': 'TZ'}]) self.zeros_radio.setToolTip( - "This sets the default type of Excellon zeros.\n" + _tr("This sets the default type of Excellon zeros.\n" "If LZ then Leading Zeros are kept and\n" "Trailing Zeros are removed.\n" "If TZ is checked then Trailing Zeros are kept\n" - "and Leading Zeros are removed." + "and Leading Zeros are removed.") ) form.addRow(self.zeros_label, self.zeros_radio) @@ -4203,43 +4236,43 @@ class GeometryGenPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent) super(GeometryGenPrefGroupUI, self).__init__(self) - self.setTitle(str("Geometry General")) + self.setTitle(str(_tr("Geometry General"))) ## Plot options - self.plot_options_label = QtWidgets.QLabel("Plot Options:") + self.plot_options_label = QtWidgets.QLabel(_tr("Plot Options:")) self.layout.addWidget(self.plot_options_label) # Plot CB - self.plot_cb = FCCheckBox(label='Plot') + self.plot_cb = FCCheckBox(label=_tr('Plot')) self.plot_cb.setToolTip( - "Plot (show) this object." + _tr("Plot (show) this object.") ) self.layout.addWidget(self.plot_cb) grid0 = QtWidgets.QGridLayout() self.layout.addLayout(grid0) # Number of circle steps for circular aperture linear approximation - self.circle_steps_label = QtWidgets.QLabel("Circle Steps:") + self.circle_steps_label = QtWidgets.QLabel(_tr("Circle Steps:")) self.circle_steps_label.setToolTip( - "The number of circle steps for Geometry \n" - "circle and arc shapes linear approximation." + _tr("The number of circle steps for Geometry \n" + "circle and arc shapes linear approximation.") ) grid0.addWidget(self.circle_steps_label, 1, 0) self.circle_steps_entry = IntEntry() grid0.addWidget(self.circle_steps_entry, 1, 1) # Tools - self.tools_label = QtWidgets.QLabel("Tools") + self.tools_label = QtWidgets.QLabel(_tr("Tools")) self.layout.addWidget(self.tools_label) grid0_b = QtWidgets.QGridLayout() self.layout.addLayout(grid0_b) # Tooldia - tdlabel = QtWidgets.QLabel('Tool dia: ') + tdlabel = QtWidgets.QLabel(_tr('Tool dia: ')) tdlabel.setToolTip( - "The diameter of the cutting\n" - "tool.." + _tr("The diameter of the cutting\n" + "tool..") ) grid0_b.addWidget(tdlabel, 0, 0) self.cnctooldia_entry = LengthEntry() @@ -4253,16 +4286,16 @@ class GeometryOptPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent) super(GeometryOptPrefGroupUI, self).__init__(self) - self.setTitle(str("Geometry Options")) + self.setTitle(str(_tr("Geometry Options"))) # ------------------------------ ## Create CNC Job # ------------------------------ - self.cncjob_label = QtWidgets.QLabel('Create CNC Job:') + self.cncjob_label = QtWidgets.QLabel(_tr('Create CNC Job:')) self.cncjob_label.setToolTip( - "Create a CNC Job object\n" + _tr("Create a CNC Job object\n" "tracing the contours of this\n" - "Geometry object." + "Geometry object.") ) self.layout.addWidget(self.cncjob_label) @@ -4270,30 +4303,30 @@ class GeometryOptPrefGroupUI(OptionsGroupUI): self.layout.addLayout(grid1) # Cut Z - cutzlabel = QtWidgets.QLabel('Cut Z:') + cutzlabel = QtWidgets.QLabel(_tr('Cut Z:')) cutzlabel.setToolTip( - "Cutting depth (negative)\n" - "below the copper surface." + _tr("Cutting depth (negative)\n" + "below the copper surface.") ) grid1.addWidget(cutzlabel, 0, 0) self.cutz_entry = LengthEntry() grid1.addWidget(self.cutz_entry, 0, 1) # Multidepth CheckBox - self.multidepth_cb = FCCheckBox(label='Multidepth') + self.multidepth_cb = FCCheckBox(label=_tr('Multidepth')) self.multidepth_cb.setToolTip( - "Multidepth usage: True or False." + _tr("Multidepth usage: True or False.") ) grid1.addWidget(self.multidepth_cb, 1, 0) # Depth/pass - dplabel = QtWidgets.QLabel('Depth/Pass:') + dplabel = QtWidgets.QLabel(_tr('Depth/Pass:')) dplabel.setToolTip( - "The depth to cut on each pass,\n" + _tr("The depth to cut on each pass,\n" "when multidepth is enabled.\n" "It has positive value although\n" "it is a fraction from the depth\n" - "which has negative value." + "which has negative value.") ) grid1.addWidget(dplabel, 2, 0) @@ -4303,74 +4336,74 @@ class GeometryOptPrefGroupUI(OptionsGroupUI): self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry]) # Travel Z - travelzlabel = QtWidgets.QLabel('Travel Z:') + travelzlabel = QtWidgets.QLabel(_tr('Travel Z:')) travelzlabel.setToolTip( - "Height of the tool when\n" - "moving without cutting." + _tr("Height of the tool when\n" + "moving without cutting.") ) grid1.addWidget(travelzlabel, 3, 0) self.travelz_entry = LengthEntry() grid1.addWidget(self.travelz_entry, 3, 1) # Tool change: - toolchlabel = QtWidgets.QLabel("Tool change:") + toolchlabel = QtWidgets.QLabel(_tr("Tool change:")) toolchlabel.setToolTip( - "Include tool-change sequence\n" - "in G-Code (Pause for tool change)." + _tr("Include tool-change sequence\n" + "in G-Code (Pause for tool change).") ) self.toolchange_cb = FCCheckBox() grid1.addWidget(toolchlabel, 4, 0) grid1.addWidget(self.toolchange_cb, 4, 1) # Toolchange Z - toolchangezlabel = QtWidgets.QLabel('Toolchange Z:') + toolchangezlabel = QtWidgets.QLabel(_tr('Toolchange Z:')) toolchangezlabel.setToolTip( - "Toolchange Z position." + _tr("Toolchange Z position.") ) grid1.addWidget(toolchangezlabel, 5, 0) self.toolchangez_entry = LengthEntry() grid1.addWidget(self.toolchangez_entry, 5, 1) # Feedrate X-Y - frlabel = QtWidgets.QLabel('Feed Rate X-Y:') + frlabel = QtWidgets.QLabel(_tr('Feed Rate X-Y:')) frlabel.setToolTip( - "Cutting speed in the XY\n" - "plane in units per minute" + _tr("Cutting speed in the XY\n" + "plane in units per minute") ) grid1.addWidget(frlabel, 6, 0) self.cncfeedrate_entry = LengthEntry() grid1.addWidget(self.cncfeedrate_entry, 6, 1) # Feedrate Z (Plunge) - frz_label = QtWidgets.QLabel('Feed Rate Z:') + frz_label = QtWidgets.QLabel(_tr('Feed Rate Z:')) frz_label.setToolTip( - "Cutting speed in the XY\n" + _tr("Cutting speed in the XY\n" "plane in units per minute.\n" - "It is called also Plunge." + "It is called also Plunge.") ) grid1.addWidget(frz_label, 7, 0) self.cncplunge_entry = LengthEntry() grid1.addWidget(self.cncplunge_entry, 7, 1) # Spindle Speed - spdlabel = QtWidgets.QLabel('Spindle speed:') + spdlabel = QtWidgets.QLabel(_tr('Spindle speed:')) spdlabel.setToolTip( - "Speed of the spindle\n" - "in RPM (optional)" + _tr("Speed of the spindle\n" + "in RPM (optional)") ) grid1.addWidget(spdlabel, 8, 0) self.cncspindlespeed_entry = IntEntry(allow_empty=True) grid1.addWidget(self.cncspindlespeed_entry, 8, 1) # Dwell - self.dwell_cb = FCCheckBox(label='Dwell:') + self.dwell_cb = FCCheckBox(label=_tr('Dwell:')) self.dwell_cb.setToolTip( - "Pause to allow the spindle to reach its\n" - "speed before cutting." + _tr("Pause to allow the spindle to reach its\n" + "speed before cutting.") ) - dwelltime = QtWidgets.QLabel('Duration:') + dwelltime = QtWidgets.QLabel(_tr('Duration:')) dwelltime.setToolTip( - "Number of milliseconds for spindle to dwell." + _tr("Number of milliseconds for spindle to dwell.") ) self.dwelltime_entry = FCEntry() grid1.addWidget(self.dwell_cb, 9, 0) @@ -4380,10 +4413,10 @@ class GeometryOptPrefGroupUI(OptionsGroupUI): self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry]) # postprocessor selection - pp_label = QtWidgets.QLabel("Postprocessor:") + pp_label = QtWidgets.QLabel(_tr("Postprocessor:")) pp_label.setToolTip( - "The postprocessor file that dictates\n" - "Machine Code output." + _tr("The postprocessor file that dictates\n" + "Machine Code output.") ) grid1.addWidget(pp_label, 11, 0) self.pp_geometry_name_cb = FCComboBox() @@ -4398,15 +4431,15 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent) super(GeometryAdvOptPrefGroupUI, self).__init__(self) - self.setTitle(str("Geometry Adv. Options")) + self.setTitle(str(_tr("Geometry Adv. Options"))) # ------------------------------ ## Advanced Options # ------------------------------ - self.cncjob_label = QtWidgets.QLabel('Advanced Options:') + self.cncjob_label = QtWidgets.QLabel(_tr('Advanced Options:')) self.cncjob_label.setToolTip( - "Parameters to create a CNC Job object\n" - "tracing the contours of a Geometry object." + _tr("Parameters to create a CNC Job object\n" + "tracing the contours of a Geometry object.") ) self.layout.addWidget(self.cncjob_label) @@ -4414,102 +4447,102 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI): self.layout.addLayout(grid1) # Toolchange X,Y - toolchange_xy_label = QtWidgets.QLabel('Toolchange X,Y:') + toolchange_xy_label = QtWidgets.QLabel(_tr('Toolchange X,Y:')) toolchange_xy_label.setToolTip( - "Toolchange X,Y position." + _tr("Toolchange X,Y position.") ) grid1.addWidget(toolchange_xy_label, 1, 0) self.toolchangexy_entry = FCEntry() grid1.addWidget(self.toolchangexy_entry, 1, 1) # Start move Z - startzlabel = QtWidgets.QLabel('Start move Z:') + startzlabel = QtWidgets.QLabel(_tr('Start move Z:')) startzlabel.setToolTip( - "Height of the tool just after starting the work.\n" - "Delete the value if you don't need this feature." + _tr("Height of the tool just after starting the work.\n" + "Delete the value if you don't need this feature.") ) grid1.addWidget(startzlabel, 2, 0) self.gstartz_entry = FloatEntry() grid1.addWidget(self.gstartz_entry, 2, 1) # End move Z - endzlabel = QtWidgets.QLabel('End move Z:') + endzlabel = QtWidgets.QLabel(_tr('End move Z:')) endzlabel.setToolTip( - "Height of the tool after\n" - "the last move at the end of the job." + _tr("Height of the tool after\n" + "the last move at the end of the job.") ) grid1.addWidget(endzlabel, 3, 0) self.gendz_entry = LengthEntry() grid1.addWidget(self.gendz_entry, 3, 1) # Feedrate rapids - fr_rapid_label = QtWidgets.QLabel('Feedrate Rapids:') + fr_rapid_label = QtWidgets.QLabel(_tr('Feedrate Rapids:')) fr_rapid_label.setToolTip( - "Cutting speed in the XY\n" - "plane in units per minute" + _tr("Cutting speed in the XY\n" + "plane in units per minute") ) grid1.addWidget(fr_rapid_label, 4, 0) self.cncfeedrate_rapid_entry = LengthEntry() grid1.addWidget(self.cncfeedrate_rapid_entry, 4, 1) # End move extra cut - self.extracut_cb = FCCheckBox(label='Re-cut 1st pt.') + self.extracut_cb = FCCheckBox(label=_tr('Re-cut 1st pt.')) self.extracut_cb.setToolTip( - "In order to remove possible\n" + _tr("In order to remove possible\n" "copper leftovers where first cut\n" "meet with last cut, we generate an\n" - "extended cut over the first cut section." + "extended cut over the first cut section.") ) grid1.addWidget(self.extracut_cb, 5, 0) # Probe depth - self.pdepth_label = QtWidgets.QLabel("Probe Z depth:") + self.pdepth_label = QtWidgets.QLabel(_tr("Probe Z depth:")) self.pdepth_label.setToolTip( - "The maximum depth that the probe is allowed\n" - "to probe. Negative value, in current units." + _tr("The maximum depth that the probe is allowed\n" + "to probe. Negative value, in current units.") ) grid1.addWidget(self.pdepth_label, 6, 0) self.pdepth_entry = FCEntry() grid1.addWidget(self.pdepth_entry, 6, 1) # Probe feedrate - self.feedrate_probe_label = QtWidgets.QLabel("Feedrate Probe:") + self.feedrate_probe_label = QtWidgets.QLabel(_tr("Feedrate Probe:")) self.feedrate_probe_label.setToolTip( - "The feedrate used while the probe is probing." + _tr("The feedrate used while the probe is probing.") ) grid1.addWidget(self.feedrate_probe_label, 7, 0) self.feedrate_probe_entry = FCEntry() grid1.addWidget(self.feedrate_probe_entry, 7, 1) # Fast Move from Z Toolchange - fplungelabel = QtWidgets.QLabel('Fast Plunge:') + fplungelabel = QtWidgets.QLabel(_tr('Fast Plunge:')) fplungelabel.setToolTip( - "By checking this, the vertical move from\n" + _tr("By checking this, the vertical move from\n" "Z_Toolchange to Z_move is done with G0,\n" "meaning the fastest speed available.\n" - "WARNING: the move is done at Toolchange X,Y coords." + "WARNING: the move is done at Toolchange X,Y coords.") ) self.fplunge_cb = FCCheckBox() grid1.addWidget(fplungelabel, 8, 0) grid1.addWidget(self.fplunge_cb, 8, 1) # Size of trace segment on X axis - segx_label = QtWidgets.QLabel("Seg. X size:") + segx_label = QtWidgets.QLabel(_tr("Seg. X size:")) segx_label.setToolTip( - "The size of the trace segment on the X axis.\n" + _tr("The size of the trace segment on the X axis.\n" "Useful for auto-leveling.\n" - "A value of 0 means no segmentation on the X axis." + "A value of 0 means no segmentation on the X axis.") ) grid1.addWidget(segx_label, 9, 0) self.segx_entry = FCEntry() grid1.addWidget(self.segx_entry, 9, 1) # Size of trace segment on Y axis - segy_label = QtWidgets.QLabel("Seg. Y size:") + segy_label = QtWidgets.QLabel(_tr("Seg. Y size:")) segy_label.setToolTip( - "The size of the trace segment on the Y axis.\n" + _tr("The size of the trace segment on the Y axis.\n" "Useful for auto-leveling.\n" - "A value of 0 means no segmentation on the Y axis." + "A value of 0 means no segmentation on the Y axis.") ) grid1.addWidget(segy_label, 10, 0) self.segy_entry = FCEntry() @@ -4523,10 +4556,10 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None) super(CNCJobGenPrefGroupUI, self).__init__(self) - self.setTitle(str("CNC Job General")) + self.setTitle(str(_tr("CNC Job General"))) ## Plot options - self.plot_options_label = QtWidgets.QLabel("Plot Options:") + self.plot_options_label = QtWidgets.QLabel(_tr("Plot Options:")) self.layout.addWidget(self.plot_options_label) grid0 = QtWidgets.QGridLayout() @@ -4536,25 +4569,25 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): # Plot CB # self.plot_cb = QtWidgets.QCheckBox('Plot') - self.plot_cb = FCCheckBox('Plot Object') + self.plot_cb = FCCheckBox(_tr('Plot Object')) self.plot_cb.setToolTip( "Plot (show) this object." ) grid0.addWidget(self.plot_cb, 0, 0) # Plot Kind - self.cncplot_method_label = QtWidgets.QLabel("Plot kind:") + self.cncplot_method_label = QtWidgets.QLabel(_tr("Plot kind:")) self.cncplot_method_label.setToolTip( - "This selects the kind of geometries on the canvas to plot.\n" + _tr("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." + "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"} + {"label": _tr("All"), "value": "all"}, + {"label": _tr("Travel"), "value": "travel"}, + {"label": _tr("Cut"), "value": "cut"} ], stretch=False) grid0.addWidget(self.cncplot_method_label, 1, 0) @@ -4562,40 +4595,40 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(QtWidgets.QLabel(''), 1, 2) # Number of circle steps for circular aperture linear approximation - self.steps_per_circle_label = QtWidgets.QLabel("Circle Steps:") + self.steps_per_circle_label = QtWidgets.QLabel(_tr("Circle Steps:")) self.steps_per_circle_label.setToolTip( - "The number of circle steps for GCode \n" - "circle and arc shapes linear approximation." + _tr("The number of circle steps for GCode \n" + "circle and arc shapes linear approximation.") ) grid0.addWidget(self.steps_per_circle_label, 2, 0) self.steps_per_circle_entry = IntEntry() grid0.addWidget(self.steps_per_circle_entry, 2, 1) # Tool dia for plot - tdlabel = QtWidgets.QLabel('Tool dia:') + tdlabel = QtWidgets.QLabel(_tr('Tool dia:')) tdlabel.setToolTip( - "Diameter of the tool to be\n" - "rendered in the plot." + _tr("Diameter of the tool to be\n" + "rendered in the plot.") ) grid0.addWidget(tdlabel, 3, 0) self.tooldia_entry = LengthEntry() grid0.addWidget(self.tooldia_entry, 3, 1) # Number of decimals to use in GCODE coordinates - cdeclabel = QtWidgets.QLabel('Coords dec.:') + cdeclabel = QtWidgets.QLabel(_tr('Coords dec.:')) cdeclabel.setToolTip( - "The number of decimals to be used for \n" - "the X, Y, Z coordinates in CNC code (GCODE, etc.)" + _tr("The number of decimals to be used for \n" + "the X, Y, Z coordinates in CNC code (GCODE, etc.)") ) grid0.addWidget(cdeclabel, 4, 0) self.coords_dec_entry = IntEntry() grid0.addWidget(self.coords_dec_entry, 4, 1) # Number of decimals to use in GCODE feedrate - frdeclabel = QtWidgets.QLabel('Feedrate dec.:') + frdeclabel = QtWidgets.QLabel(_tr('Feedrate dec.:')) frdeclabel.setToolTip( - "The number of decimals to be used for \n" - "the Feedrate parameter in CNC code (GCODE, etc.)" + _tr("The number of decimals to be used for \n" + "the Feedrate parameter in CNC code (GCODE, etc.)") ) grid0.addWidget(frdeclabel, 5, 0) self.fr_dec_entry = IntEntry() @@ -4609,21 +4642,21 @@ class CNCJobOptPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None) super(CNCJobOptPrefGroupUI, self).__init__(self) - self.setTitle(str("CNC Job Options")) + self.setTitle(str(_tr("CNC Job Options"))) ## Export G-Code - self.export_gcode_label = QtWidgets.QLabel("Export G-Code:") + self.export_gcode_label = QtWidgets.QLabel(_tr("Export G-Code:")) self.export_gcode_label.setToolTip( - "Export and save G-Code to\n" - "make this object to a file." + _tr("Export and save G-Code to\n" + "make this object to a file.") ) self.layout.addWidget(self.export_gcode_label) # Prepend to G-Code - prependlabel = QtWidgets.QLabel('Prepend to G-Code:') + prependlabel = QtWidgets.QLabel(_tr('Prepend to G-Code:')) prependlabel.setToolTip( - "Type here any G-Code commands you would\n" - "like to add at the beginning of the G-Code file." + _tr("Type here any G-Code commands you would\n" + "like to add at the beginning of the G-Code file.") ) self.layout.addWidget(prependlabel) @@ -4631,11 +4664,11 @@ class CNCJobOptPrefGroupUI(OptionsGroupUI): self.layout.addWidget(self.prepend_text) # Append text to G-Code - appendlabel = QtWidgets.QLabel('Append to G-Code:') + appendlabel = QtWidgets.QLabel(_tr('Append to G-Code:')) appendlabel.setToolTip( - "Type here any G-Code commands you would\n" + _tr("Type here any G-Code commands you would\n" "like to append to the generated file.\n" - "I.e.: M2 (End of program)" + "I.e.: M2 (End of program)") ) self.layout.addWidget(appendlabel) @@ -4650,23 +4683,23 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None) super(CNCJobAdvOptPrefGroupUI, self).__init__(self) - self.setTitle(str("CNC Job Adv. Options")) + self.setTitle(str(_tr("CNC Job Adv. Options"))) ## Export G-Code - self.export_gcode_label = QtWidgets.QLabel("Export G-Code:") + self.export_gcode_label = QtWidgets.QLabel(_tr("Export G-Code:")) self.export_gcode_label.setToolTip( - "Export and save G-Code to\n" - "make this object to a file." + _tr("Export and save G-Code to\n" + "make this object to a file.") ) self.layout.addWidget(self.export_gcode_label) # Prepend to G-Code - toolchangelabel = QtWidgets.QLabel('Toolchange G-Code:') + toolchangelabel = QtWidgets.QLabel(_tr('Toolchange G-Code:')) toolchangelabel.setToolTip( - "Type here any G-Code commands you would\n" + _tr("Type here any G-Code commands you would\n" "like to be executed when Toolchange event is encountered.\n" "This will constitute a Custom Toolchange GCode,\n" - "or a Toolchange Macro." + "or a Toolchange Macro.") ) self.layout.addWidget(toolchangelabel) @@ -4677,10 +4710,10 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI): self.layout.addLayout(hlay) # Toolchange Replacement GCode - self.toolchange_cb = FCCheckBox(label='Use Toolchange Macro') + self.toolchange_cb = FCCheckBox(label=_tr('Use Toolchange Macro')) self.toolchange_cb.setToolTip( - "Check this box if you want to use\n" - "a Custom Toolchange GCode (macro)." + _tr("Check this box if you want to use\n" + "a Custom Toolchange GCode (macro).") ) hlay.addWidget(self.toolchange_cb) hlay.addStretch() @@ -4691,28 +4724,28 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI): # Variable list self.tc_variable_combo = FCComboBox() self.tc_variable_combo.setToolTip( - "A list of the FlatCAM variables that can be used\n" + _tr("A list of the FlatCAM variables that can be used\n" "in the Toolchange event.\n" - "They have to be surrounded by the '%' symbol" + "They have to be surrounded by the '%' symbol") ) hlay1.addWidget(self.tc_variable_combo) # Populate the Combo Box - variables = ['Parameters', 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange', + variables = [_tr('Parameters'), 'tool', 'tooldia', 't_drills', 'x_toolchange', 'y_toolchange', 'z_toolchange', 'z_cut', 'z_move', 'z_depthpercut', 'spindlespeed', 'dwelltime'] self.tc_variable_combo.addItems(variables) - self.tc_variable_combo.setItemData(0, "FlatCAM CNC parameters", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(1, "tool = tool number", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(2, "tooldia = tool diameter", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(3, "t_drills = for Excellon, total number of drills", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(4, "x_toolchange = X coord for Toolchange", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(5, "y_toolchange = Y coord for Toolchange", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(6, "z_toolchange = Z coord for Toolchange", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(7, "z_cut = Z coord for Toolchange", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(8, "z_move = Z coord for Toolchange", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(9, "z_depthpercut = the step value for multidepth cut", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(10, "spindlesspeed = the value for the spindle speed", Qt.ToolTipRole) - self.tc_variable_combo.setItemData(11, "dwelltime = time to dwell to allow the spindle to reach it's set RPM", + self.tc_variable_combo.setItemData(0, _tr("FlatCAM CNC parameters"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(1, _tr("tool = tool number"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(2, _tr("tooldia = tool diameter"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(3, _tr("t_drills = for Excellon, total number of drills"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(4, _tr("x_toolchange = X coord for Toolchange"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(5, _tr("y_toolchange = Y coord for Toolchange"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(6, _tr("z_toolchange = Z coord for Toolchange"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(7, _tr("z_cut = Z coord for Toolchange"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(8, _tr("z_move = Z coord for Toolchange"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(9, _tr("z_depthpercut = the step value for multidepth cut"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(10, _tr("spindlesspeed = the value for the spindle speed"), Qt.ToolTipRole) + self.tc_variable_combo.setItemData(11, _tr("dwelltime = time to dwell to allow the spindle to reach it's set RPM"), Qt.ToolTipRole) hlay1.addStretch() @@ -4733,30 +4766,30 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "NCC Tool Options", parent=parent) super(ToolsNCCPrefGroupUI, self).__init__(self) - self.setTitle(str("NCC Tool Options")) + self.setTitle(str(_tr("NCC Tool Options"))) ## Clear non-copper regions - self.clearcopper_label = QtWidgets.QLabel("Parameters:") + self.clearcopper_label = QtWidgets.QLabel(_tr("Parameters:")) self.clearcopper_label.setToolTip( - "Create a Geometry object with\n" - "toolpaths to cut all non-copper regions." + _tr("Create a Geometry object with\n" + "toolpaths to cut all non-copper regions.") ) self.layout.addWidget(self.clearcopper_label) grid0 = QtWidgets.QGridLayout() self.layout.addLayout(grid0) - ncctdlabel = QtWidgets.QLabel('Tools dia:') + ncctdlabel = QtWidgets.QLabel(_tr('Tools dia:')) ncctdlabel.setToolTip( - "Diameters of the cutting tools, separated by ','" + _tr("Diameters of the cutting tools, separated by ','") ) grid0.addWidget(ncctdlabel, 0, 0) self.ncc_tool_dia_entry = FCEntry() grid0.addWidget(self.ncc_tool_dia_entry, 0, 1) - nccoverlabel = QtWidgets.QLabel('Overlap:') + nccoverlabel = QtWidgets.QLabel(_tr('Overlap:')) nccoverlabel.setToolTip( - "How much (fraction) of the tool width to overlap each tool pass.\n" + _tr( "How much (fraction) of the tool width to overlap each tool pass.\n" "Example:\n" "A value here of 0.25 means 25% from the tool diameter found above.\n\n" "Adjust the value starting with lower values\n" @@ -4764,63 +4797,63 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI): "not cleared.\n" "Lower values = faster processing, faster execution on PCB.\n" "Higher values = slow processing and slow execution on CNC\n" - "due of too many paths." + "due of too many paths.") ) grid0.addWidget(nccoverlabel, 1, 0) self.ncc_overlap_entry = FloatEntry() grid0.addWidget(self.ncc_overlap_entry, 1, 1) - nccmarginlabel = QtWidgets.QLabel('Margin:') + nccmarginlabel = QtWidgets.QLabel(_tr('Margin:')) nccmarginlabel.setToolTip( - "Bounding box margin." + _tr("Bounding box margin.") ) grid0.addWidget(nccmarginlabel, 2, 0) self.ncc_margin_entry = FloatEntry() grid0.addWidget(self.ncc_margin_entry, 2, 1) # Method - methodlabel = QtWidgets.QLabel('Method:') + methodlabel = QtWidgets.QLabel(_tr('Method:')) methodlabel.setToolTip( - "Algorithm for non-copper clearing:
" + _tr("Algorithm for non-copper clearing:
" "Standard: Fixed step inwards.
" "Seed-based: Outwards from seed.
" - "Line-based: Parallel lines." + "Line-based: Parallel lines.") ) grid0.addWidget(methodlabel, 3, 0) self.ncc_method_radio = RadioSet([ - {"label": "Standard", "value": "standard"}, - {"label": "Seed-based", "value": "seed"}, - {"label": "Straight lines", "value": "lines"} + {"label": _tr("Standard"), "value": "standard"}, + {"label": _tr("Seed-based"), "value": "seed"}, + {"label": _tr("Straight lines"), "value": "lines"} ], orientation='vertical', stretch=False) grid0.addWidget(self.ncc_method_radio, 3, 1) # Connect lines - pathconnectlabel = QtWidgets.QLabel("Connect:") + pathconnectlabel = QtWidgets.QLabel(_tr("Connect:")) pathconnectlabel.setToolTip( - "Draw lines between resulting\n" - "segments to minimize tool lifts." + _tr("Draw lines between resulting\n" + "segments to minimize tool lifts.") ) grid0.addWidget(pathconnectlabel, 4, 0) self.ncc_connect_cb = FCCheckBox() grid0.addWidget(self.ncc_connect_cb, 4, 1) - contourlabel = QtWidgets.QLabel("Contour:") + contourlabel = QtWidgets.QLabel(_tr("Contour:")) contourlabel.setToolTip( - "Cut around the perimeter of the polygon\n" - "to trim rough edges." + _tr( "Cut around the perimeter of the polygon\n" + "to trim rough edges.") ) grid0.addWidget(contourlabel, 5, 0) self.ncc_contour_cb = FCCheckBox() grid0.addWidget(self.ncc_contour_cb, 5, 1) - restlabel = QtWidgets.QLabel("Rest M.:") + restlabel = QtWidgets.QLabel(_tr("Rest M.:")) restlabel.setToolTip( - "If checked, use 'rest machining'.\n" + _tr("If checked, use 'rest machining'.\n" "Basically it will clear copper outside PCB features,\n" "using the biggest tool and continue with the next tools,\n" "from bigger to smaller, to clear areas of copper that\n" "could not be cleared by previous tool.\n" - "If not checked, use the standard algorithm." + "If not checked, use the standard algorithm.") ) grid0.addWidget(restlabel, 6, 0) self.ncc_rest_cb = FCCheckBox() @@ -4834,50 +4867,50 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent) super(ToolsCutoutPrefGroupUI, self).__init__(self) - self.setTitle(str("Cutout Tool Options")) + self.setTitle(str(_tr("Cutout Tool Options"))) ## Board cuttout - self.board_cutout_label = QtWidgets.QLabel("Parameters:") + self.board_cutout_label = QtWidgets.QLabel(_tr("Parameters:")) self.board_cutout_label.setToolTip( - "Create toolpaths to cut around\n" + _tr("Create toolpaths to cut around\n" "the PCB and separate it from\n" - "the original board." + "the original board.") ) self.layout.addWidget(self.board_cutout_label) grid0 = QtWidgets.QGridLayout() self.layout.addLayout(grid0) - tdclabel = QtWidgets.QLabel('Tool dia:') + tdclabel = QtWidgets.QLabel(_tr('Tool dia:')) tdclabel.setToolTip( - "Diameter of the cutting tool." + _tr( "Diameter of the cutting tool.") ) grid0.addWidget(tdclabel, 0, 0) self.cutout_tooldia_entry = LengthEntry() grid0.addWidget(self.cutout_tooldia_entry, 0, 1) - marginlabel = QtWidgets.QLabel('Margin:') + marginlabel = QtWidgets.QLabel(_tr('Margin:')) marginlabel.setToolTip( - "Distance from objects at which\n" - "to draw the cutout." + _tr("Distance from objects at which\n" + "to draw the cutout.") ) grid0.addWidget(marginlabel, 1, 0) self.cutout_margin_entry = LengthEntry() grid0.addWidget(self.cutout_margin_entry, 1, 1) - gaplabel = QtWidgets.QLabel('Gap size:') + gaplabel = QtWidgets.QLabel(_tr('Gap size:')) gaplabel.setToolTip( - "Size of the gaps in the toolpath\n" + _tr("Size of the gaps in the toolpath\n" "that will remain to hold the\n" - "board in place." + "board in place.") ) grid0.addWidget(gaplabel, 2, 0) self.cutout_gap_entry = LengthEntry() grid0.addWidget(self.cutout_gap_entry, 2, 1) - gaps_label = QtWidgets.QLabel('Gaps:') + gaps_label = QtWidgets.QLabel(_tr('Gaps:')) gaps_label.setToolTip( - "Number of bridge gaps used for the cutout.\n" + _tr("Number of bridge gaps used for the cutout.\n" "There can be maximum 8 bridges/gaps.\n" "The choices are:\n" "- lr - left + right\n" @@ -4885,7 +4918,7 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI): "- 4 - left + right +top + bottom\n" "- 2lr - 2*left + 2*right\n" "- 2tb - 2*top + 2*bottom\n" - "- 8 - 2*left + 2*right +2*top + 2*bottom" + "- 8 - 2*left + 2*right +2*top + 2*bottom") ) grid0.addWidget(gaps_label, 3, 0) self.gaps_combo = FCComboBox() @@ -4904,13 +4937,13 @@ class Tools2sidedPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent) super(Tools2sidedPrefGroupUI, self).__init__(self) - self.setTitle(str("2Sided Tool Options")) + self.setTitle(str(_tr("2Sided Tool Options"))) ## Board cuttout - self.dblsided_label = QtWidgets.QLabel("Parameters:") + self.dblsided_label = QtWidgets.QLabel(_tr("Parameters:")) self.dblsided_label.setToolTip( - "A tool to help in creating a double sided\n" - "PCB using alignment holes." + _tr("A tool to help in creating a double sided\n" + "PCB using alignment holes.") ) self.layout.addWidget(self.dblsided_label) @@ -4919,20 +4952,20 @@ class Tools2sidedPrefGroupUI(OptionsGroupUI): ## Drill diameter for alignment holes self.drill_dia_entry = LengthEntry() - self.dd_label = QtWidgets.QLabel("Drill diam.:") + self.dd_label = QtWidgets.QLabel(_tr("Drill diam.:")) self.dd_label.setToolTip( - "Diameter of the drill for the " - "alignment holes." + _tr("Diameter of the drill for the " + "alignment holes.") ) grid0.addWidget(self.dd_label, 0, 0) grid0.addWidget(self.drill_dia_entry, 0, 1) ## Axis - self.mirror_axis_radio = RadioSet([{'label': 'X', 'value': 'X'}, - {'label': 'Y', 'value': 'Y'}]) - self.mirax_label = QtWidgets.QLabel("Mirror Axis:") + self.mirror_axis_radio = RadioSet([{'label': _tr('X'), 'value': 'X'}, + {'label': _tr('Y'), 'value': 'Y'}]) + self.mirax_label = QtWidgets.QLabel(_tr("Mirror Axis:")) self.mirax_label.setToolTip( - "Mirror vertically (X) or horizontally (Y)." + _tr("Mirror vertically (X) or horizontally (Y).") ) # grid_lay.addRow("Mirror Axis:", self.mirror_axis) self.empty_lb1 = QtWidgets.QLabel("") @@ -4941,13 +4974,13 @@ class Tools2sidedPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.mirror_axis_radio, 2, 1) ## Axis Location - self.axis_location_radio = RadioSet([{'label': 'Point', 'value': 'point'}, - {'label': 'Box', 'value': 'box'}]) - self.axloc_label = QtWidgets.QLabel("Axis Ref:") + self.axis_location_radio = RadioSet([{'label': _tr('Point'), 'value': 'point'}, + {'label': _tr('Box'), 'value': 'box'}]) + self.axloc_label = QtWidgets.QLabel(_tr("Axis Ref:")) self.axloc_label.setToolTip( - "The axis should pass through a point or cut\n " + _tr("The axis should pass through a point or cut\n " "a specified box (in a Geometry object) in \n" - "the middle." + "the middle.") ) # grid_lay.addRow("Axis Location:", self.axis_location) grid0.addWidget(self.axloc_label, 3, 0) @@ -4961,17 +4994,17 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent) super(ToolsPaintPrefGroupUI, self).__init__(self) - self.setTitle(str("Paint Tool Options")) + self.setTitle(str(_tr("Paint Tool Options"))) # ------------------------------ ## Paint area # ------------------------------ - self.paint_label = QtWidgets.QLabel('Parameters:') + self.paint_label = QtWidgets.QLabel(_tr('Parameters:')) self.paint_label.setToolTip( - "Creates tool paths to cover the\n" + _tr("Creates tool paths to cover the\n" "whole area of a polygon (remove\n" "all copper). You will be asked\n" - "to click on the desired polygon." + "to click on the desired polygon.") ) self.layout.addWidget(self.paint_label) @@ -4979,10 +5012,10 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI): self.layout.addLayout(grid0) # Tool dia - ptdlabel = QtWidgets.QLabel('Tool dia:') + ptdlabel = QtWidgets.QLabel(_tr('Tool dia:')) ptdlabel.setToolTip( - "Diameter of the tool to\n" - "be used in the operation." + _tr("Diameter of the tool to\n" + "be used in the operation.") ) grid0.addWidget(ptdlabel, 0, 0) @@ -4990,70 +5023,70 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI): grid0.addWidget(self.painttooldia_entry, 0, 1) # Overlap - ovlabel = QtWidgets.QLabel('Overlap:') + ovlabel = QtWidgets.QLabel(_tr('Overlap:')) ovlabel.setToolTip( - "How much (fraction) of the tool\n" - "width to overlap each tool pass." + _tr("How much (fraction) of the tool\n" + "width to overlap each tool pass.") ) grid0.addWidget(ovlabel, 1, 0) self.paintoverlap_entry = LengthEntry() grid0.addWidget(self.paintoverlap_entry, 1, 1) # Margin - marginlabel = QtWidgets.QLabel('Margin:') + marginlabel = QtWidgets.QLabel(_tr('Margin:')) marginlabel.setToolTip( - "Distance by which to avoid\n" + _tr("Distance by which to avoid\n" "the edges of the polygon to\n" - "be painted." + "be painted.") ) grid0.addWidget(marginlabel, 2, 0) self.paintmargin_entry = LengthEntry() grid0.addWidget(self.paintmargin_entry, 2, 1) # Method - methodlabel = QtWidgets.QLabel('Method:') + methodlabel = QtWidgets.QLabel(_tr('Method:')) methodlabel.setToolTip( - "Algorithm to paint the polygon:
" + _tr("Algorithm to paint the polygon:
" "Standard: Fixed step inwards.
" - "Seed-based: Outwards from seed." + "Seed-based: Outwards from seed.") ) grid0.addWidget(methodlabel, 3, 0) self.paintmethod_combo = RadioSet([ - {"label": "Standard", "value": "standard"}, - {"label": "Seed-based", "value": "seed"}, - {"label": "Straight lines", "value": "lines"} + {"label": _tr("Standard"), "value": "standard"}, + {"label": _tr("Seed-based"), "value": "seed"}, + {"label": _tr("Straight lines"), "value": "lines"} ], orientation='vertical', stretch=False) grid0.addWidget(self.paintmethod_combo, 3, 1) # Connect lines - pathconnectlabel = QtWidgets.QLabel("Connect:") + pathconnectlabel = QtWidgets.QLabel(_tr("Connect:")) pathconnectlabel.setToolTip( - "Draw lines between resulting\n" - "segments to minimize tool lifts." + _tr("Draw lines between resulting\n" + "segments to minimize tool lifts.") ) grid0.addWidget(pathconnectlabel, 4, 0) self.pathconnect_cb = FCCheckBox() grid0.addWidget(self.pathconnect_cb, 4, 1) # Paint contour - contourlabel = QtWidgets.QLabel("Contour:") + contourlabel = QtWidgets.QLabel(_tr("Contour:")) contourlabel.setToolTip( - "Cut around the perimeter of the polygon\n" - "to trim rough edges." + _tr("Cut around the perimeter of the polygon\n" + "to trim rough edges.") ) grid0.addWidget(contourlabel, 5, 0) self.contour_cb = FCCheckBox() grid0.addWidget(self.contour_cb, 5, 1) # Polygon selection - selectlabel = QtWidgets.QLabel('Selection:') + selectlabel = QtWidgets.QLabel(_tr('Selection:')) selectlabel.setToolTip( - "How to select the polygons to paint." + _tr("How to select the polygons to paint.") ) grid0.addWidget(selectlabel, 6, 0) self.selectmethod_combo = RadioSet([ - {"label": "Single", "value": "single"}, - {"label": "All", "value": "all"}, + {"label": _tr("Single"), "value": "single"}, + {"label": _tr("All"), "value": "all"}, # {"label": "Rectangle", "value": "rectangle"} ]) grid0.addWidget(self.selectmethod_combo, 6, 1) @@ -5066,54 +5099,55 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent) super(ToolsFilmPrefGroupUI, self).__init__(self) - self.setTitle(str("Film Tool Options")) + self.setTitle(str(_tr("Film Tool Options"))) ## Board cuttout - self.film_label = QtWidgets.QLabel("Parameters:") + self.film_label = QtWidgets.QLabel(_tr("Parameters:")) self.film_label.setToolTip( - "Create a PCB film from a Gerber or Geometry\n" + _tr("Create a PCB film from a Gerber or Geometry\n" "FlatCAM object.\n" - "The file is saved in SVG format." + "The file is saved in SVG format.") ) self.layout.addWidget(self.film_label) grid0 = QtWidgets.QGridLayout() self.layout.addLayout(grid0) - self.film_type_radio = RadioSet([{'label': 'Pos', 'value': 'pos'}, {'label': 'Neg', 'value': 'neg'}]) - ftypelbl = QtWidgets.QLabel('Film Type:') + self.film_type_radio = RadioSet([{'label': _tr('Pos'), 'value': 'pos'}, + {'label': _tr('Neg'), 'value': 'neg'}]) + ftypelbl = QtWidgets.QLabel(_tr('Film Type:')) ftypelbl.setToolTip( - "Generate a Positive black film or a Negative film.\n" + _tr("Generate a Positive black film or a Negative film.\n" "Positive means that it will print the features\n" "with black on a white canvas.\n" "Negative means that it will print the features\n" "with white on a black canvas.\n" - "The Film format is SVG." + "The Film format is SVG.") ) grid0.addWidget(ftypelbl, 0, 0) grid0.addWidget(self.film_type_radio, 0, 1) self.film_boundary_entry = FCEntry() - self.film_boundary_label = QtWidgets.QLabel("Border:") + self.film_boundary_label = QtWidgets.QLabel(_tr("Border:")) self.film_boundary_label.setToolTip( - "Specify a border around the object.\n" + _tr("Specify a border around the object.\n" "Only for negative film.\n" "It helps if we use as a Box Object the same \n" "object as in Film Object. It will create a thick\n" "black bar around the actual print allowing for a\n" "better delimitation of the outline features which are of\n" "white color like the rest and which may confound with the\n" - "surroundings if not for this border." + "surroundings if not for this border.") ) grid0.addWidget(self.film_boundary_label, 1, 0) grid0.addWidget(self.film_boundary_entry, 1, 1) self.film_scale_entry = FCEntry() - self.film_scale_label = QtWidgets.QLabel("Scale Stroke:") + self.film_scale_label = QtWidgets.QLabel(_tr("Scale Stroke:")) self.film_scale_label.setToolTip( - "Scale the line stroke thickness of each feature in the SVG file.\n" + _tr("Scale the line stroke thickness of each feature in the SVG file.\n" "It means that the line that envelope each SVG feature will be thicker or thinner,\n" - "therefore the fine features may be more affected by this parameter." + "therefore the fine features may be more affected by this parameter.") ) grid0.addWidget(self.film_scale_label, 2, 0) grid0.addWidget(self.film_scale_entry, 2, 1) @@ -5126,14 +5160,14 @@ class ToolsPanelizePrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent) super(ToolsPanelizePrefGroupUI, self).__init__(self) - self.setTitle(str("Panelize Tool Options")) + self.setTitle(str(_tr("Panelize Tool Options"))) ## Board cuttout - self.panelize_label = QtWidgets.QLabel("Parameters:") + self.panelize_label = QtWidgets.QLabel(_tr("Parameters:")) self.panelize_label.setToolTip( - "Create an object that contains an array of (x, y) elements,\n" + _tr("Create an object that contains an array of (x, y) elements,\n" "each element is a copy of the source object spaced\n" - "at a X distance, Y distance of each other." + "at a X distance, Y distance of each other.") ) self.layout.addWidget(self.panelize_label) @@ -5142,80 +5176,80 @@ class ToolsPanelizePrefGroupUI(OptionsGroupUI): ## Spacing Columns self.pspacing_columns = FCEntry() - self.spacing_columns_label = QtWidgets.QLabel("Spacing cols:") + self.spacing_columns_label = QtWidgets.QLabel(_tr("Spacing cols:")) self.spacing_columns_label.setToolTip( - "Spacing between columns of the desired panel.\n" - "In current units." + _tr("Spacing between columns of the desired panel.\n" + "In current units.") ) grid0.addWidget(self.spacing_columns_label, 0, 0) grid0.addWidget(self.pspacing_columns, 0, 1) ## Spacing Rows self.pspacing_rows = FCEntry() - self.spacing_rows_label = QtWidgets.QLabel("Spacing rows:") + self.spacing_rows_label = QtWidgets.QLabel(_tr("Spacing rows:")) self.spacing_rows_label.setToolTip( - "Spacing between rows of the desired panel.\n" - "In current units." + _tr("Spacing between rows of the desired panel.\n" + "In current units.") ) grid0.addWidget(self.spacing_rows_label, 1, 0) grid0.addWidget(self.pspacing_rows, 1, 1) ## Columns self.pcolumns = FCEntry() - self.columns_label = QtWidgets.QLabel("Columns:") + self.columns_label = QtWidgets.QLabel(_tr("Columns:")) self.columns_label.setToolTip( - "Number of columns of the desired panel" + _tr("Number of columns of the desired panel") ) grid0.addWidget(self.columns_label, 2, 0) grid0.addWidget(self.pcolumns, 2, 1) ## Rows self.prows = FCEntry() - self.rows_label = QtWidgets.QLabel("Rows:") + self.rows_label = QtWidgets.QLabel(_tr("Rows:")) self.rows_label.setToolTip( - "Number of rows of the desired panel" + _tr("Number of rows of the desired panel") ) grid0.addWidget(self.rows_label, 3, 0) grid0.addWidget(self.prows, 3, 1) ## Type of resulting Panel object - self.panel_type_radio = RadioSet([{'label': 'Gerber', 'value': 'gerber'}, - {'label': 'Geo', 'value': 'geometry'}]) - self.panel_type_label = QtWidgets.QLabel("Panel Type:") + self.panel_type_radio = RadioSet([{'label': _tr('Gerber'), 'value': 'gerber'}, + {'label': _tr('Geo'), 'value': 'geometry'}]) + self.panel_type_label = QtWidgets.QLabel(_tr("Panel Type:")) self.panel_type_label.setToolTip( - "Choose the type of object for the panel object:\n" + _tr( "Choose the type of object for the panel object:\n" "- Gerber\n" - "- Geometry" + "- Geometry") ) grid0.addWidget(self.panel_type_label, 4, 0) grid0.addWidget(self.panel_type_radio, 4, 1) ## Constrains - self.pconstrain_cb = FCCheckBox("Constrain within:") + self.pconstrain_cb = FCCheckBox(_tr("Constrain within:")) self.pconstrain_cb.setToolTip( - "Area define by DX and DY within to constrain the panel.\n" + _tr("Area define by DX and DY within to constrain the panel.\n" "DX and DY values are in current units.\n" "Regardless of how many columns and rows are desired,\n" "the final panel will have as many columns and rows as\n" - "they fit completely within selected area." + "they fit completely within selected area.") ) grid0.addWidget(self.pconstrain_cb, 5, 0) self.px_width_entry = FCEntry() - self.x_width_lbl = QtWidgets.QLabel("Width (DX):") + self.x_width_lbl = QtWidgets.QLabel(_tr("Width (DX):")) self.x_width_lbl.setToolTip( - "The width (DX) within which the panel must fit.\n" - "In current units." + _tr("The width (DX) within which the panel must fit.\n" + "In current units.") ) grid0.addWidget(self.x_width_lbl, 6, 0) grid0.addWidget(self.px_width_entry, 6, 1) self.py_height_entry = FCEntry() - self.y_height_lbl = QtWidgets.QLabel("Height (DY):") + self.y_height_lbl = QtWidgets.QLabel(_tr("Height (DY):")) self.y_height_lbl.setToolTip( - "The height (DY)within which the panel must fit.\n" - "In current units." + _tr("The height (DY)within which the panel must fit.\n" + "In current units.") ) grid0.addWidget(self.y_height_lbl, 7, 0) grid0.addWidget(self.py_height_entry, 7, 1) @@ -5228,14 +5262,14 @@ class ToolsCalculatorsPrefGroupUI(OptionsGroupUI): # OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent) super(ToolsCalculatorsPrefGroupUI, self).__init__(self) - self.setTitle(str("Calculators Tool Options")) + self.setTitle(str(_tr("Calculators Tool Options"))) ## V-shape Calculator Tool - self.vshape_tool_label = QtWidgets.QLabel("V-Shape Tool Calculator:") + self.vshape_tool_label = QtWidgets.QLabel(_tr("V-Shape Tool Calculator:")) self.vshape_tool_label.setToolTip( - "Calculate the tool diameter for a given V-shape tool,\n" + _tr("Calculate the tool diameter for a given V-shape tool,\n" "having the tip diameter, tip angle and\n" - "depth-of-cut as parameters." + "depth-of-cut as parameters.") ) self.layout.addWidget(self.vshape_tool_label) @@ -5244,39 +5278,39 @@ class ToolsCalculatorsPrefGroupUI(OptionsGroupUI): ## Tip Diameter self.tip_dia_entry = FCEntry() - self.tip_dia_label = QtWidgets.QLabel("Tip Diameter:") + self.tip_dia_label = QtWidgets.QLabel(_tr("Tip Diameter:")) self.tip_dia_label.setToolTip( - "This is the tool tip diameter.\n" - "It is specified by manufacturer." + _tr("This is the tool tip diameter.\n" + "It is specified by manufacturer.") ) grid0.addWidget(self.tip_dia_label, 0, 0) grid0.addWidget(self.tip_dia_entry, 0, 1) ## Tip angle self.tip_angle_entry = FCEntry() - self.tip_angle_label = QtWidgets.QLabel("Tip angle:") + self.tip_angle_label = QtWidgets.QLabel(_tr("Tip angle:")) self.tip_angle_label.setToolTip( - "This is the angle on the tip of the tool.\n" - "It is specified by manufacturer." + _tr("This is the angle on the tip of the tool.\n" + "It is specified by manufacturer.") ) grid0.addWidget(self.tip_angle_label, 1, 0) grid0.addWidget(self.tip_angle_entry, 1, 1) ## Depth-of-cut Cut Z self.cut_z_entry = FCEntry() - self.cut_z_label = QtWidgets.QLabel("Cut Z:") + self.cut_z_label = QtWidgets.QLabel(_tr("Cut Z:")) self.cut_z_label.setToolTip( - "This is depth to cut into material.\n" - "In the CNCJob object it is the CutZ parameter." + _tr("This is depth to cut into material.\n" + "In the CNCJob object it is the CutZ parameter.") ) grid0.addWidget(self.cut_z_label, 2, 0) grid0.addWidget(self.cut_z_entry, 2, 1) ## Electroplating Calculator Tool - self.plate_title_label = QtWidgets.QLabel("ElectroPlating Calculator:") + self.plate_title_label = QtWidgets.QLabel(_tr("ElectroPlating Calculator:")) self.plate_title_label.setToolTip( - "This calculator is useful for those who plate the via/pad/drill holes,\n" - "using a method like grahite ink or calcium hypophosphite ink or palladium chloride." + _tr("This calculator is useful for those who plate the via/pad/drill holes,\n" + "using a method like grahite ink or calcium hypophosphite ink or palladium chloride.") ) self.layout.addWidget(self.plate_title_label) @@ -5285,35 +5319,35 @@ class ToolsCalculatorsPrefGroupUI(OptionsGroupUI): ## PCB Length self.pcblength_entry = FCEntry() - self.pcblengthlabel = QtWidgets.QLabel("Board Length:") + self.pcblengthlabel = QtWidgets.QLabel(_tr("Board Length:")) - self.pcblengthlabel.setToolTip('This is the board length. In centimeters.') + self.pcblengthlabel.setToolTip(_tr('This is the board length. In centimeters.')) grid1.addWidget(self.pcblengthlabel, 0, 0) grid1.addWidget(self.pcblength_entry, 0, 1) ## PCB Width self.pcbwidth_entry = FCEntry() - self.pcbwidthlabel = QtWidgets.QLabel("Board Width:") + self.pcbwidthlabel = QtWidgets.QLabel(_tr("Board Width:")) - self.pcbwidthlabel.setToolTip('This is the board width.In centimeters.') + self.pcbwidthlabel.setToolTip(_tr('This is the board width.In centimeters.')) grid1.addWidget(self.pcbwidthlabel, 1, 0) grid1.addWidget(self.pcbwidth_entry, 1, 1) ## Current Density - self.cdensity_label = QtWidgets.QLabel("Current Density:") + self.cdensity_label = QtWidgets.QLabel(_tr("Current Density:")) self.cdensity_entry = FCEntry() - self.cdensity_label.setToolTip("Current density to pass through the board. \n" - "In Amps per Square Feet ASF.") + self.cdensity_label.setToolTip(_tr("Current density to pass through the board. \n" + "In Amps per Square Feet ASF.")) grid1.addWidget(self.cdensity_label, 2, 0) grid1.addWidget(self.cdensity_entry, 2, 1) ## PCB Copper Growth - self.growth_label = QtWidgets.QLabel("Copper Growth:") + self.growth_label = QtWidgets.QLabel(_tr("Copper Growth:")) self.growth_entry = FCEntry() - self.growth_label.setToolTip("How thick the copper growth is intended to be.\n" - "In microns.") + self.growth_label.setToolTip(_tr("How thick the copper growth is intended to be.\n" + "In microns.")) grid1.addWidget(self.growth_label, 3, 0) grid1.addWidget(self.growth_entry, 3, 1) @@ -5325,13 +5359,13 @@ class ToolsTransformPrefGroupUI(OptionsGroupUI): super(ToolsTransformPrefGroupUI, self).__init__(self) - self.setTitle(str("Transform Tool Options")) + self.setTitle(str(_tr("Transform Tool Options"))) ## Transformations - self.transform_label = QtWidgets.QLabel("Parameters:") + self.transform_label = QtWidgets.QLabel(_tr("Parameters:")) self.transform_label.setToolTip( - "Various transformations that can be applied\n" - "on a FlatCAM object." + _tr("Various transformations that can be applied\n" + "on a FlatCAM object.") ) self.layout.addWidget(self.transform_label) @@ -5340,89 +5374,89 @@ class ToolsTransformPrefGroupUI(OptionsGroupUI): ## Rotate Angle self.rotate_entry = FCEntry() - self.rotate_label = QtWidgets.QLabel("Rotate Angle:") + self.rotate_label = QtWidgets.QLabel(_tr("Rotate Angle:")) self.rotate_label.setToolTip( - "Angle for rotation. In degrees." + _tr("Angle for rotation. In degrees.") ) grid0.addWidget(self.rotate_label, 0, 0) grid0.addWidget(self.rotate_entry, 0, 1) ## Skew/Shear Angle on X axis self.skewx_entry = FCEntry() - self.skewx_label = QtWidgets.QLabel("Skew_X angle:") + self.skewx_label = QtWidgets.QLabel(_tr("Skew_X angle:")) self.skewx_label.setToolTip( - "Angle for Skew/Shear on X axis. In degrees." + _tr("Angle for Skew/Shear on X axis. In degrees.") ) grid0.addWidget(self.skewx_label, 1, 0) grid0.addWidget(self.skewx_entry, 1, 1) ## Skew/Shear Angle on Y axis self.skewy_entry = FCEntry() - self.skewy_label = QtWidgets.QLabel("Skew_Y angle:") + self.skewy_label = QtWidgets.QLabel(_tr("Skew_Y angle:")) self.skewy_label.setToolTip( - "Angle for Skew/Shear on Y axis. In degrees." + _tr("Angle for Skew/Shear on Y axis. In degrees.") ) grid0.addWidget(self.skewy_label, 2, 0) grid0.addWidget(self.skewy_entry, 2, 1) ## Scale factor on X axis self.scalex_entry = FCEntry() - self.scalex_label = QtWidgets.QLabel("Scale_X factor:") + self.scalex_label = QtWidgets.QLabel(_tr("Scale_X factor:")) self.scalex_label.setToolTip( - "Factor for scaling on X axis." + _tr("Factor for scaling on X axis.") ) grid0.addWidget(self.scalex_label, 3, 0) grid0.addWidget(self.scalex_entry, 3, 1) ## Scale factor on X axis self.scaley_entry = FCEntry() - self.scaley_label = QtWidgets.QLabel("Scale_Y factor:") + self.scaley_label = QtWidgets.QLabel(_tr("Scale_Y factor:")) self.scaley_label.setToolTip( - "Factor for scaling on Y axis." + _tr("Factor for scaling on Y axis.") ) grid0.addWidget(self.scaley_label, 4, 0) grid0.addWidget(self.scaley_entry, 4, 1) ## Link Scale factors - self.link_cb = FCCheckBox("Link") + self.link_cb = FCCheckBox(_tr("Link")) self.link_cb.setToolTip( - "Scale the selected object(s)\n" - "using the Scale_X factor for both axis." + _tr("Scale the selected object(s)\n" + "using the Scale_X factor for both axis.") ) grid0.addWidget(self.link_cb, 5, 0) ## Scale Reference - self.reference_cb = FCCheckBox("Scale Reference") + self.reference_cb = FCCheckBox(_tr("Scale Reference")) self.reference_cb.setToolTip( - "Scale the selected object(s)\n" + _tr("Scale the selected object(s)\n" "using the origin reference when checked,\n" "and the center of the biggest bounding box\n" - "of the selected objects when unchecked." + "of the selected objects when unchecked.") ) grid0.addWidget(self.reference_cb, 5, 1) ## Offset distance on X axis self.offx_entry = FCEntry() - self.offx_label = QtWidgets.QLabel("Offset_X val:") + self.offx_label = QtWidgets.QLabel(_tr("Offset_X val:")) self.offx_label.setToolTip( - "Distance to offset on X axis. In current units." + _tr( "Distance to offset on X axis. In current units.") ) grid0.addWidget(self.offx_label, 6, 0) grid0.addWidget(self.offx_entry, 6, 1) ## Offset distance on Y axis self.offy_entry = FCEntry() - self.offy_label = QtWidgets.QLabel("Offset_Y val:") + self.offy_label = QtWidgets.QLabel(_tr("Offset_Y val:")) self.offy_label.setToolTip( - "Distance to offset on Y axis. In current units." + _tr("Distance to offset on Y axis. In current units.") ) grid0.addWidget(self.offy_label, 7, 0) grid0.addWidget(self.offy_entry, 7, 1) ## Mirror (Flip) Reference Point - self.mirror_reference_cb = FCCheckBox("Mirror Reference") + self.mirror_reference_cb = FCCheckBox(_tr("Mirror Reference")) self.mirror_reference_cb.setToolTip( - "Flip the selected object(s)\n" + _tr("Flip the selected object(s)\n" "around the point in Point Entry Field.\n" "\n" "The point coordinates can be captured by\n" @@ -5430,14 +5464,14 @@ class ToolsTransformPrefGroupUI(OptionsGroupUI): "SHIFT key. \n" "Then click Add button to insert coordinates.\n" "Or enter the coords in format (x, y) in the\n" - "Point Entry field and click Flip on X(Y)") + "Point Entry field and click Flip on X(Y)")) grid0.addWidget(self.mirror_reference_cb, 8, 1) - self.flip_ref_label = QtWidgets.QLabel(" Mirror Ref. Point:") + self.flip_ref_label = QtWidgets.QLabel(_tr(" Mirror Ref. Point:")) self.flip_ref_label.setToolTip( - "Coordinates in format (x, y) used as reference for mirroring.\n" + _tr("Coordinates in format (x, y) used as reference for mirroring.\n" "The 'x' in (x, y) will be used when using Flip on X and\n" - "the 'y' in (x, y) will be used when using Flip on Y and" + "the 'y' in (x, y) will be used when using Flip on Y and") ) self.flip_ref_entry = EvalEntry2("(0, 0)") @@ -5452,13 +5486,13 @@ class ToolsSolderpastePrefGroupUI(OptionsGroupUI): super(ToolsSolderpastePrefGroupUI, self).__init__(self) - self.setTitle(str("SolderPaste Tool Options")) + self.setTitle(str(_tr("SolderPaste Tool Options"))) ## Solder Paste Dispensing - self.solderpastelabel = QtWidgets.QLabel("Parameters:") + self.solderpastelabel = QtWidgets.QLabel(_tr("Parameters:")) self.solderpastelabel.setToolTip( - "A tool to create GCode for dispensing\n" - "solder paste onto a PCB." + _tr("A tool to create GCode for dispensing\n" + "solder paste onto a PCB.") ) self.layout.addWidget(self.solderpastelabel) @@ -5466,18 +5500,18 @@ class ToolsSolderpastePrefGroupUI(OptionsGroupUI): self.layout.addLayout(grid0) # Nozzle Tool Diameters - nozzletdlabel = QtWidgets.QLabel('Tools dia:') + nozzletdlabel = QtWidgets.QLabel(_tr('Tools dia:')) nozzletdlabel.setToolTip( - "Diameters of nozzle tools, separated by ','" + _tr("Diameters of nozzle tools, separated by ','") ) self.nozzle_tool_dia_entry = FCEntry() grid0.addWidget(nozzletdlabel, 0, 0) grid0.addWidget(self.nozzle_tool_dia_entry, 0, 1) # New Nozzle Tool Dia - self.addtool_entry_lbl = QtWidgets.QLabel('New Nozzle Dia:') + self.addtool_entry_lbl = QtWidgets.QLabel(_tr('New Nozzle Dia:')) self.addtool_entry_lbl.setToolTip( - "Diameter for the new Nozzle tool to add in the Tool Table" + _tr("Diameter for the new Nozzle tool to add in the Tool Table") ) self.addtool_entry = FCEntry() grid0.addWidget(self.addtool_entry_lbl, 1, 0) @@ -5485,132 +5519,132 @@ class ToolsSolderpastePrefGroupUI(OptionsGroupUI): # Z dispense start self.z_start_entry = FCEntry() - self.z_start_label = QtWidgets.QLabel("Z Dispense Start:") + self.z_start_label = QtWidgets.QLabel(_tr("Z Dispense Start:")) self.z_start_label.setToolTip( - "The height (Z) when solder paste dispensing starts." + _tr("The height (Z) when solder paste dispensing starts.") ) grid0.addWidget(self.z_start_label, 2, 0) grid0.addWidget(self.z_start_entry, 2, 1) # Z dispense self.z_dispense_entry = FCEntry() - self.z_dispense_label = QtWidgets.QLabel("Z Dispense:") + self.z_dispense_label = QtWidgets.QLabel(_tr("Z Dispense:")) self.z_dispense_label.setToolTip( - "The height (Z) when doing solder paste dispensing." + _tr("The height (Z) when doing solder paste dispensing.") ) grid0.addWidget(self.z_dispense_label, 3, 0) grid0.addWidget(self.z_dispense_entry, 3, 1) # Z dispense stop self.z_stop_entry = FCEntry() - self.z_stop_label = QtWidgets.QLabel("Z Dispense Stop:") + self.z_stop_label = QtWidgets.QLabel(_tr("Z Dispense Stop:")) self.z_stop_label.setToolTip( - "The height (Z) when solder paste dispensing stops." + _tr("The height (Z) when solder paste dispensing stops.") ) grid0.addWidget(self.z_stop_label, 4, 0) grid0.addWidget(self.z_stop_entry, 4, 1) # Z travel self.z_travel_entry = FCEntry() - self.z_travel_label = QtWidgets.QLabel("Z Travel:") + self.z_travel_label = QtWidgets.QLabel(_tr("Z Travel:")) self.z_travel_label.setToolTip( - "The height (Z) for travel between pads\n" - "(without dispensing solder paste)." + _tr("The height (Z) for travel between pads\n" + "(without dispensing solder paste).") ) grid0.addWidget(self.z_travel_label, 5, 0) grid0.addWidget(self.z_travel_entry, 5, 1) # Z toolchange location self.z_toolchange_entry = FCEntry() - self.z_toolchange_label = QtWidgets.QLabel("Z Toolchange:") + self.z_toolchange_label = QtWidgets.QLabel(_tr("Z Toolchange:")) self.z_toolchange_label.setToolTip( - "The height (Z) for tool (nozzle) change." + _tr("The height (Z) for tool (nozzle) change.") ) grid0.addWidget(self.z_toolchange_label, 6, 0) grid0.addWidget(self.z_toolchange_entry, 6, 1) # X,Y Toolchange location self.xy_toolchange_entry = FCEntry() - self.xy_toolchange_label = QtWidgets.QLabel("XY Toolchange:") + self.xy_toolchange_label = QtWidgets.QLabel(_tr("XY Toolchange:")) self.xy_toolchange_label.setToolTip( - "The X,Y location for tool (nozzle) change.\n" - "The format is (x, y) where x and y are real numbers." + _tr("The X,Y location for tool (nozzle) change.\n" + "The format is (x, y) where x and y are real numbers.") ) grid0.addWidget(self.xy_toolchange_label, 7, 0) grid0.addWidget(self.xy_toolchange_entry, 7, 1) # Feedrate X-Y self.frxy_entry = FCEntry() - self.frxy_label = QtWidgets.QLabel("Feedrate X-Y:") + self.frxy_label = QtWidgets.QLabel(_tr("Feedrate X-Y:")) self.frxy_label.setToolTip( - "Feedrate (speed) while moving on the X-Y plane." + _tr("Feedrate (speed) while moving on the X-Y plane.") ) grid0.addWidget(self.frxy_label, 8, 0) grid0.addWidget(self.frxy_entry, 8, 1) # Feedrate Z self.frz_entry = FCEntry() - self.frz_label = QtWidgets.QLabel("Feedrate Z:") + self.frz_label = QtWidgets.QLabel(_tr("Feedrate Z:")) self.frz_label.setToolTip( - "Feedrate (speed) while moving vertically\n" - "(on Z plane)." + _tr("Feedrate (speed) while moving vertically\n" + "(on Z plane).") ) grid0.addWidget(self.frz_label, 9, 0) grid0.addWidget(self.frz_entry, 9, 1) # Feedrate Z Dispense self.frz_dispense_entry = FCEntry() - self.frz_dispense_label = QtWidgets.QLabel("Feedrate Z Dispense:") + self.frz_dispense_label = QtWidgets.QLabel(_tr("Feedrate Z Dispense:")) self.frz_dispense_label.setToolTip( - "Feedrate (speed) while moving up vertically\n" - " to Dispense position (on Z plane)." + _tr("Feedrate (speed) while moving up vertically\n" + " to Dispense position (on Z plane).") ) grid0.addWidget(self.frz_dispense_label, 10, 0) grid0.addWidget(self.frz_dispense_entry, 10, 1) # Spindle Speed Forward self.speedfwd_entry = FCEntry() - self.speedfwd_label = QtWidgets.QLabel("Spindle Speed FWD:") + self.speedfwd_label = QtWidgets.QLabel(_tr("Spindle Speed FWD:")) self.speedfwd_label.setToolTip( - "The dispenser speed while pushing solder paste\n" - "through the dispenser nozzle." + _tr("The dispenser speed while pushing solder paste\n" + "through the dispenser nozzle.") ) grid0.addWidget(self.speedfwd_label, 11, 0) grid0.addWidget(self.speedfwd_entry, 11, 1) # Dwell Forward self.dwellfwd_entry = FCEntry() - self.dwellfwd_label = QtWidgets.QLabel("Dwell FWD:") + self.dwellfwd_label = QtWidgets.QLabel(_tr("Dwell FWD:")) self.dwellfwd_label.setToolTip( - "Pause after solder dispensing." + _tr("Pause after solder dispensing.") ) grid0.addWidget(self.dwellfwd_label, 12, 0) grid0.addWidget(self.dwellfwd_entry, 12, 1) # Spindle Speed Reverse self.speedrev_entry = FCEntry() - self.speedrev_label = QtWidgets.QLabel("Spindle Speed REV:") + self.speedrev_label = QtWidgets.QLabel(_tr("Spindle Speed REV:")) self.speedrev_label.setToolTip( - "The dispenser speed while retracting solder paste\n" - "through the dispenser nozzle." + _tr("The dispenser speed while retracting solder paste\n" + "through the dispenser nozzle.") ) grid0.addWidget(self.speedrev_label, 13, 0) grid0.addWidget(self.speedrev_entry, 13, 1) # Dwell Reverse self.dwellrev_entry = FCEntry() - self.dwellrev_label = QtWidgets.QLabel("Dwell REV:") + self.dwellrev_label = QtWidgets.QLabel(_tr("Dwell REV:")) self.dwellrev_label.setToolTip( - "Pause after solder paste dispenser retracted,\n" - "to allow pressure equilibrium." + _tr("Pause after solder paste dispenser retracted,\n" + "to allow pressure equilibrium.") ) grid0.addWidget(self.dwellrev_label, 14, 0) grid0.addWidget(self.dwellrev_entry, 14, 1) # Postprocessors - pp_label = QtWidgets.QLabel('PostProcessors:') + pp_label = QtWidgets.QLabel(_tr('PostProcessors:')) pp_label.setToolTip( - "Files that control the GCode generation." + _tr("Files that control the GCode generation.") ) self.pp_combo = FCComboBox() @@ -5640,13 +5674,13 @@ class FlatCAMActivityView(QtWidgets.QWidget): layout.addWidget(self.icon) self.text = QtWidgets.QLabel(self) - self.text.setText("Idle.") + self.text.setText(_tr("Idle.")) layout.addWidget(self.text) def set_idle(self): self.movie.stop() - self.text.setText("Idle.") + self.text.setText(_tr("Idle.")) def set_busy(self, msg): self.movie.start() @@ -5670,8 +5704,8 @@ class FlatCAMInfoBar(QtWidgets.QWidget): layout.addWidget(self.icon) self.text = QtWidgets.QLabel(self) - self.text.setText("Application started ...") - self.text.setToolTip("Hello!") + self.text.setText(_tr("Application started ...")) + self.text.setToolTip(_tr("Hello!")) layout.addWidget(self.text) diff --git a/README.md b/README.md index 47001274..6272ad92 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,10 @@ CAD program, and create G-Code for Isolation routing. - fixed issue when doing th CTRL (or SHIFT) + LMB, the focus is automatically moved to Project Tab - further work in internationalization, added a fallback to English language in case there is no translation for a string - fix for issue #262: when doing Edit-> Save & Close Editor on a Geometry that is not generated through first entering into an Editor, the geometry disappear -- finished preparing for internationalization for the files: camlib and objectColletion +- finished preparing for internationalization for the files: camlib and objectCollection - fixed tools shortcuts not working anymore due of the new toogle parameter for the .run(). +- finished preparing for internationalization for the files: FlatCAMEditor, FlatCAMGUI + 7.03.2019