Kaynağa Gözat

Issue #284 - Sanitize the entered Overlap value.

Victor Benso 6 yıl önce
ebeveyn
işleme
309dbb132e
1 değiştirilmiş dosya ile 8 ekleme ve 2 silme
  1. 8 2
      flatcamTools/ToolPaint.py

+ 8 - 2
flatcamTools/ToolPaint.py

@@ -157,7 +157,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         self.tools_box.addLayout(grid3)
 
         # Overlap
-        ovlabel = QtWidgets.QLabel(_('Overlap:'))
+        ovlabel = QtWidgets.QLabel(_('Overlap Rate:'))
         ovlabel.setToolTip(
             _("How much (fraction) of the tool width to overlap each tool pass.\n"
             "Example:\n"
@@ -732,7 +732,6 @@ class ToolPaint(FlatCAMTool, Gerber):
         self.app.report_usage(_("geometry_on_paint_button"))
         # self.app.call_source = 'paint'
 
-        self.app.inform.emit(_("[WARNING_NOTCL] Click inside the desired polygon."))
         try:
             overlap = float(self.paintoverlap_entry.get_value())
         except ValueError:
@@ -744,6 +743,13 @@ class ToolPaint(FlatCAMTool, Gerber):
                                      "use a number."))
                 return
 
+        if not overlap < 1 and overlap >= 0:
+            self.app.inform.emit(_("[ERROR_NOTCL] Overlap value must be between "
+                                  "0 (inclusive) and 1 (exclusive), "))
+            return
+
+        self.app.inform.emit(_("[WARNING_NOTCL] Click inside the desired polygon."))
+
         connect = self.pathconnect_cb.get_value()
         contour = self.paintcontour_cb.get_value()
         select_method = self.selectmethod_combo.get_value()