From c6baa8ca60c344bf79989a949eaca12484392783 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 13 Jul 2020 15:49:11 +0300 Subject: [PATCH] - Multiple Tools fix - fixed issue with converting slots to drills selection being cleared when togglinh all rows by clicking on the header - Multiple Tools fix - fixes for when having multiple tools selected which created issues in tool tables for many tools --- CHANGELOG.md | 2 ++ appObjects/FlatCAMGeometry.py | 20 ++++++++++++++++++-- appTools/ToolDrilling.py | 23 +++++++++++++++++++++-- appTools/ToolIsolation.py | 20 ++++++++++++++++++-- appTools/ToolMilling.py | 20 ++++++++++++++++++-- appTools/ToolNCC.py | 20 ++++++++++++++++++-- appTools/ToolPaint.py | 20 ++++++++++++++++++-- appTools/ToolSolderPaste.py | 13 ++++++++++++- 8 files changed, 125 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c77fb93..cee853c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ CHANGELOG for FlatCAM beta - Drilling Tool - now slots are converted to drills if the checkbox is ON for the tool investigated - Drilling Tool - fixes due of changes in properties (preferences) - fixed the Drillcncjob TCL command +- Multiple Tools fix - fixed issue with converting slots to drills selection being cleared when togglinh all rows by clicking on the header +- Multiple Tools fix - fixes for when having multiple tools selected which created issues in tool tables for many tools 12.07.2020 diff --git a/appObjects/FlatCAMGeometry.py b/appObjects/FlatCAMGeometry.py index 8f68d100..dbf67354 100644 --- a/appObjects/FlatCAMGeometry.py +++ b/appObjects/FlatCAMGeometry.py @@ -839,12 +839,28 @@ class GeometryObject(FlatCAMObj, Geometry): if len(sel_rows) == self.ui.geo_tools_table.rowCount(): self.ui.geo_tools_table.clearSelection() + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("No Tool Selected")) + ) else: self.ui.geo_tools_table.selectAll() - self.update_ui() + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("Multiple Tools")) + ) def on_row_selection_change(self): - self.update_ui() + sel_model = self.ui.geo_tools_table.selectionModel() + sel_indexes = sel_model.selectedIndexes() + + # it will iterate over all indexes which means all items in all columns too but I'm interested only on rows + sel_rows = set() + for idx in sel_indexes: + sel_rows.add(idx.row()) + + # update UI only if only one row is selected otherwise having multiple rows selected will deform information + # for the rows other that the current one (first selected) + if len(sel_rows) == 1: + self.update_ui() def update_ui(self, row=None): self.ui_disconnect() diff --git a/appTools/ToolDrilling.py b/appTools/ToolDrilling.py index 2a0a46cf..0f415d09 100644 --- a/appTools/ToolDrilling.py +++ b/appTools/ToolDrilling.py @@ -888,13 +888,32 @@ class ToolDrilling(AppTool, Excellon): if len(sel_rows) == self.t_ui.tools_table.rowCount(): self.t_ui.tools_table.clearSelection() self.t_ui.exc_param_frame.setDisabled(True) + + self.t_ui.generate_cnc_button.setDisabled(True) + self.t_ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("No Tool Selected")) + ) else: self.t_ui.tools_table.selectAll() self.t_ui.exc_param_frame.setDisabled(False) - self.update_ui() + self.t_ui.generate_cnc_button.setDisabled(False) + self.t_ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("Multiple Tools")) + ) def on_row_selection_change(self): - self.update_ui() + sel_model = self.t_ui.tools_table.selectionModel() + sel_indexes = sel_model.selectedIndexes() + + # it will iterate over all indexes which means all items in all columns too but I'm interested only on rows + sel_rows = set() + for idx in sel_indexes: + sel_rows.add(idx.row()) + + # update UI only if only one row is selected otherwise having multiple rows selected will deform information + # for the rows other that the current one (first selected) + if len(sel_rows) == 1: + self.update_ui() def update_ui(self): self.blockSignals(True) diff --git a/appTools/ToolIsolation.py b/appTools/ToolIsolation.py index 5a845b2b..bd54e850 100644 --- a/appTools/ToolIsolation.py +++ b/appTools/ToolIsolation.py @@ -647,12 +647,28 @@ class ToolIsolation(AppTool, Gerber): if len(sel_rows) == self.t_ui.tools_table.rowCount(): self.t_ui.tools_table.clearSelection() + self.t_ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("No Tool Selected")) + ) else: self.t_ui.tools_table.selectAll() - self.update_ui() + self.t_ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("Multiple Tools")) + ) def on_row_selection_change(self): - self.update_ui() + sel_model = self.t_ui.tools_table.selectionModel() + sel_indexes = sel_model.selectedIndexes() + + # it will iterate over all indexes which means all items in all columns too but I'm interested only on rows + sel_rows = set() + for idx in sel_indexes: + sel_rows.add(idx.row()) + + # update UI only if only one row is selected otherwise having multiple rows selected will deform information + # for the rows other that the current one (first selected) + if len(sel_rows) == 1: + self.update_ui() def update_ui(self): self.blockSignals(True) diff --git a/appTools/ToolMilling.py b/appTools/ToolMilling.py index d2744831..8f97de91 100644 --- a/appTools/ToolMilling.py +++ b/appTools/ToolMilling.py @@ -740,12 +740,28 @@ class ToolMilling(AppTool, Excellon): if len(sel_rows) == self.ui.tools_table.rowCount(): self.ui.tools_table.clearSelection() + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("No Tool Selected")) + ) else: self.ui.tools_table.selectAll() - self.update_ui() + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("Multiple Tools")) + ) def on_row_selection_change(self): - self.update_ui() + sel_model = self.ui.tools_table.selectionModel() + sel_indexes = sel_model.selectedIndexes() + + # it will iterate over all indexes which means all items in all columns too but I'm interested only on rows + sel_rows = set() + for idx in sel_indexes: + sel_rows.add(idx.row()) + + # update UI only if only one row is selected otherwise having multiple rows selected will deform information + # for the rows other that the current one (first selected) + if len(sel_rows) == 1: + self.update_ui() def update_ui(self): self.blockSignals(True) diff --git a/appTools/ToolNCC.py b/appTools/ToolNCC.py index a65b7b08..69d5dbba 100644 --- a/appTools/ToolNCC.py +++ b/appTools/ToolNCC.py @@ -263,12 +263,28 @@ class NonCopperClear(AppTool, Gerber): if len(sel_rows) == self.ui.tools_table.rowCount(): self.ui.tools_table.clearSelection() + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("No Tool Selected")) + ) else: self.ui.tools_table.selectAll() - self.update_ui() + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("Multiple Tools")) + ) def on_row_selection_change(self): - self.update_ui() + sel_model = self.ui.tools_table.selectionModel() + sel_indexes = sel_model.selectedIndexes() + + # it will iterate over all indexes which means all items in all columns too but I'm interested only on rows + sel_rows = set() + for idx in sel_indexes: + sel_rows.add(idx.row()) + + # update UI only if only one row is selected otherwise having multiple rows selected will deform information + # for the rows other that the current one (first selected) + if len(sel_rows) == 1: + self.update_ui() def update_ui(self): self.blockSignals(True) diff --git a/appTools/ToolPaint.py b/appTools/ToolPaint.py index 5ab6a045..dfb56257 100644 --- a/appTools/ToolPaint.py +++ b/appTools/ToolPaint.py @@ -245,12 +245,28 @@ class ToolPaint(AppTool, Gerber): if len(sel_rows) == self.ui.tools_table.rowCount(): self.ui.tools_table.clearSelection() + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("No Tool Selected")) + ) else: self.ui.tools_table.selectAll() - self.update_ui() + self.ui.tool_data_label.setText( + "%s: %s" % (_('Parameters for'), _("Multiple Tools")) + ) def on_row_selection_change(self): - self.update_ui() + sel_model = self.ui.tools_table.selectionModel() + sel_indexes = sel_model.selectedIndexes() + + # it will iterate over all indexes which means all items in all columns too but I'm interested only on rows + sel_rows = set() + for idx in sel_indexes: + sel_rows.add(idx.row()) + + # update UI only if only one row is selected otherwise having multiple rows selected will deform information + # for the rows other that the current one (first selected) + if len(sel_rows) == 1: + self.update_ui() def update_ui(self): self.blockSignals(True) diff --git a/appTools/ToolSolderPaste.py b/appTools/ToolSolderPaste.py index adc7d31f..6a4739a4 100644 --- a/appTools/ToolSolderPaste.py +++ b/appTools/ToolSolderPaste.py @@ -305,7 +305,18 @@ class SolderPaste(AppTool): self.ui_connect() def on_row_selection_change(self): - self.update_ui() + sel_model = self.ui.tools_table.selectionModel() + sel_indexes = sel_model.selectedIndexes() + + # it will iterate over all indexes which means all items in all columns too but I'm interested only on rows + sel_rows = set() + for idx in sel_indexes: + sel_rows.add(idx.row()) + + # update UI only if only one row is selected otherwise having multiple rows selected will deform information + # for the rows other that the current one (first selected) + if len(sel_rows) == 1: + self.update_ui() def ui_connect(self): # on any change to the widgets that matter it will be called self.gui_form_to_storage which will save the