- 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:
parent
1ea168fd4b
commit
e85b6f8d87
|
@ -14,6 +14,9 @@ CHANGELOG for FlatCAM beta
|
|||
- NCC Tool - allow no tool at NCC Tool start (the Preferences have no tool)
|
||||
- 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
|
||||
- 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
|
||||
|
||||
|
|
|
@ -1973,11 +1973,7 @@ class ToolsDB2(QtWidgets.QWidget):
|
|||
self.on_tool_requested_from_app()
|
||||
|
||||
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.storage_to_form(self.db_tool_dict[current.text(0)])
|
||||
|
||||
def on_list_item_edited(self, item, column):
|
||||
|
@ -2022,7 +2018,7 @@ class ToolsDB2(QtWidgets.QWidget):
|
|||
self.blockSignals(False)
|
||||
|
||||
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
|
||||
try:
|
||||
|
@ -2420,7 +2416,6 @@ class ToolsDB2(QtWidgets.QWidget):
|
|||
self.vdia_entry.valueChanged.connect(self.on_calculate_tooldia)
|
||||
self.vangle_entry.valueChanged.connect(self.on_calculate_tooldia)
|
||||
|
||||
|
||||
def ui_disconnect(self):
|
||||
try:
|
||||
self.name_entry.editingFinished.disconnect(self.update_tree_name)
|
||||
|
|
|
@ -1005,8 +1005,8 @@ class ExcellonObjectUI(ObjectUI):
|
|||
"If no value is entered then there is no move\n"
|
||||
"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(self.endxy_entry, 12, 1)
|
||||
|
||||
|
@ -1907,7 +1907,8 @@ class GeometryObjectUI(ObjectUI):
|
|||
"If no value is entered then there is no move\n"
|
||||
"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(self.endxy_entry, 10, 1)
|
||||
|
@ -2033,19 +2034,15 @@ class GeometryObjectUI(ObjectUI):
|
|||
separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
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"
|
||||
"Click the # header to select all, or Ctrl + LMB\n"
|
||||
"for custom selection of tools."
|
||||
))
|
||||
grid4.addWidget(warning_lbl, 16, 0, 1, 2)
|
||||
"for custom selection of tools.")))
|
||||
|
||||
# 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("""
|
||||
QPushButton
|
||||
{
|
||||
|
|
|
@ -156,8 +156,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
|||
self.param_fields = {}
|
||||
|
||||
# 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 = False
|
||||
self.exclusion_area_cb_is_checked = self.app.defaults["geometry_area_exclusion"]
|
||||
|
||||
# Attributes to be included in serialization
|
||||
# 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.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.tool_offset_entry.returnPressed.connect(self.on_offset_value_edited)
|
||||
|
@ -822,6 +821,26 @@ class GeometryObject(FlatCAMObj, Geometry):
|
|||
except (TypeError, AttributeError):
|
||||
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):
|
||||
self.update_ui()
|
||||
|
||||
|
@ -849,6 +868,31 @@ class GeometryObject(FlatCAMObj, Geometry):
|
|||
else:
|
||||
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:
|
||||
self.set_tool_offset_visibility(current_row)
|
||||
|
||||
|
@ -865,47 +909,36 @@ class GeometryObject(FlatCAMObj, Geometry):
|
|||
self.ui_connect()
|
||||
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
|
||||
# also modify the Cut Z form entry to reflect the calculated Cut Z from values got from V-Shape Fields
|
||||
try:
|
||||
item = self.ui.geo_tools_table.cellWidget(current_row, 4)
|
||||
if item is not None:
|
||||
tool_type_txt = item.currentText()
|
||||
self.ui_update_v_shape(tool_type_txt=tool_type_txt)
|
||||
else:
|
||||
self.ui_connect()
|
||||
return
|
||||
except Exception as e:
|
||||
log.debug("Tool missing in ui_update_v_shape(). Add a tool in Geo Tool Table. %s" % str(e))
|
||||
# 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
|
||||
try:
|
||||
item = self.ui.geo_tools_table.cellWidget(current_row, 4)
|
||||
if item is not None:
|
||||
tool_type_txt = item.currentText()
|
||||
self.ui_update_v_shape(tool_type_txt=tool_type_txt)
|
||||
else:
|
||||
self.ui_connect()
|
||||
return
|
||||
except Exception as e:
|
||||
log.debug("Tool missing in ui_update_v_shape(). Add a tool in Geo Tool Table. %s" % str(e))
|
||||
return
|
||||
|
||||
try:
|
||||
# set the form with data from the newly selected tool
|
||||
for tooluid_key, tooluid_value in list(self.tools.items()):
|
||||
if int(tooluid_key) == tooluid:
|
||||
for key, value in list(tooluid_value.items()):
|
||||
if key == 'data':
|
||||
form_value_storage = tooluid_value['data']
|
||||
self.update_form(form_value_storage)
|
||||
if key == 'offset_value':
|
||||
# update the offset value in the entry even if the entry is hidden
|
||||
self.ui.tool_offset_entry.set_value(tooluid_value['offset_value'])
|
||||
try:
|
||||
# set the form with data from the newly selected tool
|
||||
for tooluid_key, tooluid_value in list(self.tools.items()):
|
||||
if int(tooluid_key) == tooluid:
|
||||
for key, value in list(tooluid_value.items()):
|
||||
if key == 'data':
|
||||
form_value_storage = tooluid_value['data']
|
||||
self.update_form(form_value_storage)
|
||||
if key == 'offset_value':
|
||||
# update the offset value in the entry even if the entry is hidden
|
||||
self.ui.tool_offset_entry.set_value(tooluid_value['offset_value'])
|
||||
|
||||
if key == 'tool_type' and value == 'V':
|
||||
self.update_cutz()
|
||||
except Exception as 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"))
|
||||
)
|
||||
if key == 'tool_type' and value == 'V':
|
||||
self.update_cutz()
|
||||
except Exception as e:
|
||||
log.debug("GeometryObject.update_ui() -> %s " % str(e))
|
||||
|
||||
self.ui_connect()
|
||||
|
||||
|
|
Loading…
Reference in New Issue