Browse Source

- modified all the FlatCAM tools strings to the new format in which the status is no longer included in the translated strings to make it easier for the future translations
- updated POT file with the new strings

Marius Stanciu 6 years ago
parent
commit
88b04f9e7a

+ 1 - 0
README.md

@@ -18,6 +18,7 @@ CAD program, and create G-Code for Isolation routing.
 - some fixes and prepared the activity monitor area to receive updated texts
 - added progress display in status bar for generating CNCJob from Excellon objects
 - added progress display in status bar for generating CNCJob from Geometry objects
+- modified all the FlatCAM tools strings to the new format in which the status is no longer included in the translated strings to make it easier for the future translations
 - updated POT file with the new strings
 
 5.09.2019

+ 18 - 18
flatcamTools/ToolCalculators.py

@@ -307,8 +307,8 @@ class ToolCalculator(FlatCAMTool):
             try:
                 tip_diameter = float(self.tipDia_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         try:
@@ -318,8 +318,8 @@ class ToolCalculator(FlatCAMTool):
             try:
                 half_tip_angle = float(self.tipAngle_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
         half_tip_angle /= 2
 
@@ -330,8 +330,8 @@ class ToolCalculator(FlatCAMTool):
             try:
                 cut_depth = float(self.cutDepth_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         tool_diameter = tip_diameter + (2 * cut_depth * math.tan(math.radians(half_tip_angle)))
@@ -345,8 +345,8 @@ class ToolCalculator(FlatCAMTool):
             try:
                 mm_val = float(self.mm_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
         self.inch_entry.set_value('%.6f' % (mm_val / 25.4))
 
@@ -358,8 +358,8 @@ class ToolCalculator(FlatCAMTool):
             try:
                 inch_val = float(self.inch_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
         self.mm_entry.set_value('%.6f' % (inch_val * 25.4))
 
@@ -372,8 +372,8 @@ class ToolCalculator(FlatCAMTool):
             try:
                 length = float(self.pcblength_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         try:
@@ -383,8 +383,8 @@ class ToolCalculator(FlatCAMTool):
             try:
                 width = float(self.pcbwidth_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         try:
@@ -394,8 +394,8 @@ class ToolCalculator(FlatCAMTool):
             try:
                 density = float(self.cdensity_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         try:
@@ -405,8 +405,8 @@ class ToolCalculator(FlatCAMTool):
             try:
                 copper = float(self.growth_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         calculated_current = (length * width * density) * 0.0021527820833419

+ 64 - 52
flatcamTools/ToolCutOut.py

@@ -368,11 +368,12 @@ class CutOut(FlatCAMTool):
             cutout_obj = self.app.collection.get_by_name(str(name))
         except Exception as e:
             log.debug("CutOut.on_freeform_cutout() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), name))
             return "Could not retrieve object: %s" % name
 
         if cutout_obj is None:
-            self.app.inform.emit(_("[ERROR_NOTCL] There is no object selected for Cutout.\nSelect one and try again."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("There is no object selected for Cutout.\nSelect one and try again."))
             return
 
         try:
@@ -382,12 +383,13 @@ class CutOut(FlatCAMTool):
             try:
                 dia = float(self.dia.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
-                                       "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Tool diameter value is missing or wrong format. Add it and retry."))
                 return
 
         if 0 in {dia}:
-            self.app.inform.emit(_("[WARNING_NOTCL] Tool Diameter is zero value. Change it to a positive real number."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("Tool Diameter is zero value. Change it to a positive real number."))
             return "Tool Diameter is zero value. Change it to a positive real number."
 
         try:
@@ -402,8 +404,8 @@ class CutOut(FlatCAMTool):
             try:
                 margin = float(self.margin.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Margin value is missing or wrong format. "
-                                       "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Margin value is missing or wrong format. Add it and retry."))
                 return
 
         try:
@@ -413,26 +415,27 @@ class CutOut(FlatCAMTool):
             try:
                 gapsize = float(self.gapsize.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Gap size value is missing or wrong format. "
-                                       "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Gap size value is missing or wrong format. Add it and retry."))
                 return
 
         try:
             gaps = self.gaps.get_value()
         except TypeError:
-            self.app.inform.emit(_("[WARNING_NOTCL] Number of gaps value is missing. Add it and retry."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("Number of gaps value is missing. Add it and retry."))
             return
 
         if gaps not in ['None', 'LR', 'TB', '2LR', '2TB', '4', '8']:
-            self.app.inform.emit(_("[WARNING_NOTCL] Gaps value can be only one of: "
-                                   "'None', 'lr', 'tb', '2lr', '2tb', 4 or 8. "
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("Gaps value can be only one of: 'None', 'lr', 'tb', '2lr', '2tb', 4 or 8. "
                                    "Fill in a correct value and retry. "))
             return
 
         if cutout_obj.multigeo is True:
-            self.app.inform.emit(_("[ERROR]Cutout operation cannot be done on a multi-geo Geometry.\n"
-                                   "Optionally, this Multi-geo Geometry can be converted to Single-geo Geometry,\n"
-                                   "and after that perform Cutout."))
+            self.app.inform.emit('[ERROR] %s' % _("Cutout operation cannot be done on a multi-geo Geometry.\n"
+                                                  "Optionally, this Multi-geo Geometry can be converted to "
+                                                  "Single-geo Geometry,\n"
+                                                  "and after that perform Cutout."))
             return
 
         convex_box = self.convex_box.get_value()
@@ -548,7 +551,7 @@ class CutOut(FlatCAMTool):
         self.app.new_object('geometry', outname, geo_init)
 
         cutout_obj.plot()
-        self.app.inform.emit(_("[success] Any form CutOut operation finished."))
+        self.app.inform.emit('[success] %s' % _("Any form CutOut operation finished."))
         self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
         self.app.should_we_save = True
 
@@ -565,11 +568,11 @@ class CutOut(FlatCAMTool):
             cutout_obj = self.app.collection.get_by_name(str(name))
         except Exception as e:
             log.debug("CutOut.on_rectangular_cutout() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), name))
             return "Could not retrieve object: %s" % name
 
         if cutout_obj is None:
-            self.app.inform.emit(_("[ERROR_NOTCL] Object not found: %s") % cutout_obj)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Object not found: %s"), cutout_obj))
 
         try:
             dia = float(self.dia.get_value())
@@ -578,12 +581,13 @@ class CutOut(FlatCAMTool):
             try:
                 dia = float(self.dia.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
-                                       "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Tool diameter value is missing or wrong format. Add it and retry."))
                 return
 
         if 0 in {dia}:
-            self.app.inform.emit(_("[ERROR_NOTCL] Tool Diameter is zero value. Change it to a positive real number."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("Tool Diameter is zero value. Change it to a positive real number."))
             return "Tool Diameter is zero value. Change it to a positive real number."
 
         try:
@@ -598,8 +602,8 @@ class CutOut(FlatCAMTool):
             try:
                 margin = float(self.margin.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Margin value is missing or wrong format. "
-                                       "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Margin value is missing or wrong format. Add it and retry."))
                 return
 
         try:
@@ -609,26 +613,28 @@ class CutOut(FlatCAMTool):
             try:
                 gapsize = float(self.gapsize.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Gap size value is missing or wrong format. "
-                                       "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Gap size value is missing or wrong format. Add it and retry."))
                 return
 
         try:
             gaps = self.gaps.get_value()
         except TypeError:
-            self.app.inform.emit(_("[WARNING_NOTCL] Number of gaps value is missing. Add it and retry."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("Number of gaps value is missing. Add it and retry."))
             return
 
         if gaps not in ['None', 'LR', 'TB', '2LR', '2TB', '4', '8']:
-            self.app.inform.emit(_("[WARNING_NOTCL] Gaps value can be only one of: "
-                                   "'None', 'lr', 'tb', '2lr', '2tb', 4 or 8. "
-                                   "Fill in a correct value and retry. "))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("Gaps value can be only one of: "
+                                                          "'None', 'lr', 'tb', '2lr', '2tb', 4 or 8. "
+                                                          "Fill in a correct value and retry. "))
             return
 
         if cutout_obj.multigeo is True:
-            self.app.inform.emit(_("[ERROR]Cutout operation cannot be done on a multi-geo Geometry.\n"
-                                   "Optionally, this Multi-geo Geometry can be converted to Single-geo Geometry,\n"
-                                   "and after that perform Cutout."))
+            self.app.inform.emit('[ERROR] %s' % _("Cutout operation cannot be done on a multi-geo Geometry.\n"
+                                                  "Optionally, this Multi-geo Geometry can be converted to "
+                                                  "Single-geo Geometry,\n"
+                                                  "and after that perform Cutout."))
             return
 
         # Get min and max data for each object as we just cut rectangles across X or Y
@@ -729,7 +735,8 @@ class CutOut(FlatCAMTool):
         self.app.new_object('geometry', outname, geo_init)
 
         # cutout_obj.plot()
-        self.app.inform.emit(_("[success] Any form CutOut operation finished."))
+        self.app.inform.emit('[success] %s' %
+                             _("Any form CutOut operation finished."))
         self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
         self.app.should_we_save = True
 
@@ -744,12 +751,13 @@ class CutOut(FlatCAMTool):
             try:
                 self.cutting_dia = float(self.dia.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
-                                     "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Tool diameter value is missing or wrong format. Add it and retry."))
                 return
 
         if 0 in {self.cutting_dia}:
-            self.app.inform.emit(_("[ERROR_NOTCL] Tool Diameter is zero value. Change it to a positive real number."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("Tool Diameter is zero value. Change it to a positive real number."))
             return "Tool Diameter is zero value. Change it to a positive real number."
 
         try:
@@ -759,8 +767,8 @@ class CutOut(FlatCAMTool):
             try:
                 self.cutting_gapsize = float(self.gapsize.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Gap size value is missing or wrong format. "
-                                     "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Gap size value is missing or wrong format. Add it and retry."))
                 return
 
         name = self.man_object_combo.currentText()
@@ -769,7 +777,7 @@ class CutOut(FlatCAMTool):
             self.man_cutout_obj = self.app.collection.get_by_name(str(name))
         except Exception as e:
             log.debug("CutOut.on_manual_cutout() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve Geometry object: %s") % name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve Geometry object"), name))
             return "Could not retrieve object: %s" % name
 
         self.app.plotcanvas.vis_disconnect('key_press', self.app.ui.keyPressEvent)
@@ -788,12 +796,12 @@ class CutOut(FlatCAMTool):
             self.man_cutout_obj = self.app.collection.get_by_name(str(name))
         except Exception as e:
             log.debug("CutOut.on_manual_cutout() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve Geometry object: %s") % name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve Geometry object"), name))
             return "Could not retrieve object: %s" % name
 
         if self.man_cutout_obj is None:
-            self.app.inform.emit(
-                _("[ERROR_NOTCL] Geometry object for manual cutout not found: %s") % self.man_cutout_obj)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                 (_("Geometry object for manual cutout not found"), self.man_cutout_obj))
             return
 
         # use the snapped position as reference
@@ -803,7 +811,7 @@ class CutOut(FlatCAMTool):
         self.man_cutout_obj.subtract_polygon(cut_poly)
 
         self.man_cutout_obj.plot()
-        self.app.inform.emit(_("[success] Added manual Bridge Gap."))
+        self.app.inform.emit('[success] %s' % _("Added manual Bridge Gap."))
 
         self.app.should_we_save = True
 
@@ -815,16 +823,18 @@ class CutOut(FlatCAMTool):
             cutout_obj = self.app.collection.get_by_name(str(name))
         except Exception as e:
             log.debug("CutOut.on_manual_geo() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve Gerber object: %s") % name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve Gerber object"), name))
             return "Could not retrieve object: %s" % name
 
         if cutout_obj is None:
-            self.app.inform.emit(_("[ERROR_NOTCL] There is no Gerber object selected for Cutout.\n"
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("There is no Gerber object selected for Cutout.\n"
                                    "Select one and try again."))
             return
 
         if not isinstance(cutout_obj, FlatCAMGerber):
-            self.app.inform.emit(_("[ERROR_NOTCL] The selected object has to be of Gerber type.\n"
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("The selected object has to be of Gerber type.\n"
                                    "Select a Gerber file and try again."))
             return
 
@@ -835,12 +845,13 @@ class CutOut(FlatCAMTool):
             try:
                 dia = float(self.dia.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
-                                       "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Tool diameter value is missing or wrong format. Add it and retry."))
                 return
 
         if 0 in {dia}:
-            self.app.inform.emit(_("[ERROR_NOTCL] Tool Diameter is zero value. Change it to a positive real number."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("Tool Diameter is zero value. Change it to a positive real number."))
             return "Tool Diameter is zero value. Change it to a positive real number."
 
         try:
@@ -855,8 +866,8 @@ class CutOut(FlatCAMTool):
             try:
                 margin = float(self.margin.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Margin value is missing or wrong format. "
-                                       "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Margin value is missing or wrong format. Add it and retry."))
                 return
 
         convex_box = self.convex_box.get_value()
@@ -877,7 +888,8 @@ class CutOut(FlatCAMTool):
                     geo = box(x0, y0, x1, y1)
                     geo_obj.solid_geometry = geo.buffer(margin + abs(dia / 2))
                 else:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Geometry not supported for cutout: %s") % type(geo_union))
+                    self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                         (_("Geometry not supported for cutout"), type(geo_union)))
                     return 'fail'
             else:
                 geo = geo_union

+ 27 - 25
flatcamTools/ToolDblSided.py

@@ -328,8 +328,8 @@ class DblSidedTool(FlatCAMTool):
             try:
                 px, py = self.point_entry.get_value()
             except TypeError:
-                self.app.inform.emit(_("[WARNING_NOTCL] 'Point' reference is selected and 'Point' coordinates "
-                                       "are missing. Add them and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("'Point' reference is selected and 'Point' coordinates "
+                                                              "are missing. Add them and retry."))
                 return
         else:
             selection_index = self.box_combo.currentIndex()
@@ -347,7 +347,7 @@ class DblSidedTool(FlatCAMTool):
                         bb_obj = model_index.internalPointer().obj
                     except AttributeError:
                         self.app.inform.emit(
-                            _("[WARNING_NOTCL] There is no Box reference object loaded. Load one and retry."))
+                            '[WARNING_NOTCL] %s' % _("There is no Box reference object loaded. Load one and retry."))
                         return
 
             xmin, ymin, xmax, ymax = bb_obj.bounds()
@@ -364,20 +364,21 @@ class DblSidedTool(FlatCAMTool):
                 dia = float(self.drill_dia.get_value().replace(',', '.'))
                 self.drill_dia.set_value(dia)
             except ValueError:
-                self.app.inform.emit(_("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
-                                       "Add it and retry."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("Tool diameter value is missing or wrong format. "
+                                                              "Add it and retry."))
                 return
 
         if dia is '':
-            self.app.inform.emit(_("[WARNING_NOTCL] No value or wrong format in Drill Dia entry. Add it and retry."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("No value or wrong format in Drill Dia entry. Add it and retry."))
             return
         tools = {"1": {"C": dia}}
 
         # holes = self.alignment_holes.get_value()
         holes = eval('[{}]'.format(self.alignment_holes.text()))
         if not holes:
-            self.app.inform.emit(_("[WARNING_NOTCL] There are no Alignment Drill Coordinates to use. "
-                                   "Add them and retry."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("There are no Alignment Drill Coordinates to use. "
+                                                          "Add them and retry."))
             return
 
         drills = []
@@ -399,7 +400,7 @@ class DblSidedTool(FlatCAMTool):
 
         self.app.new_object("excellon", "Alignment Drills", obj_init)
         self.drill_values = ''
-        self.app.inform.emit(_("[success] Excellon object with alignment drills created..."))
+        self.app.inform.emit('[success] %s' % _("Excellon object with alignment drills created..."))
 
     def on_mirror_gerber(self):
         selection_index = self.gerber_object_combo.currentIndex()
@@ -408,11 +409,11 @@ class DblSidedTool(FlatCAMTool):
         try:
             fcobj = model_index.internalPointer().obj
         except Exception as e:
-            self.app.inform.emit(_("[WARNING_NOTCL] There is no Gerber object loaded ..."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("There is no Gerber object loaded ..."))
             return
 
         if not isinstance(fcobj, FlatCAMGerber):
-            self.app.inform.emit(_("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Only Gerber, Excellon and Geometry objects can be mirrored."))
             return
 
         axis = self.mirror_axis.get_value()
@@ -422,8 +423,8 @@ class DblSidedTool(FlatCAMTool):
             try:
                 px, py = self.point_entry.get_value()
             except TypeError:
-                self.app.inform.emit(_("[WARNING_NOTCL] 'Point' coordinates missing. "
-                                       "Using Origin (0, 0) as mirroring reference."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("'Point' coordinates missing. "
+                                                              "Using Origin (0, 0) as mirroring reference."))
                 px, py = (0, 0)
 
         else:
@@ -432,7 +433,7 @@ class DblSidedTool(FlatCAMTool):
             try:
                 bb_obj = model_index_box.internalPointer().obj
             except Exception as e:
-                self.app.inform.emit(_("[WARNING_NOTCL] There is no Box object loaded ..."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("There is no Box object loaded ..."))
                 return
 
             xmin, ymin, xmax, ymax = bb_obj.bounds()
@@ -442,7 +443,7 @@ class DblSidedTool(FlatCAMTool):
         fcobj.mirror(axis, [px, py])
         self.app.object_changed.emit(fcobj)
         fcobj.plot()
-        self.app.inform.emit(_("[success] Gerber %s was mirrored...") % str(fcobj.options['name']))
+        self.app.inform.emit('[success] Gerber %s %s...' % (str(fcobj.options['name']), _("was mirrored")))
 
     def on_mirror_exc(self):
         selection_index = self.exc_object_combo.currentIndex()
@@ -451,11 +452,11 @@ class DblSidedTool(FlatCAMTool):
         try:
             fcobj = model_index.internalPointer().obj
         except Exception as e:
-            self.app.inform.emit(_("[WARNING_NOTCL] There is no Excellon object loaded ..."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("There is no Excellon object loaded ..."))
             return
 
         if not isinstance(fcobj, FlatCAMExcellon):
-            self.app.inform.emit(_("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Only Gerber, Excellon and Geometry objects can be mirrored."))
             return
 
         axis = self.mirror_axis.get_value()
@@ -466,8 +467,8 @@ class DblSidedTool(FlatCAMTool):
                 px, py = self.point_entry.get_value()
             except Exception as e:
                 log.debug("DblSidedTool.on_mirror_geo() --> %s" % str(e))
-                self.app.inform.emit(_("[WARNING_NOTCL] There are no Point coordinates in the Point field. "
-                                       "Add coords and try again ..."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("There are no Point coordinates in the Point field. "
+                                                              "Add coords and try again ..."))
                 return
         else:
             selection_index_box = self.box_combo.currentIndex()
@@ -476,7 +477,7 @@ class DblSidedTool(FlatCAMTool):
                 bb_obj = model_index_box.internalPointer().obj
             except Exception as e:
                 log.debug("DblSidedTool.on_mirror_geo() --> %s" % str(e))
-                self.app.inform.emit(_("[WARNING_NOTCL] There is no Box object loaded ..."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("There is no Box object loaded ..."))
                 return
 
             xmin, ymin, xmax, ymax = bb_obj.bounds()
@@ -486,7 +487,7 @@ class DblSidedTool(FlatCAMTool):
         fcobj.mirror(axis, [px, py])
         self.app.object_changed.emit(fcobj)
         fcobj.plot()
-        self.app.inform.emit(_("[success] Excellon %s was mirrored...") % str(fcobj.options['name']))
+        self.app.inform.emit('[success] Excellon %s %s...' % (str(fcobj.options['name']), _("was mirrored")))
 
     def on_mirror_geo(self):
         selection_index = self.geo_object_combo.currentIndex()
@@ -495,11 +496,11 @@ class DblSidedTool(FlatCAMTool):
         try:
             fcobj = model_index.internalPointer().obj
         except Exception as e:
-            self.app.inform.emit(_("[WARNING_NOTCL] There is no Geometry object loaded ..."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("There is no Geometry object loaded ..."))
             return
 
         if not isinstance(fcobj, FlatCAMGeometry):
-            self.app.inform.emit(_("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Only Gerber, Excellon and Geometry objects can be mirrored."))
             return
 
         axis = self.mirror_axis.get_value()
@@ -513,7 +514,7 @@ class DblSidedTool(FlatCAMTool):
             try:
                 bb_obj = model_index_box.internalPointer().obj
             except Exception as e:
-                self.app.inform.emit(_("[WARNING_NOTCL] There is no Box object loaded ..."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("There is no Box object loaded ..."))
                 return
 
             xmin, ymin, xmax, ymax = bb_obj.bounds()
@@ -523,7 +524,8 @@ class DblSidedTool(FlatCAMTool):
         fcobj.mirror(axis, [px, py])
         self.app.object_changed.emit(fcobj)
         fcobj.plot()
-        self.app.inform.emit(_("[success] Geometry %s was mirrored...") % str(fcobj.options['name']))
+        self.app.inform.emit('[success] Geometry %s %s...' % (str(fcobj.options['name']), _("was mirrored")))
+
 
     def on_point_add(self):
         val = self.app.defaults["global_point_clipboard_format"] % (self.app.pos[0], self.app.pos[1])

+ 8 - 8
flatcamTools/ToolFilm.py

@@ -227,13 +227,15 @@ class Film(FlatCAMTool):
         try:
             name = self.tf_object_combo.currentText()
         except Exception as e:
-            self.app.inform.emit(_("[ERROR_NOTCL] No FlatCAM object selected. Load an object for Film and retry."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("No FlatCAM object selected. Load an object for Film and retry."))
             return
 
         try:
             boxname = self.tf_box_combo.currentText()
         except Exception as e:
-            self.app.inform.emit(_("[ERROR_NOTCL] No FlatCAM object selected. Load an object for Box and retry."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("No FlatCAM object selected. Load an object for Box and retry."))
             return
 
         try:
@@ -243,15 +245,13 @@ class Film(FlatCAMTool):
             try:
                 border = float(self.boundary_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                     "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' % _("Wrong value format entered, use a number."))
                 return
 
         try:
             scale_stroke_width = int(self.film_scale_entry.get_value())
         except ValueError:
-            self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                 "use a number."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Wrong value format entered, use a number."))
             return
 
         if border is None:
@@ -271,7 +271,7 @@ class Film(FlatCAMTool):
             filename = str(filename)
 
             if str(filename) == "":
-                self.app.inform.emit(_("[WARNING_NOTCL] Export SVG positive cancelled."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("Export SVG positive cancelled."))
                 return
             else:
                 self.app.export_svg_black(name, boxname, filename, scale_factor=scale_stroke_width)
@@ -287,7 +287,7 @@ class Film(FlatCAMTool):
             filename = str(filename)
 
             if str(filename) == "":
-                self.app.inform.emit(_("[WARNING_NOTCL] Export SVG negative cancelled."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("Export SVG negative cancelled."))
                 return
             else:
                 self.app.export_svg_negative(name, boxname, filename, border, scale_factor=scale_stroke_width)

+ 11 - 10
flatcamTools/ToolMove.py

@@ -85,7 +85,7 @@ class ToolMove(FlatCAMTool):
                 self.setVisible(False)
                 # signal that there is no command active
                 self.app.command_active = None
-                self.app.inform.emit(_("[WARNING_NOTCL] MOVE action cancelled. No object(s) to move."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("MOVE action cancelled. No object(s) to move."))
 
     def on_left_click(self, event):
         # mouse click will be accepted only if the left button is clicked
@@ -132,7 +132,7 @@ class ToolMove(FlatCAMTool):
 
                         try:
                             if not obj_list:
-                                self.app.inform.emit(_("[WARNING_NOTCL] No object(s) selected."))
+                                self.app.inform.emit('[WARNING_NOTCL] %s' % _("No object(s) selected."))
                                 return "fail"
                             else:
                                 for sel_obj in obj_list:
@@ -155,14 +155,15 @@ class ToolMove(FlatCAMTool):
                                     # self.app.collection.set_active(sel_obj.options['name'])
                         except Exception as e:
                             proc.done()
-                            self.app.inform.emit(_('[ERROR_NOTCL] '
-                                                 'ToolMove.on_left_click() --> %s') % str(e))
+                            self.app.inform.emit('[ERROR_NOTCL] %s --> %s' % (_('ToolMove.on_left_click('), str(e)))
                             return "fail"
                         proc.done()
                         # delete the selection bounding box
                         self.delete_shape()
-                        self.app.inform.emit(_('[success] %s object was moved ...') %
-                                             str(sel_obj.kind).capitalize())
+                        self.app.inform.emit('[success] %s %s' % (str(sel_obj.kind).capitalize(),
+                                                                  _('object was moved ...')
+                                                                  )
+                                             )
 
                     self.app.worker_task.emit({'fcn': job_move, 'params': [self]})
 
@@ -171,8 +172,8 @@ class ToolMove(FlatCAMTool):
                     return
 
                 except TypeError:
-                    self.app.inform.emit(_('[ERROR_NOTCL] '
-                                         'ToolMove.on_left_click() --> Error when mouse left click.'))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                         _('ToolMove.on_left_click() --> Error when mouse left click.'))
                     return
 
             self.clicked_move = 1
@@ -199,7 +200,7 @@ class ToolMove(FlatCAMTool):
     def on_key_press(self, event):
         if event.key == 'escape':
             # abort the move action
-            self.app.inform.emit(_("[WARNING_NOTCL] Move action cancelled."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("Move action cancelled."))
             self.toggle()
         return
 
@@ -211,7 +212,7 @@ class ToolMove(FlatCAMTool):
 
         obj_list = self.app.collection.get_selected()
         if not obj_list:
-            self.app.inform.emit(_("[WARNING_NOTCL] Object(s) not selected"))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("Object(s) not selected"))
             self.toggle()
         else:
             # if we have an object selected then we can safely activate the mouse events

+ 62 - 62
flatcamTools/ToolNonCopperClear.py

@@ -859,8 +859,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
                     try:
                         tip_dia = float(self.tipdia_entry.get_value().replace(',', '.'))
                     except ValueError:
-                        self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                               "use a number."))
+                        self.app.inform.emit('[ERROR_NOTCL] %s' % _("Wrong value format entered, "
+                                                                    "use a number."))
                         return
 
                 try:
@@ -870,8 +870,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                     try:
                         tip_angle = float(self.tipangle_entry.get_value().replace(',', '.')) / 2
                     except ValueError:
-                        self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                               "use a number."))
+                        self.app.inform.emit('[ERROR_NOTCL] %s' % _("Wrong value format entered, use a number."))
                         return
 
                 try:
@@ -881,8 +880,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                     try:
                         cut_z = float(self.cutz_entry.get_value().replace(',', '.'))
                     except ValueError:
-                        self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                               "use a number."))
+                        self.app.inform.emit('[ERROR_NOTCL] %s' % _("Wrong value format entered, use a number."))
                         return
                 # calculated tool diameter so the cut_z parameter is obeyed
                 tool_dia = tip_dia + 2 * cut_z * math.tan(math.radians(tip_angle))
@@ -900,13 +898,12 @@ class NonCopperClear(FlatCAMTool, Gerber):
                     try:
                         tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
                     except ValueError:
-                        self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                               "use a number."))
+                        self.app.inform.emit('[ERROR_NOTCL] %s' % _("Wrong value format entered, use a number."))
                         return
 
             if tool_dia is None:
                 self.build_ui()
-                self.app.inform.emit(_("[WARNING_NOTCL] Please enter a tool diameter to add, in Float format."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("Please enter a tool diameter to add, in Float format."))
                 return
 
         if self.units == 'MM':
@@ -915,8 +912,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
             tool_dia = float('%.4f' % tool_dia)
 
         if tool_dia == 0:
-            self.app.inform.emit(_("[WARNING_NOTCL] Please enter a tool diameter with non-zero value, "
-                                   "in Float format."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("Please enter a tool diameter with non-zero value, "
+                                                          "in Float format."))
             return
 
         # construct a list of all 'tooluid' in the self.tools
@@ -940,12 +937,12 @@ class NonCopperClear(FlatCAMTool, Gerber):
 
         if float('%.4f' % tool_dia) in tool_dias:
             if muted is None:
-                self.app.inform.emit(_("[WARNING_NOTCL] Adding tool cancelled. Tool already in Tool Table."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("Adding tool cancelled. Tool already in Tool Table."))
             self.tools_table.itemChanged.connect(self.on_tool_edit)
             return
         else:
             if muted is None:
-                self.app.inform.emit(_("[success] New tool added to Tool Table."))
+                self.app.inform.emit('[success] %s' % _("New tool added to Tool Table."))
             self.ncc_tools.update({
                 int(self.tooluid): {
                     'tooldia': float('%.4f' % tool_dia),
@@ -980,7 +977,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                 try:
                     new_tool_dia = float(self.tools_table.item(row, 1).text().replace(',', '.'))
                 except ValueError:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
+                    self.app.inform.emit('[ERROR_NOTCL]  %s' % _("Wrong value format entered, "
                                          "use a number."))
                     return
 
@@ -989,7 +986,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
             # identify the tool that was edited and get it's tooluid
             if new_tool_dia not in tool_dias:
                 self.ncc_tools[tooluid]['tooldia'] = new_tool_dia
-                self.app.inform.emit(_("[success] Tool from Tool Table was edited."))
+                self.app.inform.emit('[success] %s' % _("Tool from Tool Table was edited."))
                 self.build_ui()
                 return
             else:
@@ -1000,8 +997,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
                         break
                 restore_dia_item = self.tools_table.item(row, 1)
                 restore_dia_item.setText(str(old_tool_dia))
-                self.app.inform.emit(_("[WARNING_NOTCL] Edit cancelled. "
-                                       "New diameter value is already in the Tool Table."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _("Edit cancelled. "
+                                                              "New diameter value is already in the Tool Table."))
         self.build_ui()
 
     def on_tool_delete(self, rows_to_delete=None, all=None):
@@ -1040,12 +1037,12 @@ class NonCopperClear(FlatCAMTool, Gerber):
                     self.ncc_tools.pop(t, None)
 
         except AttributeError:
-            self.app.inform.emit(_("[WARNING_NOTCL] Delete failed. Select a tool to delete."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("Delete failed. Select a tool to delete."))
             return
         except Exception as e:
             log.debug(str(e))
 
-        self.app.inform.emit(_("[success] Tool(s) deleted from Tool Table."))
+        self.app.inform.emit('[success] %s' % _("Tool(s) deleted from Tool Table."))
         self.build_ui()
 
     def on_ncc_click(self):
@@ -1062,13 +1059,13 @@ class NonCopperClear(FlatCAMTool, Gerber):
             try:
                 overlap = float(self.ncc_overlap_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL]  %s' % _("Wrong value format entered, "
+                                                             "use a number."))
                 return
 
         if overlap >= 1 or overlap < 0:
-            self.app.inform.emit(_("[ERROR_NOTCL] Overlap value must be between "
-                                   "0 (inclusive) and 1 (exclusive), "))
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Overlap value must be between "
+                                                        "0 (inclusive) and 1 (exclusive), "))
             return
 
         connect = self.ncc_connect_cb.get_value()
@@ -1083,11 +1080,11 @@ class NonCopperClear(FlatCAMTool, Gerber):
         try:
             self.ncc_obj = self.app.collection.get_by_name(self.obj_name)
         except Exception as e:
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.obj_name)
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Could not retrieve object: %s") % self.obj_name)
             return "Could not retrieve object: %s" % self.obj_name
 
         if self.ncc_obj is None:
-            self.app.inform.emit(_("[ERROR_NOTCL] Object not found: %s") % self.ncc_obj)
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Object not found: %s") % self.ncc_obj)
             return
 
         # use the selected tools in the tool table; get diameters for non-copper clear
@@ -1103,8 +1100,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
                     try:
                         tooldia = float(self.tools_table.item(x.row(), 1).text().replace(',', '.'))
                     except ValueError:
-                        self.app.inform.emit(_("[ERROR_NOTCL] Wrong Tool Dia value format entered, "
-                                               "use a number."))
+                        self.app.inform.emit('[ERROR_NOTCL] %s' % _("Wrong Tool Dia value format entered, "
+                                                                    "use a number."))
                         continue
 
                 if self.tools_table.cellWidget(x.row(), 4).currentText() == 'iso_op':
@@ -1112,7 +1109,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                 else:
                     ncc_dia_list.append(tooldia)
         else:
-            self.app.inform.emit(_("[ERROR_NOTCL] No selected tools in Tool Table."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("No selected tools in Tool Table."))
             return
 
         o_name = '%s_ncc' % self.obj_name
@@ -1124,7 +1121,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
             try:
                 self.bound_obj = self.app.collection.get_by_name(self.bound_obj_name)
             except Exception as e:
-                self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.obj_name)
+                self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), self.obj_name))
                 return "Could not retrieve object: %s" % self.obj_name
 
             self.clear_copper(ncc_obj=self.ncc_obj,
@@ -1137,7 +1134,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                               contour=contour,
                               rest=rest)
         elif select_method == 'area':
-            self.app.inform.emit(_("[WARNING_NOTCL] Click the start point of the area."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("Click the start point of the area."))
 
             # use the first tool in the tool table; get the diameter
             # tooldia = float('%.4f' % float(self.tools_table.item(0, 1).text()))
@@ -1148,7 +1145,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                 if event.button == 1:
                     if self.first_click is False:
                         self.first_click = True
-                        self.app.inform.emit(_("[WARNING_NOTCL] Click the end point of the paint area."))
+                        self.app.inform.emit('[WARNING_NOTCL] %s' % _("Click the end point of the paint area."))
 
                         self.cursor_pos = self.app.plotcanvas.translate_coords(event.pos)
                         if self.app.grid_status() == True:
@@ -1265,7 +1262,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
             try:
                 self.bound_obj = self.app.collection.get_by_name(self.bound_obj_name)
             except Exception as e:
-                self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.bound_obj_name)
+                self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), self.bound_obj_name))
                 return "Could not retrieve object: %s. Error: %s" % (self.bound_obj_name, str(e))
 
             self.clear_copper(ncc_obj=self.ncc_obj,
@@ -1339,8 +1336,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                 try:
                     ncc_margin = float(self.ncc_margin_entry.get_value().replace(',', '.'))
                 except ValueError:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                           "use a number."))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' % _("Wrong value format entered, use a number."))
                     return
 
         if select_method is not None:
@@ -1366,8 +1362,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                 try:
                     ncc_offset = float(self.ncc_offset_spinner.get_value())
                 except ValueError:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                           "use a number."))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' % _("Wrong value format entered, use a number."))
                     return
 
         # ######################################################################################################
@@ -1417,7 +1412,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                 bounding_box = env_obj.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
             except Exception as e:
                 log.debug("NonCopperClear.clear_copper() 'itself'  --> %s" % str(e))
-                self.app.inform.emit(_("[ERROR_NOTCL] No object available."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' % _("No object available."))
                 return 'fail'
         elif ncc_select == 'area':
             geo_n = cascaded_union(self.sel_rect)
@@ -1451,7 +1446,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                 bounding_box = cascaded_union(self.ncc_obj.solid_geometry).convex_hull.intersection(geo_n)
                 bounding_box = bounding_box.buffer(distance=ncc_margin, join_style=base.JOIN_STYLE.mitre)
             else:
-                self.app.inform.emit(_("[ERROR_NOTCL] The reference object type is not supported."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' % _("The reference object type is not supported."))
                 return 'fail'
 
         log.debug("Copper clearing. Finished non-copper polygons.")
@@ -1507,9 +1502,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
             if isinstance(ncc_obj, FlatCAMGerber) and not isotooldia:
                 sol_geo = ncc_obj.solid_geometry
                 if has_offset is True:
-                    app_obj.inform.emit(_("[WARNING_NOTCL] Buffering ..."))
+                    app_obj.inform.emit('[WARNING_NOTCL] %s' % _("Buffering ..."))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
-                    app_obj.inform.emit(_("[success] Buffering finished ..."))
+                    app_obj.inform.emit('[success] %s' % _("Buffering finished ..."))
                 empty = self.get_ncc_empty_area(target=sol_geo, boundary=bounding_box)
             elif isinstance(ncc_obj, FlatCAMGerber) and isotooldia:
                 isolated_geo = []
@@ -1527,7 +1522,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                         isolated_geo = self.generate_envelope(tool_iso / 2, 0)
 
                     if isolated_geo == 'fail':
-                        app_obj.inform.emit(_("[ERROR_NOTCL] Isolation geometry could not be generated."))
+                        app_obj.inform.emit('[ERROR_NOTCL] %s' % _("Isolation geometry could not be generated."))
                     else:
                         try:
                             for geo_elem in isolated_geo:
@@ -1589,21 +1584,22 @@ class NonCopperClear(FlatCAMTool, Gerber):
                 if has_offset is True:
                     app_obj.inform.emit(_("[WARNING_NOTCL] Buffering ..."))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
-                    app_obj.inform.emit(_("[success] Buffering finished ..."))
+                    app_obj.inform.emit('[success] %s' % _("Buffering finished ..."))
                 empty = self.get_ncc_empty_area(target=sol_geo, boundary=bounding_box)
             elif isinstance(ncc_obj, FlatCAMGeometry):
                 sol_geo = cascaded_union(ncc_obj.solid_geometry)
                 if has_offset is True:
                     app_obj.inform.emit(_("[WARNING_NOTCL] Buffering ..."))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
-                    app_obj.inform.emit(_("[success] Buffering finished ..."))
+                    app_obj.inform.emit('[success] %' % _("Buffering finished ..."))
                 empty = self.get_ncc_empty_area(target=sol_geo, boundary=bounding_box)
             else:
-                app_obj.inform.emit(_('[ERROR_NOTCL] The selected object is not suitable for copper clearing.'))
+                app_obj.inform.emit('[ERROR_NOTCL] %' % _('The selected object is not suitable for copper clearing.'))
                 return
 
             if empty.is_empty:
-                app_obj.inform.emit(_("[ERROR_NOTCL] Could not get the extent of the area to be non copper cleared."))
+                app_obj.inform.emit('[ERROR_NOTCL] %s' %
+                                    _("Could not get the extent of the area to be non copper cleared."))
                 return 'fail'
 
             if type(empty) is Polygon:
@@ -1747,19 +1743,22 @@ class NonCopperClear(FlatCAMTool, Gerber):
                 if geo_obj.tools[tooluid]['solid_geometry']:
                     has_solid_geo += 1
             if has_solid_geo == 0:
-                app_obj.inform.emit(_("[ERROR] There is no Painting Geometry in the file.\n"
-                                      "Usually it means that the tool diameter is too big for the painted geometry.\n"
-                                      "Change the painting parameters and try again."))
+                app_obj.inform.emit('[ERROR] %s' % _("There is no Painting Geometry in the file.\n"
+                                                     "Usually it means that the tool diameter is too big "
+                                                     "for the painted geometry.\n"
+                                                     "Change the painting parameters and try again."))
                 return
 
             # Experimental...
             # print("Indexing...", end=' ')
             # geo_obj.make_index()
             if warning_flag == 0:
-                self.app.inform.emit(_("[success] Non-Copper clear all done."))
+                self.app.inform.emit('[success] %s' % _("Non-Copper clear all done."))
             else:
-                self.app.inform.emit('%s: %s %s.' % (_("[WARNING] Non-Copper clear all done but the copper features "
-                                                       "isolation is broken for"), str(warning_flag),  _("tools")))
+                self.app.inform.emit('[WARNING] %s: %s %s.' % (_("Non-Copper clear all done but the copper features "
+                                                                 "isolation is broken for"),
+                                                               str(warning_flag),
+                                                               _("tools")))
 
         # ###########################################################################################
         # Initializes the new geometry object for the case of the rest-machining ####################
@@ -1793,9 +1792,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
             if isinstance(ncc_obj, FlatCAMGerber) and not isotooldia:
                 sol_geo = ncc_obj.solid_geometry
                 if has_offset is True:
-                    app_obj.inform.emit(_("[WARNING_NOTCL] Buffering ..."))
+                    app_obj.inform.emit('[WARNING_NOTCL] %s' % _("Buffering ..."))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
-                    app_obj.inform.emit(_("[success] Buffering finished ..."))
+                    app_obj.inform.emit('[success] %s' % _("Buffering finished ..."))
                 empty = self.get_ncc_empty_area(target=sol_geo, boundary=bounding_box)
             elif isinstance(ncc_obj, FlatCAMGerber) and isotooldia:
                 isolated_geo = []
@@ -1813,7 +1812,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
                         isolated_geo = self.generate_envelope(tool_iso, 0)
 
                     if isolated_geo == 'fail':
-                        app_obj.inform.emit(_("[ERROR_NOTCL] Isolation geometry could not be generated."))
+                        app_obj.inform.emit('[ERROR_NOTCL] %s' % _("Isolation geometry could not be generated."))
                     else:
                         try:
                             for geo_elem in isolated_geo:
@@ -1873,23 +1872,24 @@ class NonCopperClear(FlatCAMTool, Gerber):
 
                 sol_geo = cascaded_union(isolated_geo)
                 if has_offset is True:
-                    app_obj.inform.emit(_("[WARNING_NOTCL] Buffering ..."))
+                    app_obj.inform.emit('[WARNING_NOTCL] %s' % _("Buffering ..."))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
-                    app_obj.inform.emit(_("[success] Buffering finished ..."))
+                    app_obj.inform.emit('[success] %s' % _("Buffering finished ..."))
                 empty = self.get_ncc_empty_area(target=sol_geo, boundary=bounding_box)
             elif isinstance(ncc_obj, FlatCAMGeometry):
                 sol_geo = cascaded_union(ncc_obj.solid_geometry)
                 if has_offset is True:
                     app_obj.inform.emit(_("[WARNING_NOTCL] Buffering ..."))
                     sol_geo = sol_geo.buffer(distance=ncc_offset)
-                    app_obj.inform.emit(_("[success] Buffering finished ..."))
+                    app_obj.inform.emit('[success] %s' % _("Buffering finished ..."))
                 empty = self.get_ncc_empty_area(target=sol_geo, boundary=bounding_box)
             else:
-                app_obj.inform.emit(_('[ERROR_NOTCL] The selected object is not suitable for copper clearing.'))
+                app_obj.inform.emit('[ERROR_NOTCL] %s' % _('The selected object is not suitable for copper clearing.'))
                 return
 
             if empty.is_empty:
-                app_obj.inform.emit(_("[ERROR_NOTCL] Could not get the extent of the area to be non copper cleared."))
+                app_obj.inform.emit('[ERROR_NOTCL] %s' %
+                                    _("Could not get the extent of the area to be non copper cleared."))
                 return 'fail'
 
             if type(empty) is Polygon:
@@ -2048,11 +2048,11 @@ class NonCopperClear(FlatCAMTool, Gerber):
             # it will be updated only if there is a solid_geometry for tools
             if geo_obj.tools:
                 if warning_flag == 0:
-                    self.app.inform.emit(_("[success] Non-Copper Rest Machining clear all done."))
+                    self.app.inform.emit('[success] %s' % _("Non-Copper Rest Machining clear all done."))
                 else:
                     self.app.inform.emit(
-                        '%s: %s %s.' % (_("[WARNING] Non-Copper Rest Machining clear all done but the copper features "
-                                          "isolation is broken for"), str(warning_flag), _("tools")))
+                        '[WARNING] %s: %s %s.' % (_("Non-Copper Rest Machining clear all done but the copper features "
+                                                    "isolation is broken for"), str(warning_flag), _("tools")))
                 return
             else:
                 # I will use this variable for this purpose although it was meant for something else

+ 11 - 8
flatcamTools/ToolPDF.py

@@ -156,7 +156,7 @@ class ToolPDF(FlatCAMTool):
             filenames, _f = QtWidgets.QFileDialog.getOpenFileNames(caption=_("Open PDF"), filter=_filter_)
 
         if len(filenames) == 0:
-            self.app.inform.emit(_("[WARNING_NOTCL] Open PDF cancelled."))
+            self.app.inform.emit('[WARNING_NOTCL] %s.' % _("Open PDF cancelled"))
         else:
             # start the parsing timer with a period of 1 second
             self.periodic_check(1000)
@@ -241,8 +241,7 @@ class ToolPDF(FlatCAMTool):
                 name_tool += 1
 
                 # create tools dictionary
-                spec = {"C": dia}
-                spec['solid_geometry'] = []
+                spec = {"C": dia, 'solid_geometry': []}
                 exc_obj.tools[str(name_tool)] = spec
 
                 # create drill list of dictionaries
@@ -259,19 +258,22 @@ class ToolPDF(FlatCAMTool):
             for tool in exc_obj.tools:
                 if exc_obj.tools[tool]['solid_geometry']:
                     return
-            app_obj.inform.emit(_("[ERROR_NOTCL] No geometry found in file: %s") % outname)
+            app_obj.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                (_("No geometry found in file"), outname))
             return "fail"
 
         with self.app.proc_container.new(_("Rendering PDF layer #%d ...") % int(layer_nr)):
 
             ret_val = self.app.new_object("excellon", outname, obj_init, autoselected=False)
             if ret_val == 'fail':
-                self.app.inform.emit(_('[ERROR_NOTCL] Open PDF file failed.'))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _('Open PDF file failed.'))
                 return
             # Register recent file
             self.app.file_opened.emit("excellon", filename)
             # GUI feedback
-            self.app.inform.emit(_("[success] Rendered: %s") % outname)
+            self.app.inform.emit('[success] %s: %s' %
+                                 (_("Rendered"),  outname))
 
     def layer_rendering_as_gerber(self, filename, ap_dict, layer_nr):
         outname = filename.split('/')[-1].split('\\')[-1] + "_%s" % str(layer_nr)
@@ -339,12 +341,13 @@ class ToolPDF(FlatCAMTool):
 
             ret = self.app.new_object('gerber', outname, obj_init, autoselected=False)
             if ret == 'fail':
-                self.app.inform.emit(_('[ERROR_NOTCL] Open PDF file failed.'))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _('Open PDF file failed.'))
                 return
             # Register recent file
             self.app.file_opened.emit('gerber', filename)
             # GUI feedback
-            self.app.inform.emit(_("[success] Rendered: %s") % outname)
+            self.app.inform.emit('[success] %s: %s' % (_("Rendered"), outname))
 
     def periodic_check(self, check_period):
         """

+ 88 - 59
flatcamTools/ToolPaint.py

@@ -691,13 +691,14 @@ class ToolPaint(FlatCAMTool, Gerber):
                 try:
                     tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
                 except ValueError:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                           "use a number."))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                         _("Wrong value format entered, use a number."))
                     return
 
             if tool_dia is None:
                 self.build_ui()
-                self.app.inform.emit(_("[WARNING_NOTCL] Please enter a tool diameter to add, in Float format."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Please enter a tool diameter to add, in Float format."))
                 return
 
         # construct a list of all 'tooluid' in the self.tools
@@ -721,12 +722,14 @@ class ToolPaint(FlatCAMTool, Gerber):
 
         if float('%.4f' % tool_dia) in tool_dias:
             if muted is None:
-                self.app.inform.emit(_("[WARNING_NOTCL] Adding tool cancelled. Tool already in Tool Table."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Adding tool cancelled. Tool already in Tool Table."))
             self.tools_table.itemChanged.connect(self.on_tool_edit)
             return
         else:
             if muted is None:
-                self.app.inform.emit(_("[success] New tool added to Tool Table."))
+                self.app.inform.emit('[success] %s' %
+                                     _("New tool added to Tool Table."))
             self.paint_tools.update({
                 int(self.tooluid): {
                     'tooldia': float('%.4f' % tool_dia),
@@ -763,15 +766,16 @@ class ToolPaint(FlatCAMTool, Gerber):
                 try:
                     new_tool_dia = float(self.tools_table.item(row, 1).text().replace(',', '.'))
                 except ValueError:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                         "use a number."))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                         _("Wrong value format entered, use a number."))
                     return
             tooluid = int(self.tools_table.item(row, 3).text())
 
             # identify the tool that was edited and get it's tooluid
             if new_tool_dia not in tool_dias:
                 self.paint_tools[tooluid]['tooldia'] = new_tool_dia
-                self.app.inform.emit(_("[success] Tool from Tool Table was edited."))
+                self.app.inform.emit('[success] %s' %
+                                     _("Tool from Tool Table was edited."))
                 self.build_ui()
                 return
             else:
@@ -782,8 +786,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                         break
                 restore_dia_item = self.tools_table.item(row, 1)
                 restore_dia_item.setText(str(old_tool_dia))
-                self.app.inform.emit(_("[WARNING_NOTCL] Edit cancelled. "
-                                       "New diameter value is already in the Tool Table."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Edit cancelled. New diameter value is already in the Tool Table."))
         self.build_ui()
 
     # def on_tool_copy(self, all=None):
@@ -881,12 +885,14 @@ class ToolPaint(FlatCAMTool, Gerber):
                     self.paint_tools.pop(t, None)
 
         except AttributeError:
-            self.app.inform.emit(_("[WARNING_NOTCL] Delete failed. Select a tool to delete."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("Delete failed. Select a tool to delete."))
             return
         except Exception as e:
             log.debug(str(e))
 
-        self.app.inform.emit(_("[success] Tool(s) deleted from Tool Table."))
+        self.app.inform.emit('[success] %s' %
+                             _("Tool(s) deleted from Tool Table."))
         self.build_ui()
 
     def on_paint_button_click(self):
@@ -904,16 +910,17 @@ class ToolPaint(FlatCAMTool, Gerber):
             try:
                 overlap = float(self.paintoverlap_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                       "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         if overlap >= 1 or overlap < 0:
-            self.app.inform.emit(_("[ERROR_NOTCL] Overlap value must be between "
-                                   "0 (inclusive) and 1 (exclusive), "))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("Overlap value must be between 0 (inclusive) and 1 (exclusive)"))
             return
 
-        self.app.inform.emit(_("[WARNING_NOTCL] Click inside the desired polygon."))
+        self.app.inform.emit('[WARNING_NOTCL] %s' %
+                             _("Click inside the desired polygon."))
 
         connect = self.pathconnect_cb.get_value()
         contour = self.paintcontour_cb.get_value()
@@ -926,17 +933,22 @@ class ToolPaint(FlatCAMTool, Gerber):
             self.paint_obj = self.app.collection.get_by_name(str(self.obj_name))
         except Exception as e:
             log.debug("ToolPaint.on_paint_button_click() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.obj_name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                 (_("Could not retrieve object: %s"),
+                                  self.obj_name))
             return
 
         if self.paint_obj is None:
-            self.app.inform.emit(_("[ERROR_NOTCL] Object not found: %s") % self.paint_obj)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                 (_("Object not found"),
+                                  self.paint_obj))
             return
 
         # test if the Geometry Object is multigeo and return Fail if True because
         # for now Paint don't work on MultiGeo
         if self.paint_obj.multigeo is True:
-            self.app.inform.emit(_("[ERROR_NOTCL] Can't do Paint on MultiGeo geometries ..."))
+            self.app.inform.emit('[ERROR_NOTCL] %s...' %
+                                 _("Can't do Paint on MultiGeo geometries"))
             return 'Fail'
 
         o_name = '%s_multitool_paint' % self.obj_name
@@ -952,12 +964,13 @@ class ToolPaint(FlatCAMTool, Gerber):
                     try:
                         tooldia = float(self.tools_table.item(x.row(), 1).text().replace(',', '.'))
                     except ValueError:
-                        self.app.inform.emit(_("[ERROR_NOTCL] Wrong Tool Dia value format entered, "
-                                               "use a number."))
+                        self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                             _("Wrong value format entered, use a number."))
                         continue
                 tooldia_list.append(tooldia)
         else:
-            self.app.inform.emit(_("[ERROR_NOTCL] No selected tools in Tool Table."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("No selected tools in Tool Table."))
             return
 
         if select_method == "all":
@@ -969,7 +982,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                                 contour=contour)
 
         elif select_method == "single":
-            self.app.inform.emit(_("[WARNING_NOTCL] Click inside the desired polygon."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("Click inside the desired polygon."))
 
             # use the first tool in the tool table; get the diameter
             # tooldia = float('%.4f' % float(self.tools_table.item(0, 1).text()))
@@ -999,7 +1013,8 @@ class ToolPaint(FlatCAMTool, Gerber):
             self.app.plotcanvas.vis_connect('mouse_press', doit)
 
         elif select_method == "area":
-            self.app.inform.emit(_("[WARNING_NOTCL] Click the start point of the paint area."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("Click the start point of the paint area."))
 
             # use the first tool in the tool table; get the diameter
             # tooldia = float('%.4f' % float(self.tools_table.item(0, 1).text()))
@@ -1010,7 +1025,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                 if event.button == 1:
                     if not self.first_click:
                         self.first_click = True
-                        self.app.inform.emit(_("[WARNING_NOTCL] Click the end point of the paint area."))
+                        self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                             _("Click the end point of the paint area."))
 
                         self.cursor_pos = self.app.plotcanvas.translate_coords(event.pos)
                         if self.app.grid_status() == True:
@@ -1121,7 +1137,9 @@ class ToolPaint(FlatCAMTool, Gerber):
             try:
                 self.bound_obj = self.app.collection.get_by_name(self.bound_obj_name)
             except Exception as e:
-                self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.obj_name)
+                self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                     (_("Could not retrieve object"),
+                                      self.obj_name))
                 return "Could not retrieve object: %s" % self.obj_name
 
             self.paint_poly_ref(obj=self.paint_obj,
@@ -1178,8 +1196,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                 try:
                     paint_margin = float(self.paintmargin_entry.get_value().replace(',', '.'))
                 except ValueError:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                         "use a number."))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                         _("Wrong value format entered, use a number."))
                     return
 
         # No polygon?
@@ -1261,7 +1279,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                     geo_obj.solid_geometry += list(cpoly.get_objects())
                     return cpoly
                 else:
-                    self.app.inform.emit(_('[ERROR_NOTCL] Geometry could not be painted completely'))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                         _('Geometry could not be painted completely'))
                     return None
 
             try:
@@ -1303,9 +1322,10 @@ class ToolPaint(FlatCAMTool, Gerber):
                             total_geometry = list(cp.get_objects())
                 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 strategy of paint\n%s") % str(e))
+                    self.app.inform.emit('[ERROR] %s\n%s' %
+                                         (_("Could not do Paint. Try a different combination of parameters. "
+                                            "Or a different strategy of paint"),
+                                          str(e)))
                     return
 
                 # add the solid_geometry to the current too in self.paint_tools (tools_storage)
@@ -1340,12 +1360,13 @@ class ToolPaint(FlatCAMTool, Gerber):
                 if geo_obj.tools[tooluid]['solid_geometry']:
                     has_solid_geo += 1
             if has_solid_geo == 0:
-                self.app.inform.emit(_("[ERROR] There is no Painting Geometry in the file.\n"
+                self.app.inform.emit('[ERROR] %s' %
+                                     _("There is no Painting Geometry in the file.\n"
                                        "Usually it means that the tool diameter is too big for the painted geometry.\n"
                                        "Change the painting parameters and try again."))
                 return
 
-            self.app.inform.emit(_("[success] Paint Single Done."))
+            self.app.inform.emit('[success] %s' % _("Paint Single Done."))
 
             # Experimental...
             # print("Indexing...", end=' ')
@@ -1366,7 +1387,9 @@ class ToolPaint(FlatCAMTool, Gerber):
                 app_obj.new_object("geometry", name, gen_paintarea)
             except Exception as e:
                 proc.done()
-                self.app.inform.emit(_('[ERROR_NOTCL] PaintTool.paint_poly() --> %s') % str(e))
+                self.app.inform.emit('[ERROR_NOTCL] %s --> %s' %
+                                     (_('PaintTool.paint_poly()'),
+                                      str(e)))
                 return
             proc.done()
             # focus on Selected Tab
@@ -1418,8 +1441,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                 try:
                     paint_margin = float(self.paintmargin_entry.get_value().replace(',', '.'))
                 except ValueError:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                         "use a number."))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                         _("Wrong value format entered, use a number."))
                     return
 
         proc = self.app.proc_container.new(_("Painting polygon..."))
@@ -1583,9 +1606,10 @@ class ToolPaint(FlatCAMTool, Gerber):
                             total_geometry += list(cp.get_objects())
                     except Exception as e:
                         log.debug("Could not Paint the polygons. %s" % str(e))
-                        self.app.inform.emit(
-                            _("[ERROR] Could not do Paint All. Try a different combination of parameters. "
-                              "Or a different Method of paint\n%s") % str(e))
+                        self.app.inform.emit('[ERROR] %s\n%s' %
+                                             (_("Could not do Paint All. Try a different combination of parameters. "
+                                                "Or a different Method of paint"),
+                                              str(e)))
                         return
 
                     pol_nr += 1
@@ -1635,7 +1659,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                 if geo_obj.tools[tooluid]['solid_geometry']:
                     has_solid_geo += 1
             if has_solid_geo == 0:
-                self.app.inform.emit(_("[ERROR] There is no Painting Geometry in the file.\n"
+                self.app.inform.emit('[ERROR] %s' %
+                                     _("There is no Painting Geometry in the file.\n"
                                        "Usually it means that the tool diameter is too big for the painted geometry.\n"
                                        "Change the painting parameters and try again."))
                 return
@@ -1710,9 +1735,10 @@ class ToolPaint(FlatCAMTool, Gerber):
 
                     except Exception as e:
                         log.debug("Could not Paint the polygons. %s" % str(e))
-                        self.app.inform.emit(
-                            _("[ERROR] Could not do Paint All. Try a different combination of parameters. "
-                              "Or a different Method of paint\n%s") % str(e))
+                        self.app.inform.emit('[ERROR] %s\n%s' %
+                                             (_("Could not do Paint All. Try a different combination of parameters. "
+                                                "Or a different Method of paint"),
+                                              str(e)))
                         return
 
                     pol_nr += 1
@@ -1756,7 +1782,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                 if geo_obj.tools[tooluid]['solid_geometry']:
                     has_solid_geo += 1
             if has_solid_geo == 0:
-                self.app.inform.emit(_("[ERROR_NOTCL] There is no Painting Geometry in the file.\n"
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("There is no Painting Geometry in the file.\n"
                                        "Usually it means that the tool diameter is too big for the painted geometry.\n"
                                        "Change the painting parameters and try again."))
                 return
@@ -1765,7 +1792,7 @@ class ToolPaint(FlatCAMTool, Gerber):
             # print("Indexing...", end=' ')
             # geo_obj.make_index()
 
-            self.app.inform.emit(_("[success] Paint All with Rest-Machining done."))
+            self.app.inform.emit('[success] %s' % _("Paint All with Rest-Machining done."))
 
         def job_thread(app_obj):
             try:
@@ -1828,8 +1855,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                 try:
                     paint_margin = float(self.paintmargin_entry.get_value().replace(',', '.'))
                 except ValueError:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                         "use a number."))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                         _("Wrong value format entered, use a number."))
                     return
 
         proc = self.app.proc_container.new(_("Painting polygon..."))
@@ -1991,9 +2018,9 @@ class ToolPaint(FlatCAMTool, Gerber):
                             total_geometry += list(cp.get_objects())
                     except Exception as e:
                         log.debug("Could not Paint the polygons. %s" % str(e))
-                        self.app.inform.emit(
-                            _("[ERROR] Could not do Paint All. Try a different combination of parameters. "
-                              "Or a different Method of paint\n%s") % str(e))
+                        self.app.inform.emit('[ERROR] %s' %
+                                             _("Could not do Paint All. Try a different combination of parameters. "
+                                               "Or a different Method of paint\n%s") % str(e))
                         return
 
                     pol_nr += 1
@@ -2043,7 +2070,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                 if geo_obj.tools[tooluid]['solid_geometry']:
                     has_solid_geo += 1
             if has_solid_geo == 0:
-                self.app.inform.emit(_("[ERROR] There is no Painting Geometry in the file.\n"
+                self.app.inform.emit('[ERROR] %s' %
+                                     _("There is no Painting Geometry in the file.\n"
                                        "Usually it means that the tool diameter is too big for the painted geometry.\n"
                                        "Change the painting parameters and try again."))
                 return
@@ -2125,9 +2153,9 @@ class ToolPaint(FlatCAMTool, Gerber):
 
                     except Exception as e:
                         log.debug("Could not Paint the polygons. %s" % str(e))
-                        self.app.inform.emit(
-                            _("[ERROR] Could not do Paint All. Try a different combination of parameters. "
-                              "Or a different Method of paint\n%s") % str(e))
+                        self.app.inform.emit('[ERROR] %s' %
+                                             _("Could not do Paint All. Try a different combination of parameters. "
+                                               "Or a different Method of paint\n%s") % str(e))
                         return
 
                     pol_nr += 1
@@ -2171,7 +2199,8 @@ class ToolPaint(FlatCAMTool, Gerber):
                 if geo_obj.tools[tooluid]['solid_geometry']:
                     has_solid_geo += 1
             if has_solid_geo == 0:
-                self.app.inform.emit(_("[ERROR_NOTCL] There is no Painting Geometry in the file.\n"
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("There is no Painting Geometry in the file.\n"
                                        "Usually it means that the tool diameter is too big for the painted geometry.\n"
                                        "Change the painting parameters and try again."))
                 return
@@ -2180,7 +2209,7 @@ class ToolPaint(FlatCAMTool, Gerber):
             # print("Indexing...", end=' ')
             # geo_obj.make_index()
 
-            self.app.inform.emit(_("[success] Paint All with Rest-Machining done."))
+            self.app.inform.emit('[success] %s' % _("Paint All with Rest-Machining done."))
 
         def job_thread(app_obj):
             try:
@@ -2244,7 +2273,7 @@ class ToolPaint(FlatCAMTool, Gerber):
             sel_rect = env_obj.buffer(distance=0.0000001, join_style=base.JOIN_STYLE.mitre)
         except Exception as e:
             log.debug("ToolPaint.on_paint_button_click() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] No object available."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("No object available."))
             return
 
         self.paint_poly_area(obj=obj,

+ 26 - 21
flatcamTools/ToolPanelize.py

@@ -355,13 +355,15 @@ class Panelize(FlatCAMTool):
             obj = self.app.collection.get_by_name(str(name))
         except Exception as e:
             log.debug("Panelize.on_panelize() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                 (_("Could not retrieve object"), name))
             return "Could not retrieve object: %s" % name
 
         panel_obj = obj
 
         if panel_obj is None:
-            self.app.inform.emit(_("[ERROR_NOTCL] Object not found: %s") % panel_obj)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                 (_("Object not found"), panel_obj))
             return "Object not found: %s" % panel_obj
 
         boxname = self.box_combo.currentText()
@@ -370,11 +372,13 @@ class Panelize(FlatCAMTool):
             box = self.app.collection.get_by_name(boxname)
         except Exception as e:
             log.debug("Panelize.on_panelize() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % boxname)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                 (_("Could not retrieve object"), boxname))
             return "Could not retrieve object: %s" % boxname
 
         if box is None:
-            self.app.inform.emit(_("[WARNING_NOTCL]No object Box. Using instead %s") % panel_obj)
+            self.app.inform.emit('[WARNING_NOTCL]%s: %s' %
+                                 (_("No object Box. Using instead"), panel_obj))
             self.reference_radio.set_value('bbox')
 
         if self.reference_radio.get_value() == 'bbox':
@@ -389,8 +393,8 @@ class Panelize(FlatCAMTool):
             try:
                 spacing_columns = float(self.spacing_columns.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                     "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
         spacing_columns = spacing_columns if spacing_columns is not None else 0
 
@@ -401,8 +405,8 @@ class Panelize(FlatCAMTool):
             try:
                 spacing_rows = float(self.spacing_rows.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                     "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
         spacing_rows = spacing_rows if spacing_rows is not None else 0
 
@@ -414,8 +418,8 @@ class Panelize(FlatCAMTool):
                 rows = float(self.rows.get_value().replace(',', '.'))
                 rows = int(rows)
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                     "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
         rows = rows if rows is not None else 1
 
@@ -427,8 +431,8 @@ class Panelize(FlatCAMTool):
                 columns = float(self.columns.get_value().replace(',', '.'))
                 columns = int(columns)
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                     "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
         columns = columns if columns is not None else 1
 
@@ -439,8 +443,8 @@ class Panelize(FlatCAMTool):
             try:
                 constrain_dx = float(self.x_width_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                     "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         try:
@@ -450,14 +454,15 @@ class Panelize(FlatCAMTool):
             try:
                 constrain_dy = float(self.y_height_entry.get_value().replace(',', '.'))
             except ValueError:
-                self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                     "use a number."))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         panel_type = str(self.panel_type_radio.get_value())
 
         if 0 in {columns, rows}:
-            self.app.inform.emit(_("[ERROR_NOTCL] Columns or Rows are zero value. Change them to a positive integer."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("Columns or Rows are zero value. Change them to a positive integer."))
             return "Columns or Rows are zero value. Change them to a positive integer."
 
         xmin, ymin, xmax, ymax = box.bounds()
@@ -635,19 +640,19 @@ class Panelize(FlatCAMTool):
                                         plot=True, autoselected=True)
 
         if self.constrain_flag is False:
-            self.app.inform.emit(_("[success] Panel done..."))
+            self.app.inform.emit('[success] %s' % _("Panel done..."))
         else:
             self.constrain_flag = False
-            self.app.inform.emit(_("[WARNING] Too big for the constrain area. "
+            self.app.inform.emit(_("{text} Too big for the constrain area. "
                                    "Final panel has {col} columns and {row} rows").format(
-                col=columns, row=rows))
+                text='[WARNING] ', col=columns, row=rows))
 
         proc = self.app.proc_container.new(_("Generating panel ..."))
 
         def job_thread(app_obj):
             try:
                 panelize_2()
-                self.app.inform.emit(_("[success] Panel created successfully."))
+                self.app.inform.emit('[success] %s' % _("Panel created successfully."))
             except Exception as ee:
                 proc.done()
                 log.debug(str(ee))

+ 20 - 11
flatcamTools/ToolPcbWizard.py

@@ -362,7 +362,8 @@ class PcbWizard(FlatCAMTool):
                 self.frac_entry.set_value(self.fractional)
 
         if not self.tools_from_inf:
-            self.app.inform.emit(_("[ERROR] The INF file does not contain the tool table.\n"
+            self.app.inform.emit('[ERROR] %s' %
+                                 _("The INF file does not contain the tool table.\n"
                                    "Try to open the Excellon file from File -> Open -> Excellon\n"
                                    "and edit the drill diameters manually."))
             return "fail"
@@ -382,11 +383,13 @@ class PcbWizard(FlatCAMTool):
         if signal == 'inf':
             self.inf_loaded = True
             self.tools_table.setVisible(True)
-            self.app.inform.emit(_("[success] PcbWizard .INF file loaded."))
+            self.app.inform.emit('[success] %s' %
+                                 _("PcbWizard .INF file loaded."))
         elif signal == 'excellon':
             self.excellon_loaded = True
             self.outname = os.path.split(str(filename))[1]
-            self.app.inform.emit(_("[success] Main PcbWizard Excellon file loaded."))
+            self.app.inform.emit('[success] %s' %
+                                 _("Main PcbWizard Excellon file loaded."))
 
         if self.excellon_loaded and self.inf_loaded:
             self.update_params()
@@ -420,16 +423,18 @@ class PcbWizard(FlatCAMTool):
                 ret = excellon_obj.parse_file(file_obj=excellon_fileobj)
                 if ret == "fail":
                     app_obj.log.debug("Excellon parsing failed.")
-                    app_obj.inform.emit(_("[ERROR_NOTCL] This is not Excellon file."))
+                    app_obj.inform.emit('[ERROR_NOTCL] %s' %
+                                        _("This is not Excellon file."))
                     return "fail"
             except IOError:
-                app_obj.inform.emit(_("[ERROR_NOTCL] Cannot parse file: %s") % self.outname)
+                app_obj.inform.emit('[ERROR_NOTCL] %s: %s' % (
+                        _("Cannot parse file"), self.outname))
                 app_obj.log.debug("Could not import Excellon object.")
                 app_obj.progress.emit(0)
                 return "fail"
             except Exception as e:
                 app_obj.log.debug("PcbWizard.on_import_excellon().obj_init() %s" % str(e))
-                msg = _("[ERROR_NOTCL] An internal error has occurred. See shell.\n")
+                msg = '[ERROR_NOTCL] %s' % _("An internal error has occurred. See shell.\n")
                 msg += app_obj.traceback.format_exc()
                 app_obj.inform.emit(msg)
                 return "fail"
@@ -442,7 +447,8 @@ class PcbWizard(FlatCAMTool):
             for tool in excellon_obj.tools:
                 if excellon_obj.tools[tool]['solid_geometry']:
                     return
-            app_obj.inform.emit(_("[ERROR_NOTCL] No geometry found in file: %s") % name)
+            app_obj.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                (_("No geometry found in file"), name))
             return "fail"
 
         if excellon_fileobj is not None and excellon_fileobj != '':
@@ -454,16 +460,19 @@ class PcbWizard(FlatCAMTool):
 
                     ret_val = self.app.new_object("excellon", name, obj_init, autoselected=False)
                     if ret_val == 'fail':
-                        self.app.inform.emit(_('[ERROR_NOTCL] Import Excellon file failed.'))
+                        self.app.inform.emit('[ERROR_NOTCL] %s' % _('Import Excellon file failed.'))
                         return
 
                         # Register recent file
                     self.app.file_opened.emit("excellon", name)
 
                     # GUI feedback
-                    self.app.inform.emit(_("[success] Imported: %s") % name)
+                    self.app.inform.emit('[success] %s: %s' %
+                                         (_("Imported"), name))
                     self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
             else:
-                self.app.inform.emit(_('[WARNING_NOTCL] Excellon merging is in progress. Please wait...'))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _('Excellon merging is in progress. Please wait...'))
         else:
-            self.app.inform.emit(_('[ERROR_NOTCL] The imported Excellon file is None.'))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _('The imported Excellon file is None.'))

+ 4 - 2
flatcamTools/ToolProperties.py

@@ -108,14 +108,16 @@ class Properties(FlatCAMTool):
     def properties(self):
         obj_list = self.app.collection.get_selected()
         if not obj_list:
-            self.app.inform.emit(_("[ERROR_NOTCL] Properties Tool was not displayed. No object selected."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("Properties Tool was not displayed. No object selected."))
             self.app.ui.notebook.setTabText(2, _("Tools"))
             self.properties_frame.hide()
             self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
             return
         for obj in obj_list:
             self.addItems(obj)
-            self.app.inform.emit(_("[success] Object Properties are displayed."))
+            self.app.inform.emit('[success] %s' %
+                                 _("Object Properties are displayed."))
         self.app.ui.notebook.setTabText(2, _("Properties Tool"))
 
     def addItems(self, obj):

+ 57 - 33
flatcamTools/ToolSolderPaste.py

@@ -760,17 +760,18 @@ class SolderPaste(FlatCAMTool):
                 try:
                     tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
                 except ValueError:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                           "use a number."))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                         _("Wrong value format entered, use a number."))
                     return
             if tool_dia is None:
                 self.build_ui()
-                self.app.inform.emit(_("[WARNING_NOTCL] Please enter a tool diameter to add, in Float format."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Please enter a tool diameter to add, in Float format."))
                 return
 
         if tool_dia == 0:
-            self.app.inform.emit(_("[WARNING_NOTCL] Please enter a tool diameter with non-zero value, "
-                                   "in Float format."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("Please enter a tool diameter with non-zero value, in Float format."))
             return
 
         # construct a list of all 'tooluid' in the self.tooltable_tools
@@ -794,12 +795,14 @@ class SolderPaste(FlatCAMTool):
 
         if float('%.4f' % tool_dia) in tool_dias:
             if muted is None:
-                self.app.inform.emit(_("[WARNING_NOTCL] Adding Nozzle tool cancelled. Tool already in Tool Table."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Adding Nozzle tool cancelled. Tool already in Tool Table."))
             self.tools_table.itemChanged.connect(self.on_tool_edit)
             return
         else:
             if muted is None:
-                self.app.inform.emit(_("[success] New Nozzle tool added to Tool Table."))
+                self.app.inform.emit('[success] %s' %
+                                     _("New Nozzle tool added to Tool Table."))
             self.tooltable_tools.update({
                 int(self.tooluid): {
                     'tooldia': float('%.4f' % tool_dia),
@@ -832,8 +835,8 @@ class SolderPaste(FlatCAMTool):
                 try:
                     new_tool_dia = float(self.tools_table.item(row, 1).text().replace(',', '.'))
                 except ValueError:
-                    self.app.inform.emit(_("[ERROR_NOTCL] Wrong value format entered, "
-                                           "use a number."))
+                    self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                         _("Wrong value format entered, use a number."))
                     return
 
             tooluid = int(self.tools_table.item(row, 2).text())
@@ -841,7 +844,8 @@ class SolderPaste(FlatCAMTool):
             # identify the tool that was edited and get it's tooluid
             if new_tool_dia not in tool_dias:
                 self.tooltable_tools[tooluid]['tooldia'] = new_tool_dia
-                self.app.inform.emit(_("[success] Nozzle tool from Tool Table was edited."))
+                self.app.inform.emit('[success] %s' %
+                                     _("Nozzle tool from Tool Table was edited."))
                 self.build_ui()
                 return
             else:
@@ -852,8 +856,8 @@ class SolderPaste(FlatCAMTool):
                         break
                 restore_dia_item = self.tools_table.item(row, 1)
                 restore_dia_item.setText(str(old_tool_dia))
-                self.app.inform.emit(_("[WARNING_NOTCL] Edit cancelled. "
-                                       "New diameter value is already in the Tool Table."))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("Edit cancelled. New diameter value is already in the Tool Table."))
         self.build_ui()
 
     def on_tool_delete(self, rows_to_delete=None, all=None):
@@ -898,12 +902,14 @@ class SolderPaste(FlatCAMTool):
                     self.tooltable_tools.pop(t, None)
 
         except AttributeError:
-            self.app.inform.emit(_("[WARNING_NOTCL] Delete failed. Select a Nozzle tool to delete."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("Delete failed. Select a Nozzle tool to delete."))
             return
         except Exception as e:
             log.debug(str(e))
 
-        self.app.inform.emit(_("[success] Nozzle tool(s) deleted from Tool Table."))
+        self.app.inform.emit('[success] %s' %
+                             _("Nozzle tool(s) deleted from Tool Table."))
         self.build_ui()
 
     def on_rmb_combo(self, pos, combo):
@@ -958,7 +964,8 @@ class SolderPaste(FlatCAMTool):
         """
         name = self.obj_combo.currentText()
         if name == '':
-            self.app.inform.emit(_("[WARNING_NOTCL] No SolderPaste mask Gerber object loaded."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("No SolderPaste mask Gerber object loaded."))
             return
 
         obj = self.app.collection.get_by_name(name)
@@ -988,7 +995,8 @@ class SolderPaste(FlatCAMTool):
         sorted_tools.sort(reverse=True)
 
         if not sorted_tools:
-            self.app.inform.emit(_("[WARNING_NOTCL] No Nozzle tools in the tool table."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("No Nozzle tools in the tool table."))
             return 'fail'
 
         def flatten(geometry=None, reset=True, pathonly=False):
@@ -1114,16 +1122,19 @@ class SolderPaste(FlatCAMTool):
                         if not geo_obj.tools[tooluid_key]['solid_geometry']:
                             a += 1
                     if a == len(geo_obj.tools):
-                        self.app.inform.emit(_('[ERROR_NOTCL] Cancelled. Empty file, it has no geometry...'))
+                        self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                             _('Cancelled. Empty file, it has no geometry...'))
                         return 'fail'
 
-                    app_obj.inform.emit(_("[success] Solder Paste geometry generated successfully..."))
+                    app_obj.inform.emit('[success] %s...' %
+                                        _("Solder Paste geometry generated successfully"))
                     return
 
             # if we still have geometry not processed at the end of the tools then we failed
             # some or all the pads are not covered with solder paste
             if work_geo:
-                app_obj.inform.emit(_("[WARNING_NOTCL] Some or all pads have no solder "
+                app_obj.inform.emit('[WARNING_NOTCL] %s' %
+                                    _("Some or all pads have no solder "
                                       "due of inadequate nozzle diameters..."))
                 return 'fail'
 
@@ -1157,11 +1168,13 @@ class SolderPaste(FlatCAMTool):
         obj = self.app.collection.get_by_name(name)
 
         if name == '':
-            self.app.inform.emit(_("[WARNING_NOTCL] There is no Geometry object available."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("There is no Geometry object available."))
             return 'fail'
 
         if obj.special_group != 'solder_paste_tool':
-            self.app.inform.emit(_("[WARNING_NOTCL] This Geometry can't be processed. "
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("This Geometry can't be processed. "
                                    "NOT a solder_paste_tool geometry."))
             return 'fail'
 
@@ -1170,7 +1183,8 @@ class SolderPaste(FlatCAMTool):
             if obj.tools[tooluid_key]['solid_geometry'] is None:
                 a += 1
         if a == len(obj.tools):
-            self.app.inform.emit(_('[ERROR_NOTCL] Cancelled. Empty file, it has no geometry...'))
+            self.app.inform.emit('[ERROR_NOTCL] %s...' %
+                                 _('Cancelled. Empty file, it has no geometry'))
             return 'fail'
 
         # use the name of the first tool selected in self.geo_tools_table which has the diameter passed as tool_dia
@@ -1197,7 +1211,7 @@ class SolderPaste(FlatCAMTool):
             ymax = obj.options['ymax']
         except Exception as e:
             log.debug("FlatCAMObj.FlatCAMGeometry.mtool_gen_cncjob() --> %s\n" % str(e))
-            msg = "[ERROR] An internal error has ocurred. See shell.\n"
+            msg = '[ERROR] %s' % _("An internal error has ocurred. See shell.\n")
             msg += 'FlatCAMObj.FlatCAMGeometry.mtool_gen_cncjob() --> %s' % str(e)
             msg += traceback.format_exc()
             self.app.inform.emit(msg)
@@ -1267,7 +1281,8 @@ class SolderPaste(FlatCAMTool):
             def job_thread(app_obj):
                 with self.app.proc_container.new("Generating CNC Code"):
                     if app_obj.new_object("cncjob", name, job_init) != 'fail':
-                        app_obj.inform.emit(_("[success] ToolSolderPaste CNCjob created: %s") % name)
+                        app_obj.inform.emit('[success] [success] %s: %s' %
+                                            (_("ToolSolderPaste CNCjob created"), name))
                         app_obj.progress.emit(100)
 
             # Create a promise with the name
@@ -1299,11 +1314,13 @@ class SolderPaste(FlatCAMTool):
 
         try:
             if obj.special_group != 'solder_paste_tool':
-                self.app.inform.emit(_("[WARNING_NOTCL] This CNCJob object can't be processed. "
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("This CNCJob object can't be processed. "
                                        "NOT a solder_paste_tool CNCJob object."))
                 return
         except AttributeError:
-            self.app.inform.emit(_("[WARNING_NOTCL] This CNCJob object can't be processed. "
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("This CNCJob object can't be processed. "
                                    "NOT a solder_paste_tool CNCJob object."))
             return
 
@@ -1327,7 +1344,8 @@ class SolderPaste(FlatCAMTool):
             lines = StringIO(gcode)
         except Exception as e:
             log.debug("ToolSolderpaste.on_view_gcode() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] No Gcode in the object..."))
+            self.app.inform.emit('[ERROR_NOTCL] %s...' %
+                                 _("No Gcode in the object"))
             return
 
         try:
@@ -1336,7 +1354,8 @@ class SolderPaste(FlatCAMTool):
                 self.app.ui.code_editor.append(proc_line)
         except Exception as e:
             log.debug('ToolSolderPaste.on_view_gcode() -->%s' % str(e))
-            self.app.inform.emit(_('[ERROR] ToolSolderPaste.on_view_gcode() -->%s') % str(e))
+            self.app.inform.emit('[ERROR] %s --> %s' %
+                                 (_('ToolSolderPaste.on_view_gcode()'), str(e)))
             return
 
         self.app.ui.code_editor.moveCursor(QtGui.QTextCursor.Start)
@@ -1355,7 +1374,8 @@ class SolderPaste(FlatCAMTool):
         obj = self.app.collection.get_by_name(name)
 
         if obj.special_group != 'solder_paste_tool':
-            self.app.inform.emit(_("[WARNING_NOTCL] This CNCJob object can't be processed. "
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("This CNCJob object can't be processed. "
                                    "NOT a solder_paste_tool CNCJob object."))
             return
 
@@ -1373,7 +1393,8 @@ class SolderPaste(FlatCAMTool):
             filename, _f = QtWidgets.QFileDialog.getSaveFileName(caption=_("Export Machine Code ..."), filter=_filter_)
 
         if filename == '':
-            self.app.inform.emit(_("[WARNING_NOTCL] Export Machine Code cancelled ..."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("Export Machine Code cancelled ..."))
             return
 
         gcode = '(G-CODE GENERATED BY FLATCAM v%s - www.flatcam.org - Version Date: %s)\n' % \
@@ -1399,17 +1420,20 @@ class SolderPaste(FlatCAMTool):
                     for line in lines:
                         f.write(line)
             except FileNotFoundError:
-                self.app.inform.emit(_("[WARNING_NOTCL] No such file or directory"))
+                self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                     _("No such file or directory"))
                 return
             except PermissionError:
-                self.app.inform.emit(_("[WARNING] Permission denied, saving not possible.\n"
+                self.app.inform.emit('[WARNING] %s' %
+                                     _("Permission denied, saving not possible.\n"
                                        "Most likely another app is holding the file open and not accessible."))
                 return 'fail'
 
         if self.app.defaults["global_open_style"] is False:
             self.app.file_opened.emit("gcode", filename)
         self.app.file_saved.emit("gcode", filename)
-        self.app.inform.emit(_("[success] Solder paste dispenser GCode file saved to: %s") % filename)
+        self.app.inform.emit('[success] %s: %s' %
+                             (_("Solder paste dispenser GCode file saved to"), filename))
 
     def reset_fields(self):
         self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))

+ 28 - 14
flatcamTools/ToolSub.py

@@ -241,7 +241,8 @@ class ToolSub(FlatCAMTool):
 
         self.target_grb_obj_name = self.target_gerber_combo.currentText()
         if self.target_grb_obj_name == '':
-            self.app.inform.emit(_("[ERROR_NOTCL] No Target object loaded."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("No Target object loaded."))
             return
 
         # Get target object.
@@ -249,12 +250,14 @@ class ToolSub(FlatCAMTool):
             self.target_grb_obj = self.app.collection.get_by_name(self.target_grb_obj_name)
         except Exception as e:
             log.debug("ToolSub.on_grb_intersection_click() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.obj_name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                 (_("Could not retrieve object"), self.obj_name))
             return "Could not retrieve object: %s" % self.target_grb_obj_name
 
         self.sub_grb_obj_name = self.sub_gerber_combo.currentText()
         if self.sub_grb_obj_name == '':
-            self.app.inform.emit(_("[ERROR_NOTCL] No Substractor object loaded."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("No Substractor object loaded."))
             return
 
         # Get substractor object.
@@ -262,7 +265,8 @@ class ToolSub(FlatCAMTool):
             self.sub_grb_obj = self.app.collection.get_by_name(self.sub_grb_obj_name)
         except Exception as e:
             log.debug("ToolSub.on_grb_intersection_click() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.obj_name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                 (_("Could not retrieve object"), self.obj_name))
             return "Could not retrieve object: %s" % self.sub_grb_obj_name
 
         # crate the new_apertures dict structure
@@ -412,11 +416,13 @@ class ToolSub(FlatCAMTool):
         with self.app.proc_container.new(_("Generating new object ...")):
             ret = self.app.new_object('gerber', outname, obj_init, autoselected=False)
             if ret == 'fail':
-                self.app.inform.emit(_('[ERROR_NOTCL] Generating new object failed.'))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _('Generating new object failed.'))
                 return
 
             # GUI feedback
-            self.app.inform.emit(_("[success] Created: %s") % outname)
+            self.app.inform.emit('[success] %s: %s' %
+                                 (_("Created"), outname))
 
             # cleanup
             self.new_apertures.clear()
@@ -437,7 +443,8 @@ class ToolSub(FlatCAMTool):
 
         self.target_geo_obj_name = self.target_geo_combo.currentText()
         if self.target_geo_obj_name == '':
-            self.app.inform.emit(_("[ERROR_NOTCL] No Target object loaded."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("No Target object loaded."))
             return
 
         # Get target object.
@@ -445,12 +452,14 @@ class ToolSub(FlatCAMTool):
             self.target_geo_obj = self.app.collection.get_by_name(self.target_geo_obj_name)
         except Exception as e:
             log.debug("ToolSub.on_geo_intersection_click() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.target_geo_obj_name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                 (_("Could not retrieve object"), self.target_geo_obj_name))
             return "Could not retrieve object: %s" % self.target_grb_obj_name
 
         self.sub_geo_obj_name = self.sub_geo_combo.currentText()
         if self.sub_geo_obj_name == '':
-            self.app.inform.emit(_("[ERROR_NOTCL] No Substractor object loaded."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("No Substractor object loaded."))
             return
 
         # Get substractor object.
@@ -458,11 +467,13 @@ class ToolSub(FlatCAMTool):
             self.sub_geo_obj = self.app.collection.get_by_name(self.sub_geo_obj_name)
         except Exception as e:
             log.debug("ToolSub.on_geo_intersection_click() --> %s" % str(e))
-            self.app.inform.emit(_("[ERROR_NOTCL] Could not retrieve object: %s") % self.sub_geo_obj_name)
+            self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
+                                 (_("Could not retrieve object"), self.sub_geo_obj_name))
             return "Could not retrieve object: %s" % self.sub_geo_obj_name
 
         if self.sub_geo_obj.multigeo:
-            self.app.inform.emit(_("[ERROR_NOTCL] Currently, the Substractor geometry cannot be of type Multigeo."))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _("Currently, the Substractor geometry cannot be of type Multigeo."))
             return
 
         # create the target_options obj
@@ -608,12 +619,14 @@ class ToolSub(FlatCAMTool):
         with self.app.proc_container.new(_("Generating new object ...")):
             ret = self.app.new_object('geometry', outname, obj_init, autoselected=False)
             if ret == 'fail':
-                self.app.inform.emit(_('[ERROR_NOTCL] Generating new object failed.'))
+                self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                     _('Generating new object failed.'))
                 return
             # Register recent file
             self.app.file_opened.emit('geometry', outname)
             # GUI feedback
-            self.app.inform.emit(_("[success] Created: %s") % outname)
+            self.app.inform.emit('[success] %s: %s' %
+                                 (_("Created"), outname))
 
             # cleanup
             self.new_tools.clear()
@@ -687,7 +700,8 @@ class ToolSub(FlatCAMTool):
                 self.app.worker_task.emit({'fcn': self.new_geo_object,
                                            'params': [outname]})
         else:
-            self.app.inform.emit(_('[ERROR_NOTCL] Generating new object failed.'))
+            self.app.inform.emit('[ERROR_NOTCL] %s' %
+                                 _('Generating new object failed.'))
 
     def reset_fields(self):
         self.target_gerber_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))

+ 44 - 30
flatcamTools/ToolTransform.py

@@ -470,8 +470,8 @@ class ToolTransform(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('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
         self.app.worker_task.emit({'fcn': self.on_rotate_action,
                                    'params': [value]})
@@ -504,8 +504,8 @@ class ToolTransform(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('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         # self.on_skew("X", value)
@@ -522,8 +522,8 @@ class ToolTransform(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('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         # self.on_skew("Y", value)
@@ -540,8 +540,8 @@ class ToolTransform(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('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         # scaling to zero has no sense so we remove it, because scaling with 1 does nothing
@@ -574,8 +574,8 @@ class ToolTransform(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('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         # scaling to zero has no sense so we remove it, because scaling with 1 does nothing
@@ -603,8 +603,8 @@ class ToolTransform(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('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         # self.on_offset("X", value)
@@ -621,8 +621,8 @@ class ToolTransform(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('[ERROR_NOTCL] %s' %
+                                     _("Wrong value format entered, use a number."))
                 return
 
         # self.on_offset("Y", value)
@@ -639,7 +639,8 @@ class ToolTransform(FlatCAMTool):
         ymaxlist = []
 
         if not obj_list:
-            self.app.inform.emit(_("[WARNING_NOTCL] No object selected. Please Select an object to rotate!"))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("No object selected. Please Select an object to rotate!"))
             return
         else:
             with self.app.proc_container.new(_("Appying Rotate")):
@@ -675,11 +676,12 @@ class ToolTransform(FlatCAMTool):
                         # add information to the object that it was changed and how much
                         sel_obj.options['rotate'] = num
                         sel_obj.plot()
-                    self.app.inform.emit(_('[success] Rotate done ...'))
+                    self.app.inform.emit('[success] %s...' % _('Rotate done'))
                     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('[ERROR_NOTCL] %s %s, %s.' %
+                                         (_("Due of"), str(e), _("action was not executed.")))
                     return
 
     def on_flip(self, axis):
@@ -690,7 +692,8 @@ class ToolTransform(FlatCAMTool):
         ymaxlist = []
 
         if not obj_list:
-            self.app.inform.emit(_("[WARNING_NOTCL] No object selected. Please Select an object to flip!"))
+            self.app.inform.emit('[WARNING_NOTCL] %s!' %
+                                 _("No object selected. Please Select an object to flip"))
             return
         else:
             with self.app.proc_container.new(_("Applying Flip")):
@@ -735,7 +738,8 @@ class ToolTransform(FlatCAMTool):
                                     sel_obj.options['mirror_y'] = not sel_obj.options['mirror_y']
                                 else:
                                     sel_obj.options['mirror_y'] = True
-                                self.app.inform.emit(_('[success] Flip on the Y axis done ...'))
+                                self.app.inform.emit('[success] %s...' %
+                                                     _('Flip on the Y axis done'))
                             elif axis is 'Y':
                                 sel_obj.mirror('Y', (px, py))
                                 # add information to the object that it was changed and how much
@@ -744,13 +748,15 @@ class ToolTransform(FlatCAMTool):
                                     sel_obj.options['mirror_x'] = not sel_obj.options['mirror_x']
                                 else:
                                     sel_obj.options['mirror_x'] = True
-                                self.app.inform.emit(_('[success] Flip on the X axis done ...'))
+                                self.app.inform.emit('[success] %s...' %
+                                                     _('Flip on the X axis done'))
                             self.app.object_changed.emit(sel_obj)
                         sel_obj.plot()
                     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('[ERROR_NOTCL] %s %s, %s.' %
+                                         (_("Due of"), str(e), _("action was not executed.")))
                     return
 
     def on_skew(self, axis, num):
@@ -759,7 +765,8 @@ class ToolTransform(FlatCAMTool):
         yminlist = []
 
         if not obj_list:
-            self.app.inform.emit(_("[WARNING_NOTCL] No object selected. Please Select an object to shear/skew!"))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("No object selected. Please Select an object to shear/skew!"))
             return
         else:
             with self.app.proc_container.new(_("Applying Skew")):
@@ -797,7 +804,8 @@ class ToolTransform(FlatCAMTool):
                     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('[ERROR_NOTCL] %s %s, %s.' %
+                                         (_("Due of"), str(e), _("action was not executed.")))
                     return
 
     def on_scale(self, axis, xfactor, yfactor, point=None):
@@ -808,7 +816,8 @@ class ToolTransform(FlatCAMTool):
         ymaxlist = []
 
         if not obj_list:
-            self.app.inform.emit(_("[WARNING_NOTCL] No object selected. Please Select an object to scale!"))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("No object selected. Please Select an object to scale!"))
             return
         else:
             with self.app.proc_container.new(_("Applying Scale")):
@@ -850,17 +859,20 @@ class ToolTransform(FlatCAMTool):
                             self.app.object_changed.emit(sel_obj)
                         sel_obj.plot()
 
-                    self.app.inform.emit(_('[success] Scale on the %s axis done ...') % str(axis))
+                    self.app.inform.emit('[success] %s %s %s...' %
+                                         (_('Scale on the'), str(axis), _('axis done')))
                     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('[ERROR_NOTCL] %s %s, %s.' %
+                                         (_("Due of"), str(e), _("action was not executed.")))
                     return
 
     def on_offset(self, axis, num):
         obj_list = self.app.collection.get_selected()
 
         if not obj_list:
-            self.app.inform.emit(_("[WARNING_NOTCL] No object selected. Please Select an object to offset!"))
+            self.app.inform.emit('[WARNING_NOTCL] %s' %
+                                 _("No object selected. Please Select an object to offset!"))
             return
         else:
             with self.app.proc_container.new(_("Applying Offset")):
@@ -869,7 +881,7 @@ class ToolTransform(FlatCAMTool):
 
                     for sel_obj in obj_list:
                         if isinstance(sel_obj, FlatCAMCNCjob):
-                            self.app.inform.emit(_("CNCJob objects can't be offseted."))
+                            self.app.inform.emit(_("CNCJob objects can't be offset."))
                         else:
                             if axis is 'X':
                                 sel_obj.offset((num, 0))
@@ -882,11 +894,13 @@ class ToolTransform(FlatCAMTool):
                             self.app.object_changed.emit(sel_obj)
                         sel_obj.plot()
 
-                    self.app.inform.emit(_('[success] Offset on the %s axis done ...') % str(axis))
+                    self.app.inform.emit('[success] %s %s %s...' %
+                                         (_('Offset on the'), str(axis), _('axis done')))
                     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('[ERROR_NOTCL] %s %s, %s.' %
+                                         (_("Due of"), str(e),  _("action was not executed.")))
                     return
 
 # end of file

File diff suppressed because it is too large
+ 256 - 270
locale_template/strings.pot


Some files were not shown because too many files changed in this diff