From 5dcc31ef8b3efa765c30c13a63805bd8a1f840d3 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 14 Jun 2020 21:24:23 +0300 Subject: [PATCH] - modified the Paint, NCC and Isolation Tools that when no tools is selected in the Tools Table, a message will show that no Tool is selected and the Geometry generation button is disabled --- CHANGELOG.md | 1 + appTools/ToolIsolation.py | 11 ++++++--- appTools/ToolNCC.py | 11 ++++++--- appTools/ToolPaint.py | 47 ++++++++++++++++++++------------------- 4 files changed, 41 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16806675..d4e63c6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ CHANGELOG for FlatCAM beta - in Paint and NCC Tools made sure that using the key ESCAPE to cancel the tool will not create mouse events issues - some updates in Tcl commands Paint and CopperClear data dicts - modified the Isolation Tool UI: now the tools can be reordered (if the order UI radio is set to 'no') +- modified the Paint, NCC and Isolation Tools that when no tools is selected in the Tools Table, a message will show that no Tool is selected and the Geometry generation button is disabled 13.06.2020 diff --git a/appTools/ToolIsolation.py b/appTools/ToolIsolation.py index 7941e8f2..01c09f17 100644 --- a/appTools/ToolIsolation.py +++ b/appTools/ToolIsolation.py @@ -657,11 +657,16 @@ class ToolIsolation(AppTool, Gerber): for it in table_items: sel_rows.add(it.row()) # sel_rows = sorted(set(index.row() for index in self.ui.tools_table.selectedIndexes())) - else: - sel_rows = [0] - if not sel_rows: + if not sel_rows or len(sel_rows) == 0: + self.ui.generate_iso_button.setDisabled(True) + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("No Tool Selected")) + ) + self.blockSignals(False) return + else: + self.ui.generate_iso_button.setDisabled(False) for current_row in sel_rows: # populate the form with the data from the tool associated with the row parameter diff --git a/appTools/ToolNCC.py b/appTools/ToolNCC.py index 8a1338bd..1f9fc08f 100644 --- a/appTools/ToolNCC.py +++ b/appTools/ToolNCC.py @@ -278,11 +278,16 @@ class NonCopperClear(AppTool, Gerber): for it in table_items: sel_rows.add(it.row()) # sel_rows = sorted(set(index.row() for index in self.ui.tools_table.selectedIndexes())) - else: - sel_rows = [0] - if not sel_rows: + if not sel_rows or len(sel_rows) == 0: + self.ui.generate_ncc_button.setDisabled(True) + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("No Tool Selected")) + ) + self.blockSignals(False) return + else: + self.ui.generate_ncc_button.setDisabled(False) for current_row in sel_rows: # populate the form with the data from the tool associated with the row parameter diff --git a/appTools/ToolPaint.py b/appTools/ToolPaint.py index 6ecd75cc..6a6b1824 100644 --- a/appTools/ToolPaint.py +++ b/appTools/ToolPaint.py @@ -103,19 +103,19 @@ class ToolPaint(AppTool, Gerber): self.tool_type_item_options = ["C1", "C2", "C3", "C4", "B", "V"] self.form_fields = { - "tools_paintoverlap": self.ui.paintoverlap_entry, - "tools_paintoffset": self.ui.offset_entry, - "tools_paintmethod": self.ui.paintmethod_combo, - "tools_pathconnect": self.ui.pathconnect_cb, - "tools_paintcontour": self.ui.paintcontour_cb, + "tools_paintoverlap": self.ui.paintoverlap_entry, + "tools_paintoffset": self.ui.offset_entry, + "tools_paintmethod": self.ui.paintmethod_combo, + "tools_pathconnect": self.ui.pathconnect_cb, + "tools_paintcontour": self.ui.paintcontour_cb, } self.name2option = { - 'p_overlap': "tools_paintoverlap", - 'p_offset': "tools_paintoffset", - 'p_method': "tools_paintmethod", - 'p_connect': "tools_pathconnect", - 'p_contour': "tools_paintcontour", + 'p_overlap': "tools_paintoverlap", + 'p_offset': "tools_paintoffset", + 'p_method': "tools_paintmethod", + 'p_connect': "tools_pathconnect", + 'p_contour': "tools_paintcontour", } self.old_tool_dia = None @@ -262,11 +262,16 @@ class ToolPaint(AppTool, Gerber): for it in table_items: sel_rows.add(it.row()) # sel_rows = sorted(set(index.row() for index in self.ui.tools_table.selectedIndexes())) - else: - sel_rows = [0] - if not sel_rows: + if not sel_rows or len(sel_rows) == 0: + self.ui.generate_paint_button.setDisabled(True) + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("No Tool Selected")) + ) + self.blockSignals(False) return + else: + self.ui.generate_paint_button.setDisabled(False) for current_row in sel_rows: # populate the form with the data from the tool associated with the row parameter @@ -3742,18 +3747,14 @@ class PaintUI: # GO Button self.generate_paint_button = QtWidgets.QPushButton(_('Generate Geometry')) self.generate_paint_button.setToolTip( - _("- 'Area Selection' - left mouse click to start selection of the area to be painted.\n" - "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n" - "- 'All Polygons' - the Paint will start after click.\n" - "- 'Reference Object' - will do non copper clearing within the area\n" - "specified by another object.") + _("Create a Geometry Object which paints the polygons.") ) self.generate_paint_button.setStyleSheet(""" - QPushButton - { - font-weight: bold; - } - """) + QPushButton + { + font-weight: bold; + } + """) self.tools_box.addWidget(self.generate_paint_button) self.tools_box.addStretch()