diff --git a/appObjects/AppObject.py b/appObjects/AppObject.py index 5377b0e1..cd03cce9 100644 --- a/appObjects/AppObject.py +++ b/appObjects/AppObject.py @@ -256,9 +256,8 @@ class AppObject(QtCore.QObject): if opt_key.find('geometry' + "_") == 0: oname = opt_key[len('geometry') + 1:] default_data[oname] = self.app.options[opt_key] - if opt_key.find('tools_mill' + "_") == 0: - oname = opt_key[len('tools_mill') + 1:] - default_data[oname] = self.app.options[opt_key] + if opt_key.find('tools_') == 0: + default_data[opt_key] = self.app.options[opt_key] new_obj.tools = { 1: { diff --git a/appTools/ToolMilling.py b/appTools/ToolMilling.py index f08bfd20..061f073d 100644 --- a/appTools/ToolMilling.py +++ b/appTools/ToolMilling.py @@ -289,7 +289,7 @@ class ToolMilling(AppTool, Excellon): # Geometry properties "cnctooldia": self.ui.addtool_entry, - "tool_type": self.ui.geo_tools_table.cellWidget(self.current_row, 2), + "tools_mill_tool_type": self.ui.geo_tools_table.cellWidget(self.current_row, 2), "offset_type": self.ui.offset_type_combo, "offset": self.ui.offset_entry, @@ -392,7 +392,7 @@ class ToolMilling(AppTool, Excellon): "polish_overlap": 10, "polish_method": _("Standard"), - "tool_type": 'C1', + "tools_mill_tool_type": 'C1', "vtipdia": 0.1, "vtipangle": 30, @@ -662,7 +662,7 @@ class ToolMilling(AppTool, Excellon): tool_type_item = FCComboBox(policy=False) for item in ["C1", "C2", "C3", "C4", "B", "V"]: tool_type_item.addItem(item) - idx = tool_type_item.findText(tooluid_value['tool_type']) + idx = tool_type_item.findText(tooluid_value['data']['tools_mill_tool_type']) # protection against having this translated or loading a project with translated values if idx == -1: tool_type_item.setCurrentIndex(0) @@ -1374,9 +1374,10 @@ class ToolMilling(AppTool, Excellon): "area_shape", "area_strategy", "area_overz"]: try: # widgets in the tools table - if storage_key == 'tool_type': + if storage_key == 'tools_mill_tool_type': + print(dict_storage['tools_mill_tool_type']) form_val = self.ui.geo_tools_table.cellWidget(self.current_row, 2) - form_val.set_value(dict_storage[storage_key]) + form_val.set_value(dict_storage['tools_mill_tool_type']) else: self.form_fields[storage_key].set_value(dict_storage[storage_key]) except Exception as e: @@ -1434,7 +1435,7 @@ class ToolMilling(AppTool, Excellon): try: # widgets in the tools table - if form_key == 'tool_type': + if form_key == 'tools_mill_tool_type': tt_wdg = self.ui.geo_tools_table.cellWidget(self.current_row, 2) self.target_obj.tools[tooluid_key]['data'][form_key] = tt_wdg.get_value() else: @@ -1463,6 +1464,8 @@ class ToolMilling(AppTool, Excellon): tool_type = self.ui.geo_tools_table.cellWidget(cw_row, 2).currentText() self.ui_update_v_shape(tool_type) + self.form_to_storage() + def ui_update_v_shape(self, tool_type_txt): if tool_type_txt == 'V': self.ui.tipdialabel.show() @@ -2048,6 +2051,7 @@ class ToolMilling(AppTool, Excellon): self.target_obj.ser_attrs.append('tools') self.ui_connect() + self.build_ui() self.target_obj.build_ui() self.app.inform.emit('[success] %s' % _("Tool was deleted in Tool Table.")) diff --git a/defaults.py b/defaults.py index 7ced0c36..c5daf9ca 100644 --- a/defaults.py +++ b/defaults.py @@ -462,6 +462,9 @@ class FlatCAMDefaults: "tools_drill_area_strategy": "over", "tools_drill_area_overz": 1.0, + # Milling Tool + "tools_mill_tool_type": 'C1', + # NCC Tool "tools_ncc_tools": "1.0, 0.5", "tools_ncc_order": 'rev',