- Drilling Tool - remade the 'Beginner/Advanced' Mode
This commit is contained in:
@@ -13,6 +13,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
- Milling UI - clicking the 'Beginner/Advanced' top button will switch the application mode for the current tool(this change need to be propagated everywhere a 'Beginner' mode is needed)
|
- Milling UI - clicking the 'Beginner/Advanced' top button will switch the application mode for the current tool(this change need to be propagated everywhere a 'Beginner' mode is needed)
|
||||||
- fixed the on_delete() method in the App class; sometime it will delete all files that have similar names
|
- fixed the on_delete() method in the App class; sometime it will delete all files that have similar names
|
||||||
- made sure that on creation of new objects the adding of the names to the auto-complete list is done properly
|
- made sure that on creation of new objects the adding of the names to the auto-complete list is done properly
|
||||||
|
- Drilling Tool - remade the 'Beginner/Advanced' Mode
|
||||||
|
|
||||||
8.12.2020
|
8.12.2020
|
||||||
|
|
||||||
|
|||||||
@@ -277,6 +277,8 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
# #############################################################################
|
# #############################################################################
|
||||||
self.builduiSig.connect(self.build_tool_ui)
|
self.builduiSig.connect(self.build_tool_ui)
|
||||||
|
|
||||||
|
self.ui.level.toggled.connect(self.on_level_changed)
|
||||||
|
|
||||||
self.ui.search_load_db_btn.clicked.connect(self.on_tool_db_load)
|
self.ui.search_load_db_btn.clicked.connect(self.on_tool_db_load)
|
||||||
|
|
||||||
self.ui.apply_param_to_all.clicked.connect(self.on_apply_param_to_all_clicked)
|
self.ui.apply_param_to_all.clicked.connect(self.on_apply_param_to_all_clicked)
|
||||||
@@ -329,16 +331,9 @@ 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.ToolTipRole)
|
self.ui.pp_excellon_name_cb.setItemData(it, self.ui.pp_excellon_name_cb.itemText(it), QtCore.Qt.ToolTipRole)
|
||||||
|
|
||||||
app_mode = self.app.defaults["global_app_level"]
|
|
||||||
# Show/Hide Advanced Options
|
# Show/Hide Advanced Options
|
||||||
if app_mode == 'b':
|
app_mode = self.app.defaults["global_app_level"]
|
||||||
self.ui.level.setText('<span style="color:green;"><b>%s</b></span>' % _('Basic'))
|
self.change_level(app_mode)
|
||||||
self.ui.estartz_label.hide()
|
|
||||||
self.ui.estartz_entry.hide()
|
|
||||||
else:
|
|
||||||
self.ui.level.setText('<span style="color:red;"><b>%s</b></span>' % _('Advanced'))
|
|
||||||
self.ui.estartz_label.show()
|
|
||||||
self.ui.estartz_entry.show()
|
|
||||||
|
|
||||||
self.ui.tools_frame.show()
|
self.ui.tools_frame.show()
|
||||||
|
|
||||||
@@ -482,6 +477,112 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
pass
|
pass
|
||||||
self.ui.object_combo.currentTextChanged.connect(self.on_object_changed)
|
self.ui.object_combo.currentTextChanged.connect(self.on_object_changed)
|
||||||
|
|
||||||
|
def change_level(self, level):
|
||||||
|
"""
|
||||||
|
|
||||||
|
:param level: application level: either 'b' or 'a'
|
||||||
|
:type level: str
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
|
||||||
|
if level == 'a':
|
||||||
|
self.ui.level.setChecked(True)
|
||||||
|
else:
|
||||||
|
self.ui.level.setChecked(False)
|
||||||
|
|
||||||
|
def on_level_changed(self, checked):
|
||||||
|
|
||||||
|
loaded_obj = self.app.collection.get_by_name(self.ui.object_combo.get_value())
|
||||||
|
|
||||||
|
if not checked:
|
||||||
|
self.ui.level.setText('%s' % _('Beginner'))
|
||||||
|
self.ui.level.setStyleSheet("""
|
||||||
|
QToolButton
|
||||||
|
{
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
|
# Tool parameters section
|
||||||
|
if loaded_obj:
|
||||||
|
for tool in loaded_obj.tools:
|
||||||
|
tool_data = loaded_obj.tools[tool]['data']
|
||||||
|
|
||||||
|
tool_data['tools_drill_multidepth'] = False
|
||||||
|
tool_data['tools_drill_dwell'] = False
|
||||||
|
tool_data['tools_drill_drill_slots'] = False
|
||||||
|
|
||||||
|
tool_data['tools_drill_toolchangexy'] = ''
|
||||||
|
tool_data['tools_drill_area_exclusion'] = False
|
||||||
|
|
||||||
|
self.ui.mpass_cb.hide()
|
||||||
|
self.ui.maxdepth_entry.hide()
|
||||||
|
|
||||||
|
self.ui.dwell_cb.hide()
|
||||||
|
self.ui.dwelltime_entry.hide()
|
||||||
|
|
||||||
|
self.ui.tool_offset_label.hide()
|
||||||
|
self.ui.offset_entry.hide()
|
||||||
|
|
||||||
|
self.ui.drill_slots_cb.hide()
|
||||||
|
|
||||||
|
# All param section
|
||||||
|
self.ui.all_param_separator_line2.hide()
|
||||||
|
self.ui.apply_param_to_all.hide()
|
||||||
|
|
||||||
|
# General param
|
||||||
|
self.ui.estartz_label.hide()
|
||||||
|
self.ui.estartz_entry.hide()
|
||||||
|
self.ui.endmove_xy_label.hide()
|
||||||
|
self.ui.endxy_entry.hide()
|
||||||
|
|
||||||
|
self.ui.exclusion_cb.hide()
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.ui.level.setText('%s' % _('Advanced'))
|
||||||
|
self.ui.level.setStyleSheet("""
|
||||||
|
QToolButton
|
||||||
|
{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
|
# Tool parameters section
|
||||||
|
if loaded_obj:
|
||||||
|
app_defaults = self.app.defaults
|
||||||
|
for tool in loaded_obj.tools:
|
||||||
|
tool_data = loaded_obj.tools[tool]['data']
|
||||||
|
|
||||||
|
tool_data['tools_drill_multidepth'] = app_defaults['tools_drill_multidepth']
|
||||||
|
tool_data['tools_drill_dwell'] = app_defaults['tools_drill_dwell']
|
||||||
|
tool_data['tools_drill_drill_slots'] = app_defaults['tools_drill_drill_slots']
|
||||||
|
|
||||||
|
tool_data['tools_drill_toolchangexy'] = app_defaults['tools_drill_toolchangexy']
|
||||||
|
tool_data['tools_drill_area_exclusion'] = app_defaults['tools_drill_area_exclusion']
|
||||||
|
|
||||||
|
self.ui.mpass_cb.show()
|
||||||
|
self.ui.maxdepth_entry.show()
|
||||||
|
|
||||||
|
self.ui.dwell_cb.show()
|
||||||
|
self.ui.dwelltime_entry.show()
|
||||||
|
|
||||||
|
self.ui.tool_offset_label.show()
|
||||||
|
self.ui.offset_entry.show()
|
||||||
|
|
||||||
|
self.ui.drill_slots_cb.show()
|
||||||
|
|
||||||
|
# All param section
|
||||||
|
self.ui.all_param_separator_line2.show()
|
||||||
|
self.ui.apply_param_to_all.show()
|
||||||
|
|
||||||
|
# General param
|
||||||
|
self.ui.estartz_label.show()
|
||||||
|
self.ui.estartz_entry.show()
|
||||||
|
self.ui.endmove_xy_label.show()
|
||||||
|
self.ui.endxy_entry.show()
|
||||||
|
|
||||||
|
self.ui.exclusion_cb.show()
|
||||||
|
|
||||||
# update the changes in UI depending on the selected preprocessor in Preferences
|
# update the changes in UI depending on the selected preprocessor in Preferences
|
||||||
# after this moment all the changes in the Posprocessor combo will be handled by the activated signal of the
|
# after this moment all the changes in the Posprocessor combo will be handled by the activated signal of the
|
||||||
# self.ui.pp_excellon_name_cb combobox
|
# self.ui.pp_excellon_name_cb combobox
|
||||||
@@ -1318,6 +1419,7 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
if 'laser' in current_pp.lower():
|
if 'laser' in current_pp.lower():
|
||||||
self.ui.cutzlabel.hide()
|
self.ui.cutzlabel.hide()
|
||||||
self.ui.cutz_entry.hide()
|
self.ui.cutz_entry.hide()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.ui.mpass_cb.hide()
|
self.ui.mpass_cb.hide()
|
||||||
self.ui.maxdepth_entry.hide()
|
self.ui.maxdepth_entry.hide()
|
||||||
@@ -1357,11 +1459,14 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
else:
|
else:
|
||||||
self.ui.cutzlabel.show()
|
self.ui.cutzlabel.show()
|
||||||
self.ui.cutz_entry.show()
|
self.ui.cutz_entry.show()
|
||||||
try:
|
|
||||||
self.ui.mpass_cb.show()
|
# if in Advanced Mode
|
||||||
self.ui.maxdepth_entry.show()
|
if self.ui.level.isChecked():
|
||||||
except AttributeError:
|
try:
|
||||||
pass
|
self.ui.mpass_cb.show()
|
||||||
|
self.ui.maxdepth_entry.show()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
self.ui.travelzlabel.setText('%s:' % _('Travel Z'))
|
self.ui.travelzlabel.setText('%s:' % _('Travel Z'))
|
||||||
|
|
||||||
@@ -1376,16 +1481,19 @@ class ToolDrilling(AppTool, Excellon):
|
|||||||
self.ui.feedrate_z_entry.show()
|
self.ui.feedrate_z_entry.show()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
self.ui.dwell_cb.show()
|
|
||||||
self.ui.dwelltime_entry.show()
|
|
||||||
|
|
||||||
self.ui.spindle_label.setText('%s:' % _('Spindle speed'))
|
self.ui.spindle_label.setText('%s:' % _('Spindle speed'))
|
||||||
|
|
||||||
try:
|
# if in Advanced Mode
|
||||||
self.ui.tool_offset_label.show()
|
if self.ui.level.isChecked():
|
||||||
self.ui.offset_entry.show()
|
self.ui.dwell_cb.show()
|
||||||
except AttributeError:
|
self.ui.dwelltime_entry.show()
|
||||||
pass
|
|
||||||
|
try:
|
||||||
|
self.ui.tool_offset_label.show()
|
||||||
|
self.ui.offset_entry.show()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
def on_key_press(self, event):
|
def on_key_press(self, event):
|
||||||
# modifiers = QtWidgets.QApplication.keyboardModifiers()
|
# modifiers = QtWidgets.QApplication.keyboardModifiers()
|
||||||
@@ -2124,7 +2232,7 @@ class DrillingUI:
|
|||||||
self.title_box.addWidget(title_label)
|
self.title_box.addWidget(title_label)
|
||||||
|
|
||||||
# App Level label
|
# App Level label
|
||||||
self.level = QtWidgets.QLabel("")
|
self.level = QtWidgets.QToolButton()
|
||||||
self.level.setToolTip(
|
self.level.setToolTip(
|
||||||
_(
|
_(
|
||||||
"BASIC is suitable for a beginner. Many parameters\n"
|
"BASIC is suitable for a beginner. Many parameters\n"
|
||||||
@@ -2135,7 +2243,8 @@ class DrillingUI:
|
|||||||
"'APP. LEVEL' radio button."
|
"'APP. LEVEL' radio button."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
|
# self.level.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
|
||||||
|
self.level.setCheckable(True)
|
||||||
self.title_box.addWidget(self.level)
|
self.title_box.addWidget(self.level)
|
||||||
|
|
||||||
# Grid Layout
|
# Grid Layout
|
||||||
@@ -2471,10 +2580,10 @@ class DrillingUI:
|
|||||||
self.grid3.setColumnStretch(1, 1)
|
self.grid3.setColumnStretch(1, 1)
|
||||||
self.exc_tools_box.addLayout(self.grid3)
|
self.exc_tools_box.addLayout(self.grid3)
|
||||||
|
|
||||||
separator_line2 = QtWidgets.QFrame()
|
self.all_param_separator_line2 = QtWidgets.QFrame()
|
||||||
separator_line2.setFrameShape(QtWidgets.QFrame.HLine)
|
self.all_param_separator_line2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
self.all_param_separator_line2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
self.grid3.addWidget(separator_line2, 0, 0, 1, 2)
|
self.grid3.addWidget(self.all_param_separator_line2, 0, 0, 1, 2)
|
||||||
|
|
||||||
self.apply_param_to_all = FCButton(_("Apply parameters to all tools"))
|
self.apply_param_to_all = FCButton(_("Apply parameters to all tools"))
|
||||||
self.apply_param_to_all.setIcon(QtGui.QIcon(self.app.resource_location + '/param_all32.png'))
|
self.apply_param_to_all.setIcon(QtGui.QIcon(self.app.resource_location + '/param_all32.png'))
|
||||||
@@ -2559,8 +2668,8 @@ class DrillingUI:
|
|||||||
self.grid3.addWidget(self.endz_entry, 11, 1)
|
self.grid3.addWidget(self.endz_entry, 11, 1)
|
||||||
|
|
||||||
# End Move X,Y
|
# End Move X,Y
|
||||||
endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
|
self.endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
|
||||||
endmove_xy_label.setToolTip(
|
self.endmove_xy_label.setToolTip(
|
||||||
_("End move X,Y position. In format (x,y).\n"
|
_("End move X,Y position. In format (x,y).\n"
|
||||||
"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.")
|
||||||
@@ -2569,7 +2678,7 @@ class DrillingUI:
|
|||||||
self.endxy_entry.setPlaceholderText(_("X,Y coordinates"))
|
self.endxy_entry.setPlaceholderText(_("X,Y coordinates"))
|
||||||
self.endxy_entry.setObjectName("e_endxy")
|
self.endxy_entry.setObjectName("e_endxy")
|
||||||
|
|
||||||
self.grid3.addWidget(endmove_xy_label, 12, 0)
|
self.grid3.addWidget(self.endmove_xy_label, 12, 0)
|
||||||
self.grid3.addWidget(self.endxy_entry, 12, 1)
|
self.grid3.addWidget(self.endxy_entry, 12, 1)
|
||||||
|
|
||||||
# Probe depth
|
# Probe depth
|
||||||
|
|||||||
@@ -344,12 +344,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
# Fill form fields
|
# Fill form fields
|
||||||
self.to_form()
|
self.to_form()
|
||||||
|
|
||||||
# update the changes in UI depending on the selected preprocessor in Preferences
|
# Show/Hide Advanced Options
|
||||||
# after this moment all the changes in the Posprocessor combo will be handled by the activated signal of the
|
|
||||||
# self.ui.pp_excellon_name_cb combobox
|
|
||||||
# self.on_pp_changed()
|
|
||||||
#
|
|
||||||
# # Show/Hide Advanced Options
|
|
||||||
app_mode = self.app.defaults["global_app_level"]
|
app_mode = self.app.defaults["global_app_level"]
|
||||||
self.change_level(app_mode)
|
self.change_level(app_mode)
|
||||||
|
|
||||||
@@ -661,7 +656,7 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
|
|
||||||
# update the changes in UI depending on the selected preprocessor in Preferences
|
# update the changes in UI depending on the selected preprocessor in Preferences
|
||||||
# after this moment all the changes in the Posprocessor combo will be handled by the activated signal of the
|
# after this moment all the changes in the Posprocessor combo will be handled by the activated signal of the
|
||||||
# self.ui.pp_excellon_name_cb combobox
|
# pp combobox
|
||||||
self.on_pp_changed()
|
self.on_pp_changed()
|
||||||
|
|
||||||
def on_exc_rebuild_ui(self):
|
def on_exc_rebuild_ui(self):
|
||||||
@@ -3106,13 +3101,11 @@ class ToolMilling(AppTool, Excellon):
|
|||||||
self.ui.travelzlabel.hide()
|
self.ui.travelzlabel.hide()
|
||||||
self.ui.travelz_entry.hide()
|
self.ui.travelz_entry.hide()
|
||||||
|
|
||||||
# if in Advanced Mode
|
try:
|
||||||
if self.ui.level.isChecked():
|
self.ui.mpass_cb.hide()
|
||||||
try:
|
self.ui.maxdepth_entry.hide()
|
||||||
self.ui.mpass_cb.hide()
|
except AttributeError:
|
||||||
self.ui.maxdepth_entry.hide()
|
pass
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.ui.frzlabel.hide()
|
self.ui.frzlabel.hide()
|
||||||
|
|||||||
Reference in New Issue
Block a user