- some UI changes in the Milling and Drilling Plugins
- working on the Excellon side from Milling Plugin
This commit is contained in:
committed by
Marius Stanciu
parent
73a8efde83
commit
b36077cd9a
@@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
12.09.2021
|
||||||
|
|
||||||
|
- some UI changes in the Milling and Drilling Plugins
|
||||||
|
- working on the Excellon side from Milling Plugin
|
||||||
|
|
||||||
10.09.2021
|
10.09.2021
|
||||||
|
|
||||||
- minor changes in Film Plugin
|
- minor changes in Film Plugin
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ class PreferencesUIManager:
|
|||||||
"tools_al_grbl_travelz": self.ui.plugin_eng_pref_form.tools_level_group.jog_travelz_entry,
|
"tools_al_grbl_travelz": self.ui.plugin_eng_pref_form.tools_level_group.jog_travelz_entry,
|
||||||
|
|
||||||
# Drilling Tool
|
# Drilling Tool
|
||||||
"tools_drill_tool_order": self.ui.plugin_pref_form.tools_drill_group.order_radio,
|
"tools_drill_tool_order": self.ui.plugin_pref_form.tools_drill_group.order_combo,
|
||||||
"tools_drill_cutz": self.ui.plugin_pref_form.tools_drill_group.cutz_entry,
|
"tools_drill_cutz": self.ui.plugin_pref_form.tools_drill_group.cutz_entry,
|
||||||
"tools_drill_multidepth": self.ui.plugin_pref_form.tools_drill_group.mpass_cb,
|
"tools_drill_multidepth": self.ui.plugin_pref_form.tools_drill_group.mpass_cb,
|
||||||
"tools_drill_depthperpass": self.ui.plugin_pref_form.tools_drill_group.maxdepth_entry,
|
"tools_drill_depthperpass": self.ui.plugin_pref_form.tools_drill_group.maxdepth_entry,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from PyQt6 import QtWidgets, QtCore
|
|||||||
from PyQt6.QtCore import Qt
|
from PyQt6.QtCore import Qt
|
||||||
|
|
||||||
from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCComboBox, FCCheckBox, FCSpinner, NumericalEvalTupleEntry, \
|
from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCComboBox, FCCheckBox, FCSpinner, NumericalEvalTupleEntry, \
|
||||||
OptionalInputSection, NumericalEvalEntry, FCLabel, FCGridLayout
|
OptionalInputSection, NumericalEvalEntry, FCLabel, FCGridLayout, FCComboBox2
|
||||||
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
@@ -35,18 +35,17 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
|
|||||||
# Tool order Radio Button
|
# Tool order Radio Button
|
||||||
self.order_label = FCLabel('%s:' % _('Tool order'))
|
self.order_label = FCLabel('%s:' % _('Tool order'))
|
||||||
self.order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
|
self.order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
|
||||||
"'No' --> means that the used order is the one in the tool table\n"
|
"'Default' --> the order from the Excellon file\n"
|
||||||
"'Forward' --> means that the tools will be ordered from small to big\n"
|
"'Forward' --> tools will be ordered from small to big\n"
|
||||||
"'Reverse' --> means that the tools will ordered from big to small\n\n"
|
"'Reverse' --> tools will ordered from big to small\n\n"
|
||||||
"WARNING: using rest machining will automatically set the order\n"
|
"WARNING: using rest machining will automatically set the order\n"
|
||||||
"in reverse and disable this control."))
|
"in reverse and disable this control."))
|
||||||
|
|
||||||
self.order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
|
self.order_combo = FCComboBox2()
|
||||||
{'label': _('Forward'), 'value': 'fwd'},
|
self.order_combo.addItems([_('Default'), _('Forward'), _('Reverse')])
|
||||||
{'label': _('Reverse'), 'value': 'rev'}])
|
|
||||||
|
|
||||||
grid0.addWidget(self.order_label, 1, 0)
|
grid0.addWidget(self.order_label, 1, 0)
|
||||||
grid0.addWidget(self.order_radio, 1, 1, 1, 2)
|
grid0.addWidget(self.order_combo, 1, 1, 1, 2)
|
||||||
|
|
||||||
# Cut Z
|
# Cut Z
|
||||||
cutzlabel = FCLabel('%s:' % _('Cut Z'))
|
cutzlabel = FCLabel('%s:' % _('Cut Z'))
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
for it in range(self.ui.pp_excellon_name_cb.count()):
|
for it in range(self.ui.pp_excellon_name_cb.count()):
|
||||||
self.ui.pp_excellon_name_cb.setItemData(it, self.ui.pp_excellon_name_cb.itemText(it), QtCore.Qt.ItemDataRole.ToolTipRole)
|
self.ui.pp_excellon_name_cb.setItemData(it, self.ui.pp_excellon_name_cb.itemText(it), QtCore.Qt.ItemDataRole.ToolTipRole)
|
||||||
|
|
||||||
self.ui.order_radio.set_value(self.app.defaults["tools_drill_tool_order"])
|
self.ui.order_combo.set_value(self.app.defaults["tools_drill_tool_order"])
|
||||||
|
|
||||||
if loaded_obj:
|
if loaded_obj:
|
||||||
outname = loaded_obj.options['name']
|
outname = loaded_obj.options['name']
|
||||||
@@ -673,10 +673,10 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
for k, v in self.excellon_tools.items():
|
for k, v in self.excellon_tools.items():
|
||||||
sorted_tools.append(self.dec_format(float(v['tooldia'])))
|
sorted_tools.append(self.dec_format(float(v['tooldia'])))
|
||||||
|
|
||||||
order = self.ui.order_radio.get_value()
|
order = self.ui.order_combo.get_value()
|
||||||
if order == 'fwd':
|
if order == 1: # 'fwd'
|
||||||
sorted_tools.sort(reverse=False)
|
sorted_tools.sort(reverse=False)
|
||||||
elif order == 'rev':
|
elif order == 2: # 'rev'
|
||||||
sorted_tools.sort(reverse=True)
|
sorted_tools.sort(reverse=True)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
@@ -1024,7 +1024,7 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
elif isinstance(current_widget2, NumericalEvalTupleEntry):
|
elif isinstance(current_widget2, NumericalEvalTupleEntry):
|
||||||
current_widget2.editingFinished.connect(self.form_to_storage)
|
current_widget2.editingFinished.connect(self.form_to_storage)
|
||||||
|
|
||||||
self.ui.order_radio.activated_custom[str].connect(self.on_order_changed)
|
self.ui.order_combo.currentIndexChanged.connect(self.on_order_changed)
|
||||||
|
|
||||||
# Exclusion Table widgets connect
|
# Exclusion Table widgets connect
|
||||||
for row in range(self.ui.exclusion_table.rowCount()):
|
for row in range(self.ui.exclusion_table.rowCount()):
|
||||||
@@ -1116,7 +1116,7 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
self.ui.order_radio.activated_custom[str].disconnect()
|
self.ui.order_combo.currentIndexChanged.disconnect()
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -1457,7 +1457,7 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
self.blockSignals(False)
|
self.blockSignals(False)
|
||||||
|
|
||||||
def on_order_changed(self, order):
|
def on_order_changed(self, order):
|
||||||
if order != 'no':
|
if order != 0: # 'default'
|
||||||
self.build_tool_ui()
|
self.build_tool_ui()
|
||||||
|
|
||||||
def on_tooltable_cellwidget_change(self):
|
def on_tooltable_cellwidget_change(self):
|
||||||
@@ -1940,7 +1940,7 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
for tool_as_key, v in list(self.excellon_tools.items()):
|
for tool_as_key, v in list(self.excellon_tools.items()):
|
||||||
all_tools.append((int(tool_as_key), float(v['tooldia'])))
|
all_tools.append((int(tool_as_key), float(v['tooldia'])))
|
||||||
|
|
||||||
order = self.ui.order_radio.get_value()
|
order = self.ui.order_combo.get_value()
|
||||||
if order == 'fwd':
|
if order == 'fwd':
|
||||||
sorted_tools = sorted(all_tools, key=lambda t1: t1[1])
|
sorted_tools = sorted(all_tools, key=lambda t1: t1[1])
|
||||||
elif order == 'rev':
|
elif order == 'rev':
|
||||||
@@ -2360,18 +2360,17 @@ class DrillingUI:
|
|||||||
# Tool order
|
# Tool order
|
||||||
self.order_label = FCLabel('%s:' % _('Tool order'))
|
self.order_label = FCLabel('%s:' % _('Tool order'))
|
||||||
self.order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
|
self.order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
|
||||||
"'No' --> means that the used order is the one in the tool table\n"
|
"'Default' --> the order from the Excellon file\n"
|
||||||
"'Forward' --> means that the tools will be ordered from small to big\n"
|
"'Forward' --> tools will be ordered from small to big\n"
|
||||||
"'Reverse' --> means that the tools will ordered from big to small\n\n"
|
"'Reverse' --> tools will ordered from big to small\n\n"
|
||||||
"WARNING: using rest machining will automatically set the order\n"
|
"WARNING: using rest machining will automatically set the order\n"
|
||||||
"in reverse and disable this control."))
|
"in reverse and disable this control."))
|
||||||
|
|
||||||
self.order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
|
self.order_combo = FCComboBox2()
|
||||||
{'label': _('Forward'), 'value': 'fwd'},
|
self.order_combo.addItems([_('Default'), _('Forward'), _('Reverse')])
|
||||||
{'label': _('Reverse'), 'value': 'rev'}])
|
|
||||||
|
|
||||||
grid1.addWidget(self.order_label, 2, 0)
|
grid1.addWidget(self.order_label, 2, 0)
|
||||||
grid1.addWidget(self.order_radio, 2, 1)
|
grid1.addWidget(self.order_combo, 2, 1)
|
||||||
|
|
||||||
# Manual Load of Tools from DB
|
# Manual Load of Tools from DB
|
||||||
self.search_load_db_btn = FCButton(_("Search DB"))
|
self.search_load_db_btn = FCButton(_("Search DB"))
|
||||||
@@ -2879,7 +2878,7 @@ class DrillingUI:
|
|||||||
# separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
|
# separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
|
||||||
# grid3.addWidget(separator_line, 25, 0, 1, 2)
|
# grid3.addWidget(separator_line, 25, 0, 1, 2)
|
||||||
|
|
||||||
FCGridLayout.set_common_column_size([grid0, grid1, grid2, grid3, grid_a1], 0)
|
FCGridLayout.set_common_column_size([grid0, grid1, grid2, grid3], 0)
|
||||||
|
|
||||||
self.generate_cnc_button = QtWidgets.QPushButton(_('Generate CNCJob object'))
|
self.generate_cnc_button = QtWidgets.QPushButton(_('Generate CNCJob object'))
|
||||||
self.generate_cnc_button.setIcon(QtGui.QIcon(self.app.resource_location + '/cnc16.png'))
|
self.generate_cnc_button.setIcon(QtGui.QIcon(self.app.resource_location + '/cnc16.png'))
|
||||||
|
|||||||
@@ -571,7 +571,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
|
|
||||||
self.ui.tools_frame.show()
|
self.ui.tools_frame.show()
|
||||||
|
|
||||||
self.ui.order_radio.set_value(self.app.defaults["tools_drill_tool_order"])
|
self.ui.order_combo.set_value(self.app.defaults["tools_drill_tool_order"])
|
||||||
self.ui.milling_type_radio.set_value(self.app.defaults["tools_mill_milling_type"])
|
self.ui.milling_type_radio.set_value(self.app.defaults["tools_mill_milling_type"])
|
||||||
|
|
||||||
# init the working variables
|
# init the working variables
|
||||||
@@ -1061,6 +1061,29 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
if self.target_obj:
|
if self.target_obj:
|
||||||
self.ui.param_frame.setDisabled(False)
|
self.ui.param_frame.setDisabled(False)
|
||||||
|
|
||||||
|
# order the tools by tool diameter if it's the case
|
||||||
|
sorted_tools = []
|
||||||
|
for k, v in self.obj_tools.items():
|
||||||
|
sorted_tools.append(self.app.dec_format(float(v['tooldia'])))
|
||||||
|
|
||||||
|
order = self.ui.order_combo.get_value()
|
||||||
|
if order == 1: # 'fwd'
|
||||||
|
sorted_tools.sort(reverse=False)
|
||||||
|
elif order == 2: # 'rev'
|
||||||
|
sorted_tools.sort(reverse=True)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# remake the excellon_tools dict in the order above
|
||||||
|
new_id = 1
|
||||||
|
new_tools = {}
|
||||||
|
for tooldia in sorted_tools:
|
||||||
|
for old_tool in self.obj_tools:
|
||||||
|
if self.app.dec_format(float(self.obj_tools[old_tool]['tooldia'])) == tooldia:
|
||||||
|
new_tools[new_id] = deepcopy(self.obj_tools[old_tool])
|
||||||
|
new_id += 1
|
||||||
|
|
||||||
|
self.obj_tools = new_tools
|
||||||
tools = [k for k in self.obj_tools]
|
tools = [k for k in self.obj_tools]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -1212,7 +1235,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
if val == 'exc':
|
if val == 'exc':
|
||||||
self.ui.tools_table.show()
|
self.ui.tools_table.show()
|
||||||
self.ui.order_label.show()
|
self.ui.order_label.show()
|
||||||
self.ui.order_radio.show()
|
self.ui.order_combo.show()
|
||||||
|
|
||||||
self.ui.geo_tools_table.hide()
|
self.ui.geo_tools_table.hide()
|
||||||
|
|
||||||
@@ -1238,7 +1261,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
else:
|
else:
|
||||||
self.ui.tools_table.hide()
|
self.ui.tools_table.hide()
|
||||||
self.ui.order_label.hide()
|
self.ui.order_label.hide()
|
||||||
self.ui.order_radio.hide()
|
self.ui.order_combo.hide()
|
||||||
|
|
||||||
self.ui.geo_tools_table.show()
|
self.ui.geo_tools_table.show()
|
||||||
|
|
||||||
@@ -1425,7 +1448,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
elif isinstance(current_widget, FCComboBox2):
|
elif isinstance(current_widget, FCComboBox2):
|
||||||
current_widget.currentIndexChanged.connect(self.form_to_storage)
|
current_widget.currentIndexChanged.connect(self.form_to_storage)
|
||||||
|
|
||||||
self.ui.order_radio.activated_custom[str].connect(self.on_order_changed)
|
self.ui.order_combo.currentIndexChanged.connect(self.on_order_changed)
|
||||||
|
|
||||||
# Exclusion Table widgets connect
|
# Exclusion Table widgets connect
|
||||||
for row in range(self.ui.exclusion_table.rowCount()):
|
for row in range(self.ui.exclusion_table.rowCount()):
|
||||||
@@ -1534,7 +1557,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.ui.order_radio.activated_custom[str].disconnect()
|
self.ui.order_combo.currentIndexChanged.disconnect()
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -1936,7 +1959,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
self.ui_connect()
|
self.ui_connect()
|
||||||
|
|
||||||
def on_order_changed(self, order):
|
def on_order_changed(self, order):
|
||||||
if order != 'no':
|
if order != 0: # "default"
|
||||||
self.build_ui()
|
self.build_ui()
|
||||||
|
|
||||||
def on_tool_add(self, clicked_state, dia=None, new_geo=None):
|
def on_tool_add(self, clicked_state, dia=None, new_geo=None):
|
||||||
@@ -3719,18 +3742,17 @@ class MillingUI:
|
|||||||
# Tool order
|
# Tool order
|
||||||
self.order_label = FCLabel('%s:' % _('Tool order'))
|
self.order_label = FCLabel('%s:' % _('Tool order'))
|
||||||
self.order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
|
self.order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
|
||||||
"'No' --> means that the used order is the one in the tool table\n"
|
"'Default' --> the order from the Excellon file\n"
|
||||||
"'Forward' --> means that the tools will be ordered from small to big\n"
|
"'Forward' --> tools will be ordered from small to big\n"
|
||||||
"'Reverse' --> means that the tools will ordered from big to small\n\n"
|
"'Reverse' --> tools will ordered from big to small\n\n"
|
||||||
"WARNING: using rest machining will automatically set the order\n"
|
"WARNING: using rest machining will automatically set the order\n"
|
||||||
"in reverse and disable this control."))
|
"in reverse and disable this control."))
|
||||||
|
|
||||||
self.order_radio = RadioSet([{'label': _('No'), 'value': 'no'},
|
self.order_combo = FCComboBox2()
|
||||||
{'label': _('Forward'), 'value': 'fwd'},
|
self.order_combo.addItems([_('Default'), _('Forward'), _('Reverse')])
|
||||||
{'label': _('Reverse'), 'value': 'rev'}])
|
|
||||||
|
|
||||||
grid1.addWidget(self.order_label, 2, 0)
|
grid1.addWidget(self.order_label, 2, 0)
|
||||||
grid1.addWidget(self.order_radio, 2, 1)
|
grid1.addWidget(self.order_combo, 2, 1)
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# ************** Geometry Tool Table *************************************
|
# ************** Geometry Tool Table *************************************
|
||||||
@@ -3772,7 +3794,7 @@ class MillingUI:
|
|||||||
self.tools_table.hide()
|
self.tools_table.hide()
|
||||||
self.geo_tools_table.hide()
|
self.geo_tools_table.hide()
|
||||||
self.order_label.hide()
|
self.order_label.hide()
|
||||||
self.order_radio.hide()
|
self.order_combo.hide()
|
||||||
|
|
||||||
# #############################################################################################################
|
# #############################################################################################################
|
||||||
# ADD TOOLS FOR GEOMETRY OBJECT
|
# ADD TOOLS FOR GEOMETRY OBJECT
|
||||||
@@ -3900,7 +3922,7 @@ class MillingUI:
|
|||||||
self.milling_type_radio.setObjectName("milling_type")
|
self.milling_type_radio.setObjectName("milling_type")
|
||||||
|
|
||||||
grid2.addWidget(self.mill_type_label, 0, 0)
|
grid2.addWidget(self.mill_type_label, 0, 0)
|
||||||
grid2.addWidget(self.milling_type_radio, 0, 1)
|
grid2.addWidget(self.milling_type_radio, 1, 0, 1, 2)
|
||||||
|
|
||||||
# Milling Diameter
|
# Milling Diameter
|
||||||
self.mill_dia_label = FCLabel('%s:' % _('Milling Diameter'))
|
self.mill_dia_label = FCLabel('%s:' % _('Milling Diameter'))
|
||||||
@@ -4594,7 +4616,7 @@ class MillingUI:
|
|||||||
# ------------------------------------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
FCGridLayout.set_common_column_size(
|
FCGridLayout.set_common_column_size(
|
||||||
[grid0, grid_title_tool_table, grid1, grid_add_tool, button_grid, grid2, grid3, grid_a1], 0)
|
[grid0, grid_title_tool_table, grid1, grid_add_tool, button_grid, grid2, grid3], 0)
|
||||||
|
|
||||||
# #############################################################################################################
|
# #############################################################################################################
|
||||||
# Generate CNC Job object
|
# Generate CNC Job object
|
||||||
|
|||||||
Reference in New Issue
Block a user