- fixed issue with first click on the header of the Tool Table in the Geometry Object Properties and also made sure that clicking the Plot Items in the last column will not select rows

This commit is contained in:
Marius Stanciu
2020-11-07 21:07:50 +02:00
committed by Marius
parent d842b490a8
commit f2c9a7a49e
4 changed files with 25 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ CHANGELOG for FlatCAM beta
- in GCode Editor added handlers for the Insert Code buttons - in GCode Editor added handlers for the Insert Code buttons
- in Project tab, when selecting multiple CNCJob objects, in the context menu the name of the Save entry change to Batch Save and those objects are all saved each in its own file - in Project tab, when selecting multiple CNCJob objects, in the context menu the name of the Save entry change to Batch Save and those objects are all saved each in its own file
- added support for shortcut key F2 when in the Project Tab and that will allow the object renaming much faster - added support for shortcut key F2 when in the Project Tab and that will allow the object renaming much faster
- fixed issue with first click on the header of the Tool Table in the Geometry Object Properties and also made sure that clicking the Plot Items in the last column will not select rows
7.11.2020 7.11.2020

View File

@@ -244,6 +244,9 @@ class GeometryObject(FlatCAMObj, Geometry):
self.ui.geo_tools_table.setItem(row_idx, 5, tool_uid_item) # Tool unique ID self.ui.geo_tools_table.setItem(row_idx, 5, tool_uid_item) # Tool unique ID
# -------------------- PLOT ------------------------------------- # # -------------------- PLOT ------------------------------------- #
empty_plot_item = QtWidgets.QTableWidgetItem('')
empty_plot_item.setFlags(~QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.geo_tools_table.setItem(row_idx, 6, empty_plot_item)
plot_item = FCCheckBox() plot_item = FCCheckBox()
plot_item.setLayoutDirection(QtCore.Qt.RightToLeft) plot_item.setLayoutDirection(QtCore.Qt.RightToLeft)
if self.ui.plot_cb.isChecked(): if self.ui.plot_cb.isChecked():
@@ -602,12 +605,16 @@ class GeometryObject(FlatCAMObj, Geometry):
else: else:
self.ui.level.setText('<span style="color:red;"><b>%s</b></span>' % _('Advanced')) self.ui.level.setText('<span style="color:red;"><b>%s</b></span>' % _('Advanced'))
# #############################################################################################################
# ################################ Signals Connection #########################################################
# #############################################################################################################
self.builduiSig.connect(self.build_ui) self.builduiSig.connect(self.build_ui)
self.ui.e_cut_entry.setDisabled(False) if self.app.defaults['geometry_extracut'] else \ self.ui.e_cut_entry.setDisabled(False) if self.app.defaults['geometry_extracut'] else \
self.ui.e_cut_entry.setDisabled(True) self.ui.e_cut_entry.setDisabled(True)
self.ui.extracut_cb.toggled.connect(lambda state: self.ui.e_cut_entry.setDisabled(not state)) self.ui.extracut_cb.toggled.connect(lambda state: self.ui.e_cut_entry.setDisabled(not state))
# Plot state signals
self.ui.plot_cb.stateChanged.connect(self.on_plot_cb_click) self.ui.plot_cb.stateChanged.connect(self.on_plot_cb_click)
self.ui.multicolored_cb.stateChanged.connect(self.on_multicolored_cb_click) self.ui.multicolored_cb.stateChanged.connect(self.on_multicolored_cb_click)
@@ -618,11 +625,15 @@ class GeometryObject(FlatCAMObj, Geometry):
self.ui.properties_button.toggled.connect(self.on_properties) self.ui.properties_button.toggled.connect(self.on_properties)
self.calculations_finished.connect(self.update_area_chull) self.calculations_finished.connect(self.update_area_chull)
# Buttons Signals
self.ui.generate_cnc_button.clicked.connect(self.on_generatecnc_button_click) self.ui.generate_cnc_button.clicked.connect(self.on_generatecnc_button_click)
self.ui.paint_tool_button.clicked.connect(lambda: self.app.paint_tool.run(toggle=False)) self.ui.paint_tool_button.clicked.connect(lambda: self.app.paint_tool.run(toggle=False))
self.ui.generate_ncc_button.clicked.connect(lambda: self.app.ncclear_tool.run(toggle=False)) self.ui.generate_ncc_button.clicked.connect(lambda: self.app.ncclear_tool.run(toggle=False))
# Postprocessor change
self.ui.pp_geometry_name_cb.activated.connect(self.on_pp_changed) self.ui.pp_geometry_name_cb.activated.connect(self.on_pp_changed)
# V tool shape params changed
self.ui.tipdia_entry.valueChanged.connect(self.update_cutz) self.ui.tipdia_entry.valueChanged.connect(self.update_cutz)
self.ui.tipangle_entry.valueChanged.connect(self.update_cutz) self.ui.tipangle_entry.valueChanged.connect(self.update_cutz)
@@ -639,7 +650,9 @@ class GeometryObject(FlatCAMObj, Geometry):
self.ui.delete_sel_area_button.clicked.connect(self.on_delete_sel_areas) self.ui.delete_sel_area_button.clicked.connect(self.on_delete_sel_areas)
self.ui.strategy_radio.activated_custom.connect(self.on_strategy) self.ui.strategy_radio.activated_custom.connect(self.on_strategy)
# Tools Table signals
self.ui.geo_tools_table.drag_drop_sig.connect(self.rebuild_ui) self.ui.geo_tools_table.drag_drop_sig.connect(self.rebuild_ui)
self.ui.geo_tools_table.horizontalHeader().sectionClicked.connect(self.on_toggle_all_rows)
self.launch_job.connect(self.mtool_gen_cncjob) self.launch_job.connect(self.mtool_gen_cncjob)
@@ -748,13 +761,12 @@ class GeometryObject(FlatCAMObj, Geometry):
self.on_tooltable_cellwidget_change) self.on_tooltable_cellwidget_change)
self.ui.search_and_add_btn.clicked.connect(self.on_tool_add) self.ui.search_and_add_btn.clicked.connect(self.on_tool_add)
self.ui.deltool_btn.clicked.connect(self.on_tool_delete) self.ui.deltool_btn.clicked.connect(self.on_tool_delete)
# Tools Table
self.ui.geo_tools_table.clicked.connect(self.on_row_selection_change) self.ui.geo_tools_table.clicked.connect(self.on_row_selection_change)
self.ui.geo_tools_table.horizontalHeader().sectionClicked.connect(self.on_toggle_all_rows)
self.ui.geo_tools_table.itemChanged.connect(self.on_tool_edit) self.ui.geo_tools_table.itemChanged.connect(self.on_tool_edit)
self.ui.tool_offset_entry.returnPressed.connect(self.on_offset_value_edited) self.ui.tool_offset_entry.returnPressed.connect(self.on_offset_value_edited)
for row in range(self.ui.geo_tools_table.rowCount()): for row in range(self.ui.geo_tools_table.rowCount()):
@@ -822,10 +834,6 @@ class GeometryObject(FlatCAMObj, Geometry):
self.ui.geo_tools_table.clicked.disconnect() self.ui.geo_tools_table.clicked.disconnect()
except (TypeError, AttributeError): except (TypeError, AttributeError):
pass pass
try:
self.ui.geo_tools_table.horizontalHeader().sectionClicked.disconnect()
except (TypeError, AttributeError):
pass
try: try:
self.ui.geo_tools_table.itemChanged.disconnect() self.ui.geo_tools_table.itemChanged.disconnect()

View File

@@ -220,13 +220,16 @@ class GerberObject(FlatCAMObj, Gerber):
for ap_code in sorted_apertures: for ap_code in sorted_apertures:
ap_code = str(ap_code) ap_code = str(ap_code)
# ------------------------ Aperture ID ----------------------------------------------------------------
ap_id_item = QtWidgets.QTableWidgetItem('%d' % int(self.apertures_row + 1)) ap_id_item = QtWidgets.QTableWidgetItem('%d' % int(self.apertures_row + 1))
ap_id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) ap_id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.apertures_table.setItem(self.apertures_row, 0, ap_id_item) # Tool name/id self.ui.apertures_table.setItem(self.apertures_row, 0, ap_id_item) # Tool name/id
# ------------------------ Aperture CODE --------------------------------------------------------------
ap_code_item = QtWidgets.QTableWidgetItem(ap_code) ap_code_item = QtWidgets.QTableWidgetItem(ap_code)
ap_code_item.setFlags(QtCore.Qt.ItemIsEnabled) ap_code_item.setFlags(QtCore.Qt.ItemIsEnabled)
# ------------------------ Aperture TYPE --------------------------------------------------------------
ap_type_item = QtWidgets.QTableWidgetItem(str(self.apertures[ap_code]['type'])) ap_type_item = QtWidgets.QTableWidgetItem(str(self.apertures[ap_code]['type']))
ap_type_item.setFlags(QtCore.Qt.ItemIsEnabled) ap_type_item.setFlags(QtCore.Qt.ItemIsEnabled)
@@ -247,6 +250,7 @@ class GerberObject(FlatCAMObj, Gerber):
ap_dim_item = QtWidgets.QTableWidgetItem('') ap_dim_item = QtWidgets.QTableWidgetItem('')
ap_dim_item.setFlags(QtCore.Qt.ItemIsEnabled) ap_dim_item.setFlags(QtCore.Qt.ItemIsEnabled)
# ------------------------ Aperture SIZE --------------------------------------------------------------
try: try:
if self.apertures[ap_code]['size'] is not None: if self.apertures[ap_code]['size'] is not None:
ap_size_item = QtWidgets.QTableWidgetItem( ap_size_item = QtWidgets.QTableWidgetItem(
@@ -257,6 +261,7 @@ class GerberObject(FlatCAMObj, Gerber):
ap_size_item = QtWidgets.QTableWidgetItem('') ap_size_item = QtWidgets.QTableWidgetItem('')
ap_size_item.setFlags(QtCore.Qt.ItemIsEnabled) ap_size_item.setFlags(QtCore.Qt.ItemIsEnabled)
# ------------------------ Aperture MARK --------------------------------------------------------------
mark_item = FCCheckBox() mark_item = FCCheckBox()
mark_item.setLayoutDirection(QtCore.Qt.RightToLeft) mark_item.setLayoutDirection(QtCore.Qt.RightToLeft)
# if self.ui.aperture_table_visibility_cb.isChecked(): # if self.ui.aperture_table_visibility_cb.isChecked():

View File

@@ -675,23 +675,27 @@ class NonCopperClear(AppTool, Gerber):
if float('%.*f' % (self.decimals, tooluid_value['tooldia'])) == tool_sorted: if float('%.*f' % (self.decimals, tooluid_value['tooldia'])) == tool_sorted:
tool_id += 1 tool_id += 1
# ------------------------ Tool ID ----------------------------------------------------------------
id_ = QtWidgets.QTableWidgetItem('%d' % int(tool_id)) id_ = QtWidgets.QTableWidgetItem('%d' % int(tool_id))
flags = QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled flags = QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
id_.setFlags(flags) id_.setFlags(flags)
row_no = tool_id - 1 row_no = tool_id - 1
self.ui.tools_table.setItem(row_no, 0, id_) # Tool name/id self.ui.tools_table.setItem(row_no, 0, id_) # Tool name/id
# ------------------------ Tool Diameter ----------------------------------------------------------
# Make sure that the drill diameter when in MM is with no more than self.decimals decimals # Make sure that the drill diameter when in MM is with no more than self.decimals decimals
dia = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, tooluid_value['tooldia'])) dia = QtWidgets.QTableWidgetItem('%.*f' % (self.decimals, tooluid_value['tooldia']))
dia.setFlags(QtCore.Qt.ItemIsEnabled) dia.setFlags(QtCore.Qt.ItemIsEnabled)
self.ui.tools_table.setItem(row_no, 1, dia) # Diameter self.ui.tools_table.setItem(row_no, 1, dia) # Diameter
# ------------------------ Tool Shape -------------------------------------------------------------
tool_type_item = FCComboBox() tool_type_item = FCComboBox()
tool_type_item.addItems(self.tool_type_item_options) tool_type_item.addItems(self.tool_type_item_options)
idx = tool_type_item.findText(tooluid_value['tool_type']) idx = tool_type_item.findText(tooluid_value['tool_type'])
tool_type_item.setCurrentIndex(idx) tool_type_item.setCurrentIndex(idx)
self.ui.tools_table.setCellWidget(row_no, 2, tool_type_item) self.ui.tools_table.setCellWidget(row_no, 2, tool_type_item)
# ------------------------ Tool UID - NOT Visible -------------------------------------------------
tool_uid_item = QtWidgets.QTableWidgetItem(str(int(tooluid_key))) tool_uid_item = QtWidgets.QTableWidgetItem(str(int(tooluid_key)))
# ## REMEMBER: THIS COLUMN IS HIDDEN IN OBJECTUI.PY # ## # ## REMEMBER: THIS COLUMN IS HIDDEN IN OBJECTUI.PY # ##
self.ui.tools_table.setItem(row_no, 3, tool_uid_item) # Tool unique ID self.ui.tools_table.setItem(row_no, 3, tool_uid_item) # Tool unique ID