فهرست منبع

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

Marius Stanciu 6 سال پیش
والد
کامیت
e0b591ff85
3فایلهای تغییر یافته به همراه16 افزوده شده و 1 حذف شده
  1. 14 1
      FlatCAMCommon.py
  2. 1 0
      FlatCAMObj.py
  3. 1 0
      README.md

+ 14 - 1
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

+ 1 - 0
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):
         """

+ 1 - 0
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