From f23f4bc740326453ffe0f4900568c51ebda580ce Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Fri, 13 Nov 2020 17:48:39 +0200 Subject: [PATCH] - Milling Tool - fixed the situation when launching the Tool but there is no object loaded --- CHANGELOG.md | 1 + appTools/ToolMilling.py | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38450de8..860c26a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ CHANGELOG for FlatCAM beta - fixed an error in the Follow Tool - started to work in Milling Tool - designing the Tool UI - Milling Tool - finished the UI and also the button handlers in the Geometry and Excellon objects Properties UI +- Milling Tool - fixed the situation when launching the Tool but there is no object loaded 12.11.2020 diff --git a/appTools/ToolMilling.py b/appTools/ToolMilling.py index c1be0a0e..5ec2237f 100644 --- a/appTools/ToolMilling.py +++ b/appTools/ToolMilling.py @@ -493,12 +493,20 @@ class ToolMilling(AppTool, Excellon): self.units = self.app.defaults['units'] + if self.target_obj: + self.ui.param_frame.setDisabled(False) + + tools_dict = self.target_obj.tools + + else: + tools_dict = {} + row_idx = 0 - n = len(self.target_obj.tools) + n = len(tools_dict) self.ui.geo_tools_table.setRowCount(n) - for tooluid_key, tooluid_value in self.target_obj.tools.items(): + for tooluid_key, tooluid_value in tools_dict.items(): # -------------------- ID ------------------------------------------ # tool_id = QtWidgets.QTableWidgetItem('%d' % int(row_idx + 1)) @@ -602,10 +610,10 @@ class ToolMilling(AppTool, Excellon): # disable the Plot column in Tool Table if the geometry is SingleGeo as it is not needed # and can create some problems - if self.target_obj.multigeo is False: - self.ui.geo_tools_table.setColumnHidden(4, True) - else: + if self.target_obj and self.target_obj.multigeo is True: self.ui.geo_tools_table.setColumnHidden(4, False) + else: + self.ui.geo_tools_table.setColumnHidden(4, True) self.ui_connect()