- when building the UI for the CNCJob first clear the CNCJob Tools Table
This commit is contained in:
@@ -12,6 +12,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
- in AppTextEditor made some changes (added some placeholders and a message popup when reaching the end of document)
|
- in AppTextEditor made some changes (added some placeholders and a message popup when reaching the end of document)
|
||||||
- when viewing GCode the Find field can now keep the focus
|
- when viewing GCode the Find field can now keep the focus
|
||||||
- fixed the Travelling Salesman algorithm such that it does not add duplicated points that are next to each other
|
- fixed the Travelling Salesman algorithm such that it does not add duplicated points that are next to each other
|
||||||
|
- when building the UI for the CNCJob first clear the CNCJob Tools Table
|
||||||
|
|
||||||
21.11.2021
|
21.11.2021
|
||||||
|
|
||||||
|
|||||||
@@ -192,18 +192,21 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
self.ui.exc_cnc_tools_table.hide()
|
self.ui.exc_cnc_tools_table.hide()
|
||||||
|
|
||||||
if self.options['type'].lower() == 'geometry':
|
if self.options['type'].lower() == 'geometry':
|
||||||
self.ui.cnc_tools_table.show()
|
|
||||||
self.build_cnc_tools_table()
|
self.build_cnc_tools_table()
|
||||||
|
self.ui.cnc_tools_table.show()
|
||||||
|
|
||||||
if self.options['type'].lower() == 'excellon':
|
if self.options['type'].lower() == 'excellon':
|
||||||
self.ui.exc_cnc_tools_table.show()
|
|
||||||
self.build_excellon_cnc_tools()
|
self.build_excellon_cnc_tools()
|
||||||
|
self.ui.exc_cnc_tools_table.show()
|
||||||
|
|
||||||
self.ui_connect()
|
self.ui_connect()
|
||||||
|
|
||||||
def build_cnc_tools_table(self):
|
def build_cnc_tools_table(self):
|
||||||
tool_idx = 0
|
tool_idx = 0
|
||||||
|
|
||||||
|
# reset the Tools Table
|
||||||
|
self.ui.cnc_tools_table.setRowCount(0)
|
||||||
|
|
||||||
# for the case when self.tools is empty: it can happen for old projects who stored the data elsewhere
|
# for the case when self.tools is empty: it can happen for old projects who stored the data elsewhere
|
||||||
if not self.tools:
|
if not self.tools:
|
||||||
self.ui.cnc_tools_table.setRowCount(1)
|
self.ui.cnc_tools_table.setRowCount(1)
|
||||||
@@ -321,6 +324,9 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
if not self.tools:
|
if not self.tools:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# reset the Tools Table
|
||||||
|
self.ui.exc_cnc_tools_table.setRowCount(0)
|
||||||
|
|
||||||
n = len(self.tools)
|
n = len(self.tools)
|
||||||
self.ui.exc_cnc_tools_table.setRowCount(n)
|
self.ui.exc_cnc_tools_table.setRowCount(n)
|
||||||
|
|
||||||
@@ -329,16 +335,15 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
tooldia = self.tools[t_id]['tooldia']
|
tooldia = self.tools[t_id]['tooldia']
|
||||||
|
|
||||||
row_no = t_id - 1
|
row_no = t_id - 1
|
||||||
|
|
||||||
t_id_item = QtWidgets.QTableWidgetItem('%d' % int(t_id))
|
|
||||||
dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(tooldia)))
|
|
||||||
nr_drills_item = QtWidgets.QTableWidgetItem('%d' % int(dia_value['nr_drills']))
|
|
||||||
nr_slots_item = QtWidgets.QTableWidgetItem('%d' % int(dia_value['nr_slots']))
|
|
||||||
try:
|
try:
|
||||||
offset_val = self.app.dec_format(float(dia_value['offset']), self.decimals) + self.z_cut
|
offset_val = self.app.dec_format(float(dia_value['offset']), self.decimals) + self.z_cut
|
||||||
except KeyError:
|
except KeyError:
|
||||||
offset_val = self.app.dec_format(float(dia_value['offset_z']), self.decimals) + self.z_cut
|
offset_val = self.app.dec_format(float(dia_value['offset_z']), self.decimals) + self.z_cut
|
||||||
|
|
||||||
|
t_id_item = QtWidgets.QTableWidgetItem('%d' % int(t_id))
|
||||||
|
dia_item = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, float(tooldia)))
|
||||||
|
nr_drills_item = QtWidgets.QTableWidgetItem('%d' % int(dia_value['nr_drills']))
|
||||||
|
nr_slots_item = QtWidgets.QTableWidgetItem('%d' % int(dia_value['nr_slots']))
|
||||||
cutz_item = QtWidgets.QTableWidgetItem('%f' % offset_val)
|
cutz_item = QtWidgets.QTableWidgetItem('%f' % offset_val)
|
||||||
|
|
||||||
t_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
t_id_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
||||||
@@ -347,17 +352,6 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
nr_slots_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
nr_slots_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
||||||
cutz_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
cutz_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
||||||
|
|
||||||
# hack so the checkbox stay centered in the table cell
|
|
||||||
# used this:
|
|
||||||
# https://stackoverflow.com/questions/32458111/pyqt-allign-checkbox-and-put-it-in-every-row
|
|
||||||
# plot_item = QtWidgets.QWidget()
|
|
||||||
# checkbox = FCCheckBox()
|
|
||||||
# checkbox.setCheckState(QtCore.Qt.Checked)
|
|
||||||
# qhboxlayout = QtWidgets.QHBoxLayout(plot_item)
|
|
||||||
# qhboxlayout.addWidget(checkbox)
|
|
||||||
# qhboxlayout.setAlignment(QtCore.Qt.AlignCenter)
|
|
||||||
# qhboxlayout.setContentsMargins(0, 0, 0, 0)
|
|
||||||
|
|
||||||
plot_item = FCCheckBox()
|
plot_item = FCCheckBox()
|
||||||
plot_item.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft)
|
plot_item.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user