From e0b591ff85ad69b1038fcef18468a21a547c52a7 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 2 Dec 2019 22:47:23 +0200 Subject: [PATCH] - added a Cancel button in Tools DB when requesting to add a tool in the Geometry Tool Table --- FlatCAMCommon.py | 15 ++++++++++++++- FlatCAMObj.py | 1 + README.md | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/FlatCAMCommon.py b/FlatCAMCommon.py index ecbf78b7..04406c72 100644 --- a/FlatCAMCommon.py +++ b/FlatCAMCommon.py @@ -684,16 +684,20 @@ class ToolsDB(QtWidgets.QWidget): # self.buttons_box.addWidget(closebtn) self.add_tool_from_db = FCButton(_("Add Tool from Tools DB")) - add_entry_btn.setToolTip( + self.add_tool_from_db.setToolTip( _("Add a new tool in the Tools Table of the\n" "active Geometry object after selecting a tool\n" "in the Tools Database.") ) self.add_tool_from_db.hide() + self.cancel_tool_from_db = FCButton(_("Cancel")) + self.cancel_tool_from_db.hide() + hlay = QtWidgets.QHBoxLayout() layout.addLayout(hlay) hlay.addWidget(self.add_tool_from_db) + hlay.addWidget(self.cancel_tool_from_db) hlay.addStretch() # ############################################################################## @@ -707,6 +711,7 @@ class ToolsDB(QtWidgets.QWidget): # closebtn.clicked.connect(self.accept) self.add_tool_from_db.clicked.connect(self.on_tool_requested_from_app) + self.cancel_tool_from_db.clicked.connect(self.on_cancel_tool) self.setup_db_ui() @@ -1297,6 +1302,14 @@ class ToolsDB(QtWidgets.QWidget): selected_tool = self.db_tool_dict[key] self.on_tool_request(tool=selected_tool) + def on_cancel_tool(self): + for idx in range(self.app.ui.plot_tab_area.count()): + if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"): + wdg = self.app.ui.plot_tab_area.widget(idx) + wdg.deleteLater() + self.app.ui.plot_tab_area.removeTab(idx) + self.app.inform.emit('%s' % _("Cancelled adding tool from DB.")) + def resize_new_tool_table_widget(self, min_size, max_size): """ Resize the table widget responsible for adding new tool in the Tool Database diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 49fedddc..7adab51e 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -4116,6 +4116,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): self.app.on_tools_database() self.app.tools_db_tab.buttons_frame.hide() self.app.tools_db_tab.add_tool_from_db.show() + self.app.tools_db_tab.cancel_tool_from_db.show() def on_tool_from_db_inserted(self, tool): """ diff --git a/README.md b/README.md index 9faa0475..ad9801c1 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ CAD program, and create G-Code for Isolation routing. - improvements in Importing SVG as Gerber - added an automatic source generation (it is not infallible) - a hack to import correctly the QRCode exported as SVG from FlatCAM - added 3 new tcl commands: export dxf, export excellon and export gerber +- added a Cancel button in Tools DB when requesting to add a tool in the Geometry Tool Table 28.11.2019