Merged in milling_tools_order (pull request #35)
Milling tools order Approved-by: Marius Stanciu
This commit is contained in:
@@ -4599,7 +4599,7 @@ class FCTable(QtWidgets.QTableWidget):
|
|||||||
elif rect.bottom() - pos.y() < margin:
|
elif rect.bottom() - pos.y() < margin:
|
||||||
return True
|
return True
|
||||||
# noinspection PyTypeChecker
|
# noinspection PyTypeChecker
|
||||||
drop_enabled = int(self.model().flags(index)) & Qt.ItemFlag.ItemIsDropEnabled
|
drop_enabled = self.model().flags(index) & Qt.ItemFlag.ItemIsDropEnabled
|
||||||
return rect.contains(pos, True) and not drop_enabled and pos.y() >= rect.center().y()
|
return rect.contains(pos, True) and not drop_enabled and pos.y() >= rect.center().y()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -845,7 +845,8 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
def on_exc_rebuild_ui(self):
|
def on_exc_rebuild_ui(self):
|
||||||
# read the table tools uid
|
# read the table tools uid
|
||||||
current_uid_list = []
|
current_uid_list = []
|
||||||
for row in range(self.ui.tools_table_mill_exc.rowCount()):
|
# we have (n+2) rows because there are 'n' tools, each a row, plus the last 2 rows for totals.
|
||||||
|
for row in range(self.ui.tools_table_mill_exc.rowCount() - 2):
|
||||||
uid = int(self.ui.tools_table_mill_exc.item(row, 3).text())
|
uid = int(self.ui.tools_table_mill_exc.item(row, 3).text())
|
||||||
current_uid_list.append(uid)
|
current_uid_list.append(uid)
|
||||||
|
|
||||||
@@ -1014,12 +1015,14 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
|
|
||||||
# -------------------- ID ------------------------------------------ #
|
# -------------------- ID ------------------------------------------ #
|
||||||
tool_id = QtWidgets.QTableWidgetItem('%d' % int(row_idx + 1))
|
tool_id = QtWidgets.QTableWidgetItem('%d' % int(row_idx + 1))
|
||||||
tool_id.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
|
tool_id.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled |
|
||||||
|
QtCore.Qt.ItemFlag.ItemIsDragEnabled)
|
||||||
self.ui.tools_table_mill_geo.setItem(row_idx, 0, tool_id) # Tool name/id
|
self.ui.tools_table_mill_geo.setItem(row_idx, 0, tool_id) # Tool name/id
|
||||||
|
|
||||||
# -------------------- DIAMETER ------------------------------------- #
|
# -------------------- DIAMETER ------------------------------------- #
|
||||||
dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(tooluid_value['tooldia'])))
|
dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(tooluid_value['tooldia'])))
|
||||||
dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled |
|
||||||
|
QtCore.Qt.ItemFlag.ItemIsDragEnabled)
|
||||||
self.ui.tools_table_mill_geo.setItem(row_idx, 1, dia_item) # Diameter
|
self.ui.tools_table_mill_geo.setItem(row_idx, 1, dia_item) # Diameter
|
||||||
|
|
||||||
# -------------------- TOOL TYPE ------------------------------------- #
|
# -------------------- TOOL TYPE ------------------------------------- #
|
||||||
@@ -1055,7 +1058,8 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
for row in range(row_idx):
|
for row in range(row_idx):
|
||||||
self.ui.tools_table_mill_geo.item(row, 1).setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable |
|
self.ui.tools_table_mill_geo.item(row, 1).setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable |
|
||||||
QtCore.Qt.ItemFlag.ItemIsEditable |
|
QtCore.Qt.ItemFlag.ItemIsEditable |
|
||||||
QtCore.Qt.ItemFlag.ItemIsEnabled)
|
QtCore.Qt.ItemFlag.ItemIsEnabled |
|
||||||
|
QtCore.Qt.ItemFlag.ItemIsDragEnabled)
|
||||||
|
|
||||||
# sort the tool diameter column
|
# sort the tool diameter column
|
||||||
# self.ui.tools_table_mill_geo.sortItems(1)
|
# self.ui.tools_table_mill_geo.sortItems(1)
|
||||||
@@ -1173,17 +1177,19 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
|
|
||||||
# Tool name/id
|
# Tool name/id
|
||||||
exc_id_item = QtWidgets.QTableWidgetItem('%d' % int(tool_no))
|
exc_id_item = QtWidgets.QTableWidgetItem('%d' % int(tool_no))
|
||||||
exc_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
|
exc_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled |
|
||||||
|
QtCore.Qt.ItemFlag.ItemIsDragEnabled)
|
||||||
self.ui.tools_table_mill_exc.setItem(self.tool_row, 0, exc_id_item)
|
self.ui.tools_table_mill_exc.setItem(self.tool_row, 0, exc_id_item)
|
||||||
|
|
||||||
# Tool Diameter
|
# Tool Diameter
|
||||||
dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, self.target_obj.tools[tool_no]['tooldia']))
|
dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, self.target_obj.tools[tool_no]['tooldia']))
|
||||||
dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
dia_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled |
|
||||||
|
QtCore.Qt.ItemFlag.ItemIsDragEnabled)
|
||||||
self.ui.tools_table_mill_exc.setItem(self.tool_row, 1, dia_item)
|
self.ui.tools_table_mill_exc.setItem(self.tool_row, 1, dia_item)
|
||||||
|
|
||||||
# Number of drills per tool
|
# Number of drills per tool
|
||||||
drill_count_item = QtWidgets.QTableWidgetItem('%d' % drill_cnt)
|
drill_count_item = QtWidgets.QTableWidgetItem('%d' % drill_cnt)
|
||||||
drill_count_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
drill_count_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsDragEnabled)
|
||||||
self.ui.tools_table_mill_exc.setItem(self.tool_row, 2, drill_count_item)
|
self.ui.tools_table_mill_exc.setItem(self.tool_row, 2, drill_count_item)
|
||||||
|
|
||||||
# Tool unique ID
|
# Tool unique ID
|
||||||
@@ -1195,7 +1201,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
# if the slot number is zero is better to not clutter the GUI with zero's so, we print a space
|
# if the slot number is zero is better to not clutter the GUI with zero's so, we print a space
|
||||||
slot_count_str = '%d' % slot_cnt if slot_cnt > 0 else ''
|
slot_count_str = '%d' % slot_cnt if slot_cnt > 0 else ''
|
||||||
slot_count_item = QtWidgets.QTableWidgetItem(slot_count_str)
|
slot_count_item = QtWidgets.QTableWidgetItem(slot_count_str)
|
||||||
slot_count_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
slot_count_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsDragEnabled)
|
||||||
self.ui.tools_table_mill_exc.setItem(self.tool_row, 4, slot_count_item)
|
self.ui.tools_table_mill_exc.setItem(self.tool_row, 4, slot_count_item)
|
||||||
|
|
||||||
self.tool_row += 1
|
self.tool_row += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user