Просмотр исходного кода

- 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

Marius Stanciu 5 лет назад
Родитель
Сommit
c6baa8ca60

+ 2 - 0
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 - now slots are converted to drills if the checkbox is ON for the tool investigated
 - Drilling Tool - fixes due of changes in properties (preferences)
 - Drilling Tool - fixes due of changes in properties (preferences)
 - fixed the Drillcncjob TCL command
 - 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
 12.07.2020
 
 

+ 18 - 2
appObjects/FlatCAMGeometry.py

@@ -839,12 +839,28 @@ class GeometryObject(FlatCAMObj, Geometry):
 
 
         if len(sel_rows) == self.ui.geo_tools_table.rowCount():
         if len(sel_rows) == self.ui.geo_tools_table.rowCount():
             self.ui.geo_tools_table.clearSelection()
             self.ui.geo_tools_table.clearSelection()
+            self.ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("No Tool Selected"))
+            )
         else:
         else:
             self.ui.geo_tools_table.selectAll()
             self.ui.geo_tools_table.selectAll()
-        self.update_ui()
+            self.ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
+            )
 
 
     def on_row_selection_change(self):
     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):
     def update_ui(self, row=None):
         self.ui_disconnect()
         self.ui_disconnect()

+ 21 - 2
appTools/ToolDrilling.py

@@ -888,13 +888,32 @@ class ToolDrilling(AppTool, Excellon):
         if len(sel_rows) == self.t_ui.tools_table.rowCount():
         if len(sel_rows) == self.t_ui.tools_table.rowCount():
             self.t_ui.tools_table.clearSelection()
             self.t_ui.tools_table.clearSelection()
             self.t_ui.exc_param_frame.setDisabled(True)
             self.t_ui.exc_param_frame.setDisabled(True)
+
+            self.t_ui.generate_cnc_button.setDisabled(True)
+            self.t_ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("No Tool Selected"))
+            )
         else:
         else:
             self.t_ui.tools_table.selectAll()
             self.t_ui.tools_table.selectAll()
             self.t_ui.exc_param_frame.setDisabled(False)
             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(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
+            )
 
 
     def on_row_selection_change(self):
     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):
     def update_ui(self):
         self.blockSignals(True)
         self.blockSignals(True)

+ 18 - 2
appTools/ToolIsolation.py

@@ -647,12 +647,28 @@ class ToolIsolation(AppTool, Gerber):
 
 
         if len(sel_rows) == self.t_ui.tools_table.rowCount():
         if len(sel_rows) == self.t_ui.tools_table.rowCount():
             self.t_ui.tools_table.clearSelection()
             self.t_ui.tools_table.clearSelection()
+            self.t_ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("No Tool Selected"))
+            )
         else:
         else:
             self.t_ui.tools_table.selectAll()
             self.t_ui.tools_table.selectAll()
-        self.update_ui()
+            self.t_ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
+            )
 
 
     def on_row_selection_change(self):
     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):
     def update_ui(self):
         self.blockSignals(True)
         self.blockSignals(True)

+ 18 - 2
appTools/ToolMilling.py

@@ -740,12 +740,28 @@ class ToolMilling(AppTool, Excellon):
 
 
         if len(sel_rows) == self.ui.tools_table.rowCount():
         if len(sel_rows) == self.ui.tools_table.rowCount():
             self.ui.tools_table.clearSelection()
             self.ui.tools_table.clearSelection()
+            self.ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("No Tool Selected"))
+            )
         else:
         else:
             self.ui.tools_table.selectAll()
             self.ui.tools_table.selectAll()
-        self.update_ui()
+            self.ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
+            )
 
 
     def on_row_selection_change(self):
     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):
     def update_ui(self):
         self.blockSignals(True)
         self.blockSignals(True)

+ 18 - 2
appTools/ToolNCC.py

@@ -263,12 +263,28 @@ class NonCopperClear(AppTool, Gerber):
 
 
         if len(sel_rows) == self.ui.tools_table.rowCount():
         if len(sel_rows) == self.ui.tools_table.rowCount():
             self.ui.tools_table.clearSelection()
             self.ui.tools_table.clearSelection()
+            self.ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("No Tool Selected"))
+            )
         else:
         else:
             self.ui.tools_table.selectAll()
             self.ui.tools_table.selectAll()
-        self.update_ui()
+            self.ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
+            )
 
 
     def on_row_selection_change(self):
     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):
     def update_ui(self):
         self.blockSignals(True)
         self.blockSignals(True)

+ 18 - 2
appTools/ToolPaint.py

@@ -245,12 +245,28 @@ class ToolPaint(AppTool, Gerber):
 
 
         if len(sel_rows) == self.ui.tools_table.rowCount():
         if len(sel_rows) == self.ui.tools_table.rowCount():
             self.ui.tools_table.clearSelection()
             self.ui.tools_table.clearSelection()
+            self.ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("No Tool Selected"))
+            )
         else:
         else:
             self.ui.tools_table.selectAll()
             self.ui.tools_table.selectAll()
-        self.update_ui()
+            self.ui.tool_data_label.setText(
+                "<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
+            )
 
 
     def on_row_selection_change(self):
     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):
     def update_ui(self):
         self.blockSignals(True)
         self.blockSignals(True)

+ 12 - 1
appTools/ToolSolderPaste.py

@@ -305,7 +305,18 @@ class SolderPaste(AppTool):
         self.ui_connect()
         self.ui_connect()
 
 
     def on_row_selection_change(self):
     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):
     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
         # on any change to the widgets that matter it will be called self.gui_form_to_storage which will save the