Przeglądaj źródła

- updated/optimized the GUI in Preferences for Paint Tool and for NCC Tool
- work in Paint Tool to bring it up to date with NCC Tool

Marius Stanciu 6 lat temu
rodzic
commit
3c569fdf6c

+ 11 - 4
FlatCAMApp.py

@@ -776,11 +776,11 @@ class App(QtCore.QObject):
             "tools_nccref": 'itself',
             "tools_ncc_plotting": 'normal',
             "tools_nccmilling_type": 'cl',
-            "tools_ncctool_type": 'V',
+            "tools_ncctool_type": 'C1',
             "tools_ncccutz": -0.05,
             "tools_ncctipdia": 0.1,
             "tools_ncctipangle": 30,
-            "tools_nccnewdia": 1.0,
+            "tools_nccnewdia": 0.1,
 
             # Cutout Tool
             "tools_cutouttooldia": 2.4,
@@ -804,11 +804,11 @@ class App(QtCore.QObject):
             "tools_paintcontour": True,
             "tools_paint_plotting": 'normal',
             "tools_paintrest": False,
-            "tools_painttool_type": 'V',
+            "tools_painttool_type": 'C1',
             "tools_paintcutz": -0.05,
             "tools_painttipdia": 0.1,
             "tools_painttipangle": 30,
-            "tools_paintnewdia": 1.0,
+            "tools_paintnewdia": 0.1,
 
             # 2-Sided Tool
             "tools_2sided_mirror_axis": "X",
@@ -1453,6 +1453,13 @@ class App(QtCore.QObject):
             "tools_paintcontour": self.ui.tools_defaults_form.tools_paint_group.contour_cb,
             "tools_paint_plotting": self.ui.tools_defaults_form.tools_paint_group.paint_plotting_radio,
 
+            "tools_paintrest": self.ui.tools_defaults_form.tools_paint_group.rest_cb,
+            "tools_painttool_type": self.ui.tools_defaults_form.tools_paint_group.tool_type_radio,
+            "tools_paintcutz": self.ui.tools_defaults_form.tools_paint_group.cutz_entry,
+            "tools_painttipdia": self.ui.tools_defaults_form.tools_paint_group.tipdia_entry,
+            "tools_painttipangle": self.ui.tools_defaults_form.tools_paint_group.tipangle_entry,
+            "tools_paintnewdia": self.ui.tools_defaults_form.tools_paint_group.newdia_entry,
+
             # 2-sided Tool
             "tools_2sided_mirror_axis": self.ui.tools_defaults_form.tools_2sided_group.mirror_axis_radio,
             "tools_2sided_axis_loc": self.ui.tools_defaults_form.tools_2sided_group.axis_location_radio,

+ 5 - 0
README.md

@@ -9,6 +9,11 @@ CAD program, and create G-Code for Isolation routing.
 
 =================================================
 
+16.01.2020
+
+- updated/optimized the GUI in Preferences for Paint Tool and for NCC Tool
+- work in Paint Tool to bring it up to date with NCC Tool
+
 15.01.2020
 
 - added key shortcuts and toolbar icons for the new tools: Align Object Tool (ALT+A) and Extract Drills (ALT+I)

+ 1 - 1
flatcamEditors/FlatCAMGeoEditor.py

@@ -451,7 +451,7 @@ class PaintOptionsTool(FlatCAMTool):
         grid.addWidget(self.painttooldia_entry, 0, 1)
 
         # Overlap
-        ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
+        ovlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
         ovlabel.setToolTip(
             _("How much (percentage) of the tool width to overlap each tool pass.\n"
               "Adjust the value starting with lower values\n"

+ 216 - 74
flatcamGUI/PreferencesUI.py

@@ -163,6 +163,7 @@ class ToolsPreferencesUI(QtWidgets.QWidget):
 
         self.tools_ncc_group = ToolsNCCPrefGroupUI(decimals=self.decimals)
         self.tools_ncc_group.setMinimumWidth(220)
+
         self.tools_paint_group = ToolsPaintPrefGroupUI(decimals=self.decimals)
         self.tools_paint_group.setMinimumWidth(220)
 
@@ -192,26 +193,29 @@ class ToolsPreferencesUI(QtWidgets.QWidget):
 
         self.vlay = QtWidgets.QVBoxLayout()
         self.vlay.addWidget(self.tools_ncc_group)
-        self.vlay.addWidget(self.tools_paint_group)
+        self.vlay.addWidget(self.tools_cutout_group)
 
         self.vlay1 = QtWidgets.QVBoxLayout()
-        self.vlay1.addWidget(self.tools_cutout_group)
-        self.vlay1.addWidget(self.tools_transform_group)
-        self.vlay1.addWidget(self.tools_2sided_group)
+        self.vlay1.addWidget(self.tools_paint_group)
+        self.vlay1.addWidget(self.tools_panelize_group)
 
         self.vlay2 = QtWidgets.QVBoxLayout()
-        self.vlay2.addWidget(self.tools_panelize_group)
+        self.vlay2.addWidget(self.tools_transform_group)
+        self.vlay2.addWidget(self.tools_2sided_group)
         self.vlay2.addWidget(self.tools_sub_group)
-        self.vlay2.addWidget(self.tools_film_group)
 
         self.vlay3 = QtWidgets.QVBoxLayout()
-        self.vlay3.addWidget(self.tools_solderpaste_group)
+        self.vlay3.addWidget(self.tools_film_group)
         self.vlay3.addWidget(self.tools_calculators_group)
 
+        self.vlay4 = QtWidgets.QVBoxLayout()
+        self.vlay4.addWidget(self.tools_solderpaste_group)
+
         self.layout.addLayout(self.vlay)
         self.layout.addLayout(self.vlay1)
         self.layout.addLayout(self.vlay2)
         self.layout.addLayout(self.vlay3)
+        self.layout.addLayout(self.vlay4)
 
         self.layout.addStretch()
 
@@ -3562,8 +3566,8 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.sel_limit_label, 0, 0)
         grid0.addWidget(self.sel_limit_entry, 0, 1)
 
-        # New tool diameter
-        self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Tool Dia'))
+        # New Diameter
+        self.addtool_entry_lbl = QtWidgets.QLabel('%s:' % _('New Dia'))
         self.addtool_entry_lbl.setToolTip(
             _("Diameter for the new tool")
         )
@@ -5012,7 +5016,7 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
         grid0 = QtWidgets.QGridLayout()
         self.layout.addLayout(grid0)
 
-        ncctdlabel = QtWidgets.QLabel('%s:' % _('Tools dia'))
+        ncctdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
         ncctdlabel.setToolTip(
             _("Diameters of the cutting tools, separated by comma.\n"
               "The value of the diameter has to use the dot decimals separator.\n"
@@ -5088,9 +5092,12 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.cutz_entry, 4, 1)
 
         # New Diameter
-        self.newdialabel = QtWidgets.QLabel('%s:' % _('New Tool Dia'))
+        self.newdialabel = QtWidgets.QLabel('%s:' % _('New Dia'))
         self.newdialabel.setToolTip(
-            _("The new tool diameter (cut width) to add in the tool table."))
+            _("Diameter for the new tool to add in the Tool Table.\n"
+              "If the tool is V-shape type then this value is automatically\n"
+              "calculated from the other parameters.")
+        )
         self.newdia_entry = FCDoubleSpinner()
         self.newdia_entry.set_precision(self.decimals)
         self.newdia_entry.set_range(0.0001, 9999.9999)
@@ -5099,6 +5106,11 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.newdialabel, 5, 0)
         grid0.addWidget(self.newdia_entry, 5, 1)
 
+        separator_line = QtWidgets.QFrame()
+        separator_line.setFrameShape(QtWidgets.QFrame.HLine)
+        separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
+        grid0.addWidget(separator_line, 6, 0, 1, 2)
+
         # Milling Type Radio Button
         self.milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
         self.milling_type_label.setToolTip(
@@ -5115,8 +5127,8 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
               "- conventional / useful when there is no backlash compensation")
         )
 
-        grid0.addWidget(self.milling_type_label, 6, 0)
-        grid0.addWidget(self.milling_type_radio, 6, 1)
+        grid0.addWidget(self.milling_type_label, 7, 0)
+        grid0.addWidget(self.milling_type_radio, 7, 1)
 
         # Tool order Radio Button
         self.ncc_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
@@ -5136,11 +5148,16 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
                                           "'Reverse' --> menas that the tools will ordered from big to small\n\n"
                                           "WARNING: using rest machining will automatically set the order\n"
                                           "in reverse and disable this control."))
-        grid0.addWidget(self.ncc_order_label, 7, 0)
-        grid0.addWidget(self.ncc_order_radio, 7, 1)
+        grid0.addWidget(self.ncc_order_label, 8, 0)
+        grid0.addWidget(self.ncc_order_radio, 8, 1)
+
+        separator_line = QtWidgets.QFrame()
+        separator_line.setFrameShape(QtWidgets.QFrame.HLine)
+        separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
+        grid0.addWidget(separator_line, 9, 0, 1, 2)
 
         # Overlap Entry
-        nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
+        nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
         nccoverlabel.setToolTip(
            _("How much (percentage) of the tool width to overlap each tool pass.\n"
              "Adjust the value starting with lower values\n"
@@ -5155,8 +5172,9 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
         self.ncc_overlap_entry.setWrapping(True)
         self.ncc_overlap_entry.setRange(0.0000, 99.9999)
         self.ncc_overlap_entry.setSingleStep(0.1)
-        grid0.addWidget(nccoverlabel, 8, 0)
-        grid0.addWidget(self.ncc_overlap_entry, 8, 1)
+
+        grid0.addWidget(nccoverlabel, 10, 0)
+        grid0.addWidget(self.ncc_overlap_entry, 10, 1)
 
         # Margin entry
         nccmarginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
@@ -5168,8 +5186,8 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
         self.ncc_margin_entry.set_range(-10000, 10000)
         self.ncc_margin_entry.setSingleStep(0.1)
 
-        grid0.addWidget(nccmarginlabel, 9, 0)
-        grid0.addWidget(self.ncc_margin_entry, 9, 1)
+        grid0.addWidget(nccmarginlabel, 11, 0)
+        grid0.addWidget(self.ncc_margin_entry, 11, 1)
 
         # Method
         methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
@@ -5186,8 +5204,8 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
             {"label": _("Straight lines"), "value": "lines"}
         ], orientation='vertical', stretch=False)
 
-        grid0.addWidget(methodlabel, 10, 0)
-        grid0.addWidget(self.ncc_method_radio, 10, 1)
+        grid0.addWidget(methodlabel, 12, 0)
+        grid0.addWidget(self.ncc_method_radio, 12, 1)
 
         # Connect lines
         self.ncc_connect_cb = FCCheckBox('%s' % _("Connect"))
@@ -5196,7 +5214,7 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
               "segments to minimize tool lifts.")
         )
 
-        grid0.addWidget(self.ncc_connect_cb, 11, 0, 1, 2)
+        grid0.addWidget(self.ncc_connect_cb, 13, 0)
 
         # Contour Checkbox
         self.ncc_contour_cb = FCCheckBox('%s' % _("Contour"))
@@ -5205,21 +5223,7 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
              "to trim rough edges.")
         )
 
-        grid0.addWidget(self.ncc_contour_cb, 12, 0, 1, 2)
-
-        # Rest machining CheckBox
-        self.ncc_rest_cb = FCCheckBox('%s' % _("Rest Machining"))
-        self.ncc_rest_cb.setToolTip(
-            _("If checked, use 'rest machining'.\n"
-              "Basically it will clear copper outside PCB features,\n"
-              "using the biggest tool and continue with the next tools,\n"
-              "from bigger to smaller, to clear areas of copper that\n"
-              "could not be cleared by previous tool, until there is\n"
-              "no more copper to clear or there are no more tools.\n"
-              "If not checked, use the standard algorithm.")
-        )
-
-        grid0.addWidget(self.ncc_rest_cb, 13, 0, 1, 2)
+        grid0.addWidget(self.ncc_contour_cb, 13, 1)
 
         # ## NCC Offset choice
         self.ncc_choice_offset_cb = FCCheckBox('%s' % _("Offset"))
@@ -5249,10 +5253,31 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.ncc_offset_label, 15, 0)
         grid0.addWidget(self.ncc_offset_spinner, 15, 1)
 
+        separator_line = QtWidgets.QFrame()
+        separator_line.setFrameShape(QtWidgets.QFrame.HLine)
+        separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
+        grid0.addWidget(separator_line, 16, 0, 1, 2)
+
+        # Rest machining CheckBox
+        self.ncc_rest_cb = FCCheckBox('%s' % _("Rest Machining"))
+        self.ncc_rest_cb.setToolTip(
+            _("If checked, use 'rest machining'.\n"
+              "Basically it will clear copper outside PCB features,\n"
+              "using the biggest tool and continue with the next tools,\n"
+              "from bigger to smaller, to clear areas of copper that\n"
+              "could not be cleared by previous tool, until there is\n"
+              "no more copper to clear or there are no more tools.\n"
+              "If not checked, use the standard algorithm.")
+        )
+
+        grid0.addWidget(self.ncc_rest_cb, 17, 0, 1, 2)
+
         # ## Reference
         self.reference_radio = RadioSet([{'label': _('Itself'), 'value': 'itself'},
-                                         {"label": _("Area"), "value": "area"},
-                                         {'label': _('Ref'), 'value': 'box'}])
+                                         {"label": _("Area Selection"), "value": "area"},
+                                         {'label': _('Reference Object'), 'value': 'box'}],
+                                        orientation='vertical',
+                                        stretch=None)
         reference_label = QtWidgets.QLabel('%s:' % _("Reference"))
         reference_label.setToolTip(
             _("- 'Itself' -  the non copper clearing extent\n"
@@ -5263,8 +5288,13 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
               "specified by another object.")
         )
 
-        grid0.addWidget(reference_label, 16, 0)
-        grid0.addWidget(self.reference_radio, 16, 1)
+        grid0.addWidget(reference_label, 18, 0)
+        grid0.addWidget(self.reference_radio, 18, 1)
+
+        separator_line = QtWidgets.QFrame()
+        separator_line.setFrameShape(QtWidgets.QFrame.HLine)
+        separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
+        grid0.addWidget(separator_line, 19, 0, 1, 2)
 
         # ## Plotting type
         self.ncc_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
@@ -5274,8 +5304,8 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
             _("- 'Normal' -  normal plotting, done at the end of the NCC job\n"
               "- 'Progressive' - after each shape is generated it will be plotted.")
         )
-        grid0.addWidget(plotting_label, 17, 0)
-        grid0.addWidget(self.ncc_plotting_radio, 17, 1)
+        grid0.addWidget(plotting_label, 20, 0)
+        grid0.addWidget(self.ncc_plotting_radio, 20, 1)
 
         self.layout.addStretch()
 
@@ -5520,10 +5550,12 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
         self.layout.addWidget(self.paint_label)
 
         grid0 = QtWidgets.QGridLayout()
+        grid0.setColumnStretch(0, 0)
+        grid0.setColumnStretch(1, 1)
         self.layout.addLayout(grid0)
 
         # Tool dia
-        ptdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
+        ptdlabel = QtWidgets.QLabel('<b><font color="green">%s:</font></b>' % _('Tools Dia'))
         ptdlabel.setToolTip(
             _("Diameters of the cutting tools, separated by comma.\n"
               "The value of the diameter has to use the dot decimals separator.\n"
@@ -5536,7 +5568,88 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
 
         grid0.addWidget(self.painttooldia_entry, 0, 1)
 
-        self.paint_order_label = QtWidgets.QLabel('<b>%s:</b>' % _('Tool order'))
+        # Tool Type Radio Button
+        self.tool_type_label = QtWidgets.QLabel('%s:' % _('Tool Type'))
+        self.tool_type_label.setToolTip(
+            _("Default tool type:\n"
+              "- 'V-shape'\n"
+              "- Circular")
+        )
+
+        self.tool_type_radio = RadioSet([{'label': _('V-shape'), 'value': 'V'},
+                                         {'label': _('Circular'), 'value': 'C1'}])
+
+        self.tool_type_radio.setObjectName(_("Tool Type"))
+
+        grid0.addWidget(self.tool_type_label, 1, 0)
+        grid0.addWidget(self.tool_type_radio, 1, 1)
+
+        # Tip Dia
+        self.tipdialabel = QtWidgets.QLabel('%s:' % _('V-Tip Dia'))
+        self.tipdialabel.setToolTip(
+            _("The tip diameter for V-Shape Tool"))
+        self.tipdia_entry = FCDoubleSpinner()
+        self.tipdia_entry.set_precision(self.decimals)
+        self.tipdia_entry.set_range(0.0000, 9999.9999)
+        self.tipdia_entry.setSingleStep(0.1)
+        self.tipdia_entry.setObjectName(_("V-Tip Dia"))
+
+        grid0.addWidget(self.tipdialabel, 2, 0)
+        grid0.addWidget(self.tipdia_entry, 2, 1)
+
+        # Tip Angle
+        self.tipanglelabel = QtWidgets.QLabel('%s:' % _('V-Tip Angle'))
+        self.tipanglelabel.setToolTip(
+            _("The tip angle for V-Shape Tool.\n"
+              "In degree."))
+        self.tipangle_entry = FCDoubleSpinner()
+        self.tipangle_entry.set_precision(self.decimals)
+        self.tipangle_entry.set_range(0.0000, 180.0000)
+        self.tipangle_entry.setSingleStep(5)
+        self.tipangle_entry.setObjectName(_("V-Tip Angle"))
+
+        grid0.addWidget(self.tipanglelabel, 3, 0)
+        grid0.addWidget(self.tipangle_entry, 3, 1)
+
+        # Cut Z entry
+        cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
+        cutzlabel.setToolTip(
+            _("Depth of cut into material. Negative value.\n"
+              "In FlatCAM units.")
+        )
+        self.cutz_entry = FCDoubleSpinner()
+        self.cutz_entry.set_precision(self.decimals)
+        self.cutz_entry.set_range(-99999.9999, 0.0000)
+        self.cutz_entry.setObjectName(_("Cut Z"))
+
+        self.cutz_entry.setToolTip(
+            _("Depth of cut into material. Negative value.\n"
+              "In FlatCAM units.")
+        )
+        grid0.addWidget(cutzlabel, 4, 0)
+        grid0.addWidget(self.cutz_entry, 4, 1)
+
+        # ### Tool Diameter ####
+        self.newdialabel = QtWidgets.QLabel('%s:' % _('New Dia'))
+        self.newdialabel.setToolTip(
+            _("Diameter for the new tool to add in the Tool Table.\n"
+              "If the tool is V-shape type then this value is automatically\n"
+              "calculated from the other parameters.")
+        )
+        self.newdia_entry = FCDoubleSpinner()
+        self.newdia_entry.set_precision(self.decimals)
+        self.newdia_entry.set_range(0.000, 9999.9999)
+        self.newdia_entry.setObjectName(_("Tool Dia"))
+
+        grid0.addWidget(self.newdialabel, 5, 0)
+        grid0.addWidget(self.newdia_entry, 5, 1)
+
+        separator_line = QtWidgets.QFrame()
+        separator_line.setFrameShape(QtWidgets.QFrame.HLine)
+        separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
+        grid0.addWidget(separator_line, 6, 0, 1, 2)
+
+        self.paint_order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
         self.paint_order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
                                             "'No' --> means that the used order is the one in the tool table\n"
                                             "'Forward' --> means that the tools will be ordered from small to big\n"
@@ -5547,17 +5660,17 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
         self.paint_order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
                                            {'label': _('Forward'), 'value': 'fwd'},
                                            {'label': _('Reverse'), 'value': 'rev'}])
-        self.paint_order_radio.setToolTip(_("This set the way that the tools in the tools table are used.\n"
-                                            "'No' --> means that the used order is the one in the tool table\n"
-                                            "'Forward' --> means that the tools will be ordered from small to big\n"
-                                            "'Reverse' --> menas that the tools will ordered from big to small\n\n"
-                                            "WARNING: using rest machining will automatically set the order\n"
-                                            "in reverse and disable this control."))
-        grid0.addWidget(self.paint_order_label, 1, 0)
-        grid0.addWidget(self.paint_order_radio, 1, 1)
+
+        grid0.addWidget(self.paint_order_label, 7, 0)
+        grid0.addWidget(self.paint_order_radio, 7, 1)
+
+        separator_line = QtWidgets.QFrame()
+        separator_line.setFrameShape(QtWidgets.QFrame.HLine)
+        separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
+        grid0.addWidget(separator_line, 8, 0, 1, 2)
 
         # Overlap
-        ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
+        ovlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
         ovlabel.setToolTip(
             _("How much (percentage) of the tool width to overlap each tool pass.\n"
               "Adjust the value starting with lower values\n"
@@ -5573,8 +5686,8 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
         self.paintoverlap_entry.setRange(0.0000, 99.9999)
         self.paintoverlap_entry.setSingleStep(0.1)
 
-        grid0.addWidget(ovlabel, 2, 0)
-        grid0.addWidget(self.paintoverlap_entry, 2, 1)
+        grid0.addWidget(ovlabel, 9, 0)
+        grid0.addWidget(self.paintoverlap_entry, 9, 1)
 
         # Margin
         marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
@@ -5583,13 +5696,13 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
               "the edges of the polygon to\n"
               "be painted.")
         )
-        grid0.addWidget(marginlabel, 3, 0)
         self.paintmargin_entry = FCDoubleSpinner()
         self.paintmargin_entry.set_range(-9999.9999, 9999.9999)
         self.paintmargin_entry.set_precision(self.decimals)
         self.paintmargin_entry.setSingleStep(0.1)
 
-        grid0.addWidget(self.paintmargin_entry, 3, 1)
+        grid0.addWidget(marginlabel, 10, 0)
+        grid0.addWidget(self.paintmargin_entry, 10, 1)
 
         # Method
         methodlabel = QtWidgets.QLabel('%s:' % _('Method'))
@@ -5599,13 +5712,15 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
               "<B>Seed-based</B>: Outwards from seed.<BR>"
               "<B>Line-based</B>: Parallel lines.")
         )
-        grid0.addWidget(methodlabel, 4, 0)
+
         self.paintmethod_combo = RadioSet([
             {"label": _("Standard"), "value": "standard"},
             {"label": _("Seed-based"), "value": "seed"},
             {"label": _("Straight lines"), "value": "lines"}
         ], orientation='vertical', stretch=False)
-        grid0.addWidget(self.paintmethod_combo, 4, 1)
+
+        grid0.addWidget(methodlabel, 11, 0)
+        grid0.addWidget(self.paintmethod_combo, 11, 1)
 
         # Connect lines
         self.pathconnect_cb = FCCheckBox('%s' % _("Connect"))
@@ -5613,7 +5728,7 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
             _("Draw lines between resulting\n"
               "segments to minimize tool lifts.")
         )
-        grid0.addWidget(self.pathconnect_cb, 5, 0, 1, 2)
+        grid0.addWidget(self.pathconnect_cb, 12, 0)
 
         # Paint contour
         self.contour_cb = FCCheckBox('%s' % _("Contour"))
@@ -5621,7 +5736,25 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
             _("Cut around the perimeter of the polygon\n"
               "to trim rough edges.")
         )
-        grid0.addWidget(self.contour_cb, 6, 0, 1, 2)
+        grid0.addWidget(self.contour_cb, 12, 1)
+
+        separator_line = QtWidgets.QFrame()
+        separator_line.setFrameShape(QtWidgets.QFrame.HLine)
+        separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
+        grid0.addWidget(separator_line, 13, 0, 1, 2)
+
+        self.rest_cb = FCCheckBox('%s' % _("Rest Machining"))
+        self.rest_cb.setObjectName(_("Rest Machining"))
+        self.rest_cb.setToolTip(
+            _("If checked, use 'rest machining'.\n"
+              "Basically it will clear copper outside PCB features,\n"
+              "using the biggest tool and continue with the next tools,\n"
+              "from bigger to smaller, to clear areas of copper that\n"
+              "could not be cleared by previous tool, until there is\n"
+              "no more copper to clear or there are no more tools.\n\n"
+              "If not checked, use the standard algorithm.")
+        )
+        grid0.addWidget(self.rest_cb, 14, 0, 1, 2)
 
         # Polygon selection
         selectlabel = QtWidgets.QLabel('%s:' % _('Selection'))
@@ -5634,14 +5767,23 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
               "- 'Reference Object' - will do non copper clearing within the area\n"
               "specified by another object.")
         )
-        self.selectmethod_combo = RadioSet([
-            {"label": _("Sel"), "value": "single"},
-            {"label": _("Area"), "value": "area"},
-            {"label": _("All"), "value": "all"},
-            {"label": _("Ref"), "value": "ref"}
-        ])
-        grid0.addWidget(selectlabel, 7, 0)
-        grid0.addWidget(self.selectmethod_combo, 7, 1)
+        self.selectmethod_combo = RadioSet(
+            [
+                {"label": _("Polygon Selection"), "value": "single"},
+                {"label": _("Area Selection"), "value": "area"},
+                {"label": _("All Polygons"), "value": "all"},
+                {"label": _("Reference Object"), "value": "ref"}
+            ],
+            orientation='vertical',
+            stretch=None
+        )
+        grid0.addWidget(selectlabel, 15, 0)
+        grid0.addWidget(self.selectmethod_combo, 15, 1)
+
+        separator_line = QtWidgets.QFrame()
+        separator_line.setFrameShape(QtWidgets.QFrame.HLine)
+        separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
+        grid0.addWidget(separator_line, 16, 0, 1, 2)
 
         # ## Plotting type
         self.paint_plotting_radio = RadioSet([{'label': _('Normal'), 'value': 'normal'},
@@ -5651,8 +5793,8 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
             _("- 'Normal' -  normal plotting, done at the end of the Paint job\n"
               "- 'Progressive' - after each shape is generated it will be plotted.")
         )
-        grid0.addWidget(plotting_label, 8, 0)
-        grid0.addWidget(self.paint_plotting_radio, 8, 1)
+        grid0.addWidget(plotting_label, 17, 0)
+        grid0.addWidget(self.paint_plotting_radio, 17, 1)
 
         self.layout.addStretch()
 

+ 12 - 5
flatcamTools/ToolNonCopperClear.py

@@ -352,7 +352,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
         self.grid3.addWidget(self.tool_data_label, 12, 0, 1, 2)
 
         # Overlap Entry
-        nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
+        nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
         nccoverlabel.setToolTip(
             _("How much (percentage) of the tool width to overlap each tool pass.\n"
               "Adjust the value starting with lower values\n"
@@ -367,7 +367,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
         self.ncc_overlap_entry.setWrapping(True)
         self.ncc_overlap_entry.setRange(0.000, 99.9999)
         self.ncc_overlap_entry.setSingleStep(0.1)
-        self.ncc_overlap_entry.setObjectName(_("Overlap Rate"))
+        self.ncc_overlap_entry.setObjectName(_("Overlap"))
 
         self.grid3.addWidget(nccoverlabel, 13, 0)
         self.grid3.addWidget(self.ncc_overlap_entry, 13, 1)
@@ -653,7 +653,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
         }
 
         self.name2option = {
-            _('Overlap Rate'): "nccoverlap",
+            _('Overlap'): "nccoverlap",
             _('Margin'): "nccmargin",
             _('Method'): "nccmethod",
             _("Connect"): "nccconnect",
@@ -663,6 +663,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
             _('Milling Type'): "milling_type",
         }
 
+        self.old_tool_dia = None
+
         # #############################################################################
         # ############################ SIGNALS ########################################
         # #############################################################################
@@ -901,6 +903,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
         self.tipangle_entry.set_value(self.app.defaults["tools_ncctipangle"])
         self.addtool_entry.set_value(self.app.defaults["tools_nccnewdia"])
 
+        self.old_tool_dia = self.app.defaults["tools_nccnewdia"]
+
         self.on_tool_type(val=self.tool_type_radio.get_value())
 
         # init the working variables
@@ -1238,6 +1242,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
             self.tipdia_entry.show()
             self.tipanglelabel.show()
             self.tipangle_entry.show()
+
+            self.on_calculate_tooldia()
         else:
             self.addtool_entry_lbl.setDisabled(False)
             self.addtool_entry.setDisabled(False)
@@ -1246,6 +1252,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
             self.tipanglelabel.hide()
             self.tipangle_entry.hide()
 
+            self.addtool_entry.set_value(self.old_tool_dia)
+
     def on_calculate_tooldia(self):
         if self.tool_type_radio.get_value() == 'V':
             tip_dia = float(self.tipdia_entry.get_value())
@@ -1332,7 +1340,6 @@ class NonCopperClear(FlatCAMTool, Gerber):
             })
 
         self.blockSignals(False)
-
         self.build_ui()
 
     def on_tool_edit(self):
@@ -1393,7 +1400,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
         deleted_tools_list = []
 
         if all_tools:
-            self.paint_tools.clear()
+            self.ncc_tools.clear()
             self.blockSignals(False)
             self.build_ui()
             return

+ 27 - 24
flatcamTools/ToolPaint.py

@@ -329,7 +329,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         self.tools_box.addLayout(grid4)
 
         # Overlap
-        ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
+        ovlabel = QtWidgets.QLabel('%s:' % _('Overlap'))
         ovlabel.setToolTip(
             _("How much (percentage) of the tool width to overlap each tool pass.\n"
               "Adjust the value starting with lower values\n"
@@ -344,7 +344,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         self.paintoverlap_entry.setWrapping(True)
         self.paintoverlap_entry.setRange(0.0000, 99.9999)
         self.paintoverlap_entry.setSingleStep(0.1)
-        self.paintoverlap_entry.setObjectName(_("Overlap Rate"))
+        self.paintoverlap_entry.setObjectName(_("Overlap"))
 
         grid4.addWidget(ovlabel, 1, 0)
         grid4.addWidget(self.paintoverlap_entry, 1, 1)
@@ -583,13 +583,15 @@ class ToolPaint(FlatCAMTool, Gerber):
         }
 
         self.name2option = {
-            _('Overlap Rate'): "paintoverlap",
+            _('Overlap'): "paintoverlap",
             _('Margin'): "paintmargin",
             _('Method'): "paintmethod",
             _("Connect"): "pathconnect",
             _("Contour"): "paintcontour",
         }
 
+        self.old_tool_dia = None
+
         # #############################################################################
         # ################################# Signals ###################################
         # #############################################################################
@@ -833,6 +835,8 @@ class ToolPaint(FlatCAMTool, Gerber):
             self.tipdia_entry.show()
             self.tipanglelabel.show()
             self.tipangle_entry.show()
+
+            self.on_calculate_tooldia()
         else:
             self.addtool_entry_lbl.setDisabled(False)
             self.addtool_entry.setDisabled(False)
@@ -841,6 +845,8 @@ class ToolPaint(FlatCAMTool, Gerber):
             self.tipanglelabel.hide()
             self.tipangle_entry.hide()
 
+            self.addtool_entry.set_value(self.old_tool_dia)
+
     def on_calculate_tooldia(self):
         if self.tool_type_radio.get_value() == 'V':
             tip_dia = float(self.tipdia_entry.get_value())
@@ -921,6 +927,9 @@ class ToolPaint(FlatCAMTool, Gerber):
         self.tipdia_entry.set_value(self.app.defaults["tools_painttipdia"])
         self.tipangle_entry.set_value(self.app.defaults["tools_painttipangle"])
         self.addtool_entry.set_value(self.app.defaults["tools_paintnewdia"])
+        self.rest_cb.set_value(self.app.defaults["tools_paintrest"])
+
+        self.old_tool_dia = self.app.defaults["tools_paintnewdia"]
 
         self.on_tool_type(val=self.tool_type_radio.get_value())
 
@@ -1080,21 +1089,16 @@ class ToolPaint(FlatCAMTool, Gerber):
         self.box_combo.setCurrentIndex(0)
 
     def on_tool_add(self, dia=None, muted=None):
-
-        try:
-            self.tools_table.itemChanged.disconnect()
-        except TypeError:
-            pass
+        self.blockSignals(True)
 
         if dia:
             tool_dia = dia
         else:
-            tool_dia = float(self.addtool_entry.get_value())
+            tool_dia = self.on_calculate_tooldia()
 
             if tool_dia is None:
                 self.build_ui()
-                self.app.inform.emit('[WARNING_NOTCL] %s' %
-                                     _("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
@@ -1136,15 +1140,13 @@ class ToolPaint(FlatCAMTool, Gerber):
                 }
             })
 
+        self.blockSignals(False)
         self.build_ui()
 
     def on_tool_edit(self):
-        old_tool_dia = ''
+        self.blockSignals(True)
 
-        try:
-            self.tools_table.itemChanged.disconnect()
-        except TypeError:
-            pass
+        old_tool_dia = ''
 
         tool_dias = []
         for k, v in self.paint_tools.items():
@@ -1182,6 +1184,7 @@ class ToolPaint(FlatCAMTool, Gerber):
                 restore_dia_item.setText(str(old_tool_dia))
                 self.app.inform.emit('[WARNING_NOTCL] %s' %
                                      _("Edit cancelled. New diameter value is already in the Tool Table."))
+        self.blockSignals(False)
         self.build_ui()
 
     # def on_tool_copy(self, all=None):
@@ -1240,15 +1243,13 @@ class ToolPaint(FlatCAMTool, Gerber):
     #     self.app.inform.emit("[success] Tool was copied in the Tool Table.")
 
     def on_tool_delete(self, rows_to_delete=None, all=None):
-        try:
-            self.tools_table.itemChanged.disconnect()
-        except TypeError:
-            pass
+        self.blockSignals(True)
 
         deleted_tools_list = []
 
         if all:
             self.paint_tools.clear()
+            self.blockSignals(False)
             self.build_ui()
             return
 
@@ -1262,6 +1263,8 @@ class ToolPaint(FlatCAMTool, Gerber):
 
             for t in deleted_tools_list:
                 self.paint_tools.pop(t, None)
+
+            self.blockSignals(False)
             self.build_ui()
             return
 
@@ -1278,14 +1281,14 @@ class ToolPaint(FlatCAMTool, Gerber):
                     self.paint_tools.pop(t, None)
 
         except AttributeError:
-            self.app.inform.emit('[WARNING_NOTCL] %s' %
-                                 _("Delete failed. Select a tool to delete."))
+            self.app.inform.emit('[WARNING_NOTCL] %s' % _("Delete failed. Select a tool to delete."))
+            self.blockSignals(False)
             return
         except Exception as e:
             log.debug(str(e))
 
-        self.app.inform.emit('[success] %s' %
-                             _("Tool(s) deleted from Tool Table."))
+        self.app.inform.emit('[success] %s' % _("Tool(s) deleted from Tool Table."))
+        self.blockSignals(False)
         self.build_ui()
 
     def on_paint_button_click(self):