- Geometry UI - made again the header clickable and first click selects all rows, second click will deselect all rows.

- Geometry UI - minor updates in the layout; moved the warning text to the tooltip of the generate_cncjob button
- Geometry UI - working in making the modification of tool parameters such that if there is a selection of tools the modification in the Tool parameters will be applied to all selected
This commit is contained in:
Marius Stanciu
2020-06-13 00:17:17 +03:00
committed by Marius
parent 1ea168fd4b
commit e85b6f8d87
4 changed files with 87 additions and 59 deletions

View File

@@ -14,6 +14,9 @@ CHANGELOG for FlatCAM beta
- NCC Tool - allow no tool at NCC Tool start (the Preferences have no tool) - NCC Tool - allow no tool at NCC Tool start (the Preferences have no tool)
- NCC Tool - optimized tool reset code - NCC Tool - optimized tool reset code
- NCC Tool - fixed the non-rest copper clearing to work as expected: each tool in the tool table will make it's own copper clearing without interference from the rest of the tools - NCC Tool - fixed the non-rest copper clearing to work as expected: each tool in the tool table will make it's own copper clearing without interference from the rest of the tools
- Geometry UI - made again the header clickable and first click selects all rows, second click will deselect all rows.
- Geometry UI - minor updates in the layout; moved the warning text to the tooltip of the generate_cncjob button
- Geometry UI - working in making the modification of tool parameters such that if there is a selection of tools the modification in the Tool parameters will be applied to all selected
11.06.2020 11.06.2020

View File

@@ -1973,11 +1973,7 @@ class ToolsDB2(QtWidgets.QWidget):
self.on_tool_requested_from_app() self.on_tool_requested_from_app()
def on_list_selection_change(self, current, previous): def on_list_selection_change(self, current, previous):
# for idx in current.indexes():
# print(idx.data())
# print(current.text(0))
self.current_toolid = int(current.text(0)) self.current_toolid = int(current.text(0))
self.storage_to_form(self.db_tool_dict[current.text(0)]) self.storage_to_form(self.db_tool_dict[current.text(0)])
def on_list_item_edited(self, item, column): def on_list_item_edited(self, item, column):
@@ -2022,7 +2018,7 @@ class ToolsDB2(QtWidgets.QWidget):
self.blockSignals(False) self.blockSignals(False)
def setup_db_ui(self): def setup_db_ui(self):
filename = self.app.data_path + '\geo_tools_db.FlatDB' filename = self.app.data_path + '\\geo_tools_db.FlatDB'
# load the database tools from the file # load the database tools from the file
try: try:
@@ -2420,7 +2416,6 @@ class ToolsDB2(QtWidgets.QWidget):
self.vdia_entry.valueChanged.connect(self.on_calculate_tooldia) self.vdia_entry.valueChanged.connect(self.on_calculate_tooldia)
self.vangle_entry.valueChanged.connect(self.on_calculate_tooldia) self.vangle_entry.valueChanged.connect(self.on_calculate_tooldia)
def ui_disconnect(self): def ui_disconnect(self):
try: try:
self.name_entry.editingFinished.disconnect(self.update_tree_name) self.name_entry.editingFinished.disconnect(self.update_tree_name)

View File

@@ -1005,8 +1005,8 @@ class ExcellonObjectUI(ObjectUI):
"If no value is entered then there is no move\n" "If no value is entered then there is no move\n"
"on X,Y plane at the end of the job.") "on X,Y plane at the end of the job.")
) )
self.endxy_entry = FCEntry() self.endxy_entry = NumericalEvalTupleEntry(border_color='#0069A9')
self.endxy_entry.setPlaceholderText(_("X,Y coordinates"))
self.grid5.addWidget(endmove_xy_label, 12, 0) self.grid5.addWidget(endmove_xy_label, 12, 0)
self.grid5.addWidget(self.endxy_entry, 12, 1) self.grid5.addWidget(self.endxy_entry, 12, 1)
@@ -1907,7 +1907,8 @@ class GeometryObjectUI(ObjectUI):
"If no value is entered then there is no move\n" "If no value is entered then there is no move\n"
"on X,Y plane at the end of the job.") "on X,Y plane at the end of the job.")
) )
self.endxy_entry = FCEntry() self.endxy_entry = NumericalEvalTupleEntry(border_color='#0069A9')
self.endxy_entry.setPlaceholderText(_("X,Y coordinates"))
grid4.addWidget(endmove_xy_label, 10, 0) grid4.addWidget(endmove_xy_label, 10, 0)
grid4.addWidget(self.endxy_entry, 10, 1) grid4.addWidget(self.endxy_entry, 10, 1)
@@ -2033,19 +2034,15 @@ class GeometryObjectUI(ObjectUI):
separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken) separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken)
grid4.addWidget(separator_line2, 15, 0, 1, 2) grid4.addWidget(separator_line2, 15, 0, 1, 2)
warning_lbl = QtWidgets.QLabel( # Button
self.generate_cnc_button = QtWidgets.QPushButton(_('Generate CNCJob object'))
self.generate_cnc_button.setToolTip('%s\n%s' % (
_("Generate CNCJob object."),
_( _(
"Add / Select at least one tool in the tool-table.\n" "Add / Select at least one tool in the tool-table.\n"
"Click the # header to select all, or Ctrl + LMB\n" "Click the # header to select all, or Ctrl + LMB\n"
"for custom selection of tools." "for custom selection of tools.")))
))
grid4.addWidget(warning_lbl, 16, 0, 1, 2)
# Button
self.generate_cnc_button = QtWidgets.QPushButton(_('Generate CNCJob object'))
self.generate_cnc_button.setToolTip(
_("Generate the CNC Job object.")
)
self.generate_cnc_button.setStyleSheet(""" self.generate_cnc_button.setStyleSheet("""
QPushButton QPushButton
{ {

View File

@@ -156,8 +156,7 @@ class GeometryObject(FlatCAMObj, Geometry):
self.param_fields = {} self.param_fields = {}
# store here the state of the exclusion checkbox state to be restored after building the UI # store here the state of the exclusion checkbox state to be restored after building the UI
# TODO add this in the sel.app.defaults dict and in Preferences self.exclusion_area_cb_is_checked = self.app.defaults["geometry_area_exclusion"]
self.exclusion_area_cb_is_checked = False
# Attributes to be included in serialization # Attributes to be included in serialization
# Always append to it because it carries contents # Always append to it because it carries contents
@@ -729,7 +728,7 @@ class GeometryObject(FlatCAMObj, Geometry):
# self.ui.geo_tools_table.currentItemChanged.connect(self.on_row_selection_change) # self.ui.geo_tools_table.currentItemChanged.connect(self.on_row_selection_change)
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_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)
@@ -822,6 +821,26 @@ class GeometryObject(FlatCAMObj, Geometry):
except (TypeError, AttributeError): except (TypeError, AttributeError):
pass pass
def on_toggle_all_rows(self):
"""
will toggle the selection of all rows in Tools table
:return:
"""
sel_model = self.ui.geo_tools_table.selectionModel()
sel_indexes = sel_model.selectedIndexes()
# it will iterate over all indexes which means all items in all columns too but I'm interested only on rows
sel_rows = set()
for idx in sel_indexes:
sel_rows.add(idx.row())
if len(sel_rows) == self.ui.geo_tools_table.rowCount():
self.ui.geo_tools_table.clearSelection()
else:
self.ui.geo_tools_table.selectAll()
self.update_ui()
def on_row_selection_change(self): def on_row_selection_change(self):
self.update_ui() self.update_ui()
@@ -849,6 +868,31 @@ class GeometryObject(FlatCAMObj, Geometry):
else: else:
self.ui.generate_cnc_button.setDisabled(False) self.ui.generate_cnc_button.setDisabled(False)
# update the QLabel that shows for which Tool we have the parameters in the UI form
if len(sel_rows) == 1:
current_row = sel_rows[0]
# populate the form with the data from the tool associated with the row parameter
try:
item = self.ui.geo_tools_table.item(current_row, 5)
if type(item) is not None:
tooluid = int(item.text())
else:
self.ui_connect()
return
except Exception as e:
log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e))
self.ui_connect()
return
self.ui.tool_data_label.setText(
"<b>%s: <font color='#0000FF'>%s %d</font></b>" % (_('Parameters for'), _("Tool"), tooluid)
)
else:
self.ui.tool_data_label.setText(
"<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
)
for current_row in sel_rows: for current_row in sel_rows:
self.set_tool_offset_visibility(current_row) self.set_tool_offset_visibility(current_row)
@@ -865,12 +909,6 @@ class GeometryObject(FlatCAMObj, Geometry):
self.ui_connect() self.ui_connect()
return return
# update the QLabel that shows for which Tool we have the parameters in the UI form
if len(sel_rows) == 1:
self.ui.tool_data_label.setText(
"<b>%s: <font color='#0000FF'>%s %d</font></b>" % (_('Parameters for'), _("Tool"), tooluid)
)
# update the form with the V-Shape fields if V-Shape selected in the geo_tool_table # update the form with the V-Shape fields if V-Shape selected in the geo_tool_table
# also modify the Cut Z form entry to reflect the calculated Cut Z from values got from V-Shape Fields # also modify the Cut Z form entry to reflect the calculated Cut Z from values got from V-Shape Fields
try: try:
@@ -902,11 +940,6 @@ class GeometryObject(FlatCAMObj, Geometry):
except Exception as e: except Exception as e:
log.debug("GeometryObject.update_ui() -> %s " % str(e)) log.debug("GeometryObject.update_ui() -> %s " % str(e))
else:
self.ui.tool_data_label.setText(
"<b>%s: <font color='#0000FF'>%s</font></b>" % (_('Parameters for'), _("Multiple Tools"))
)
self.ui_connect() self.ui_connect()
def on_tool_add(self, dia=None): def on_tool_add(self, dia=None):