- in the new Tools DB added ability to double click on the ID in the tree widget to execute adding a tool from DB

This commit is contained in:
Marius Stanciu 2020-03-29 21:10:30 +03:00
parent 4aeadde3da
commit a872a958ca
5 changed files with 28 additions and 14 deletions

View File

@ -2229,6 +2229,9 @@ class ToolsDB2(QtWidgets.QWidget):
self.current_toolid = None
# variable to show if double clicking and item will trigger adding a tool from DB
self.ok_to_add = False
# ##############################################################################
# ######################## SIGNALS #############################################
# ##############################################################################
@ -2247,6 +2250,8 @@ class ToolsDB2(QtWidgets.QWidget):
self.tree_widget.itemChanged.connect(self.on_list_item_edited)
self.tree_widget.customContextMenuRequested.connect(self.on_menu_request)
self.tree_widget.itemDoubleClicked.connect(self.on_item_double_clicked)
self.setup_db_ui()
def on_menu_request(self, pos):
@ -2264,6 +2269,11 @@ class ToolsDB2(QtWidgets.QWidget):
# tree_item = self.tree_widget.itemAt(pos)
menu.exec(self.tree_widget.viewport().mapToGlobal(pos))
def on_item_double_clicked(self, item, column):
if column == 0 and self.ok_to_add is True:
self.ok_to_add = False
self.on_tool_requested_from_app()
def on_list_selection_change(self, current, previous):
# for idx in current.indexes():
# print(idx.data())

View File

@ -4774,6 +4774,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
break
self.app.on_tools_database()
self.app.tools_db_tab.ok_to_add = True
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()

View File

@ -15,6 +15,7 @@ CAD program, and create G-Code for Isolation routing.
- fixed issues in the new database when adding the tool in a Geometry object
- fixed a bug in Geometry object that generated a change of dictionary while iterating over it
- started to add the new database links in the NCC and Paint Tools
- in the new Tools DB added ability to double click on the ID in the tree widget to execute adding a tool from DB
28.03.2020

View File

@ -3911,20 +3911,6 @@ class NonCopperClear(FlatCAMTool, Gerber):
return ret_val
def reset_fields(self):
self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
def reset_usage(self):
self.obj_name = ""
self.ncc_obj = None
self.bound_obj = None
self.first_click = False
self.cursor_pos = None
self.mouse_is_dragging = False
self.sel_rect = []
@staticmethod
def poly2rings(poly):
return [poly.exterior] + [interior for interior in poly.interiors]
@ -4057,6 +4043,21 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
break
self.app.on_tools_database(source='ncc')
self.app.tools_db_tab.ok_to_add = True
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 reset_fields(self):
self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
def reset_usage(self):
self.obj_name = ""
self.ncc_obj = None
self.bound_obj = None
self.first_click = False
self.cursor_pos = None
self.mouse_is_dragging = False
self.sel_rect = []

View File

@ -4423,6 +4423,7 @@ class ToolPaint(FlatCAMTool, Gerber):
self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
break
self.app.on_tools_database(source='paint')
self.app.tools_db_tab.ok_to_add = True
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()