- added a Cancel button in Tools DB when requesting to add a tool in the Geometry Tool Table

This commit is contained in:
Marius Stanciu 2019-12-02 22:47:23 +02:00 committed by Marius
parent c439009251
commit e0b591ff85
3 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -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):
"""

View File

@ -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