- added fuse tools control in Preferences UI for the Excellon objects: if checked the app will try to see if there are tools with same diameter and merge the drills for those tools; if not the tools will just be added to the new combined Excellon

This commit is contained in:
Marius Stanciu 2020-06-17 10:36:02 +03:00 committed by Marius
parent c839428a83
commit c9d66381bf
10 changed files with 44 additions and 25 deletions

View File

@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta
17.06.2020 17.06.2020
- added the multi-save capability if multiple CNCJob objects are selected in Project tab but only if all are of type CNCJob - added the multi-save capability if multiple CNCJob objects are selected in Project tab but only if all are of type CNCJob
- added fuse tools control in Preferences UI for the Excellon objects: if checked the app will try to see if there are tools with same diameter and merge the drills for those tools; if not the tools will just be added to the new combined Excellon
16.06.2020 16.06.2020

View File

@ -659,7 +659,7 @@ class EvalEntry2(QtWidgets.QLineEdit):
return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height()) return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
class NumericalEvalEntry(EvalEntry): class NumericalEvalEntry(FCEntry):
""" """
Will evaluate the input and return a value. Accepts only float numbers and formulas using the operators: /,*,+,-,% Will evaluate the input and return a value. Accepts only float numbers and formulas using the operators: /,*,+,-,%
""" """

View File

@ -171,6 +171,7 @@ class PreferencesUIManager:
"excellon_plot": self.ui.excellon_defaults_form.excellon_gen_group.plot_cb, "excellon_plot": self.ui.excellon_defaults_form.excellon_gen_group.plot_cb,
"excellon_solid": self.ui.excellon_defaults_form.excellon_gen_group.solid_cb, "excellon_solid": self.ui.excellon_defaults_form.excellon_gen_group.solid_cb,
"excellon_multicolored": self.ui.excellon_defaults_form.excellon_gen_group.multicolored_cb, "excellon_multicolored": self.ui.excellon_defaults_form.excellon_gen_group.multicolored_cb,
"excellon_merge_fuse_tools": self.ui.excellon_defaults_form.excellon_gen_group.fuse_tools_cb,
"excellon_format_upper_in": "excellon_format_upper_in":
self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry, self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry,
"excellon_format_lower_in": "excellon_format_lower_in":

View File

@ -263,9 +263,25 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid2.addWidget(separator_line, 11, 0, 1, 2) grid2.addWidget(separator_line, 11, 0, 1, 2)
# Fuse Tools
self.join_geo_label = QtWidgets.QLabel('<b>%s</b>:' % _('Join Option'))
grid2.addWidget(self.join_geo_label, 12, 0, 1, 2)
self.fuse_tools_cb = FCCheckBox(_("Fuse Tools"))
self.fuse_tools_cb.setToolTip(
_("When checked the joined (merged) object tools\n"
"will be merged also but only if they share some of their attributes.")
)
grid2.addWidget(self.fuse_tools_cb, 13, 0, 1, 2)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid2.addWidget(separator_line, 14, 0, 1, 2)
# Excellon Object Color # Excellon Object Color
self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Object Color')) self.gerber_color_label = QtWidgets.QLabel('<b>%s</b>' % _('Object Color'))
grid2.addWidget(self.gerber_color_label, 12, 0, 1, 2) grid2.addWidget(self.gerber_color_label, 17, 0, 1, 2)
# Plot Line Color # Plot Line Color
self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline')) self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
@ -274,8 +290,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
) )
self.line_color_entry = FCColorEntry() self.line_color_entry = FCColorEntry()
grid2.addWidget(self.line_color_label, 13, 0) grid2.addWidget(self.line_color_label, 19, 0)
grid2.addWidget(self.line_color_entry, 13, 1) grid2.addWidget(self.line_color_entry, 19, 1)
# Plot Fill Color # Plot Fill Color
self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill')) self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill'))
@ -286,8 +302,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
) )
self.fill_color_entry = FCColorEntry() self.fill_color_entry = FCColorEntry()
grid2.addWidget(self.fill_color_label, 14, 0) grid2.addWidget(self.fill_color_label, 22, 0)
grid2.addWidget(self.fill_color_entry, 14, 1) grid2.addWidget(self.fill_color_entry, 22, 1)
# Plot Fill Transparency Level # Plot Fill Transparency Level
self.excellon_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha')) self.excellon_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha'))
@ -296,8 +312,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
) )
self.excellon_alpha_entry = FCSliderWithSpinner(0, 255, 1) self.excellon_alpha_entry = FCSliderWithSpinner(0, 255, 1)
grid2.addWidget(self.excellon_alpha_label, 15, 0) grid2.addWidget(self.excellon_alpha_label, 24, 0)
grid2.addWidget(self.excellon_alpha_entry, 15, 1) grid2.addWidget(self.excellon_alpha_entry, 24, 1)
self.layout.addStretch() self.layout.addStretch()

View File

@ -87,14 +87,13 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
grid0.addWidget(separator_line, 9, 0, 1, 2) grid0.addWidget(separator_line, 9, 0, 1, 2)
# Fuse Tools # Fuse Tools
self.join_geo_label = QtWidgets.QLabel('<b>%s</b>:' % _('Join Geometry')) self.join_geo_label = QtWidgets.QLabel('<b>%s</b>:' % _('Join Option'))
grid0.addWidget(self.join_geo_label, 10, 0, 1, 2) grid0.addWidget(self.join_geo_label, 10, 0, 1, 2)
self.fuse_tools_cb = FCCheckBox(_("Fuse Tools")) self.fuse_tools_cb = FCCheckBox(_("Fuse Tools"))
self.fuse_tools_cb.setToolTip( self.fuse_tools_cb.setToolTip(
_("When checked the joined (merged) geometry object tools\n" _("When checked the joined (merged) object tools\n"
"will be merged also but only if they share the same attributes,\n" "will be merged also but only if they share some of their attributes.")
"like diameter, tool_type or type.")
) )
grid0.addWidget(self.fuse_tools_cb, 11, 0, 1, 2) grid0.addWidget(self.fuse_tools_cb, 11, 0, 1, 2)

View File

@ -94,7 +94,7 @@ class Panelize(AppTool):
def set_tool_ui(self): def set_tool_ui(self):
self.reset_fields() self.reset_fields()
self.reference_radio.set_value('bbox') self.ui.reference_radio.set_value('bbox')
sp_c = self.app.defaults["tools_panelize_spacing_columns"] if \ sp_c = self.app.defaults["tools_panelize_spacing_columns"] if \
self.app.defaults["tools_panelize_spacing_columns"] else 0.0 self.app.defaults["tools_panelize_spacing_columns"] else 0.0
@ -574,8 +574,8 @@ class Panelize(AppTool):
self.app.worker_task.emit({'fcn': job_thread, 'params': [self.app]}) self.app.worker_task.emit({'fcn': job_thread, 'params': [self.app]})
def reset_fields(self): def reset_fields(self):
self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) self.ui.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) self.ui.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
class PanelizeUI: class PanelizeUI:

View File

@ -674,8 +674,8 @@ class ToolPunchGerber(AppTool):
self.app.app_obj.new_object('gerber', outname, init_func) self.app.app_obj.new_object('gerber', outname, init_func)
def reset_fields(self): def reset_fields(self):
self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) self.ui.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.exc_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex())) self.ui.exc_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
self.ui_disconnect() self.ui_disconnect()

View File

@ -194,7 +194,7 @@ class SolderPaste(AppTool):
# populate only with preprocessor files that start with 'Paste_' # populate only with preprocessor files that start with 'Paste_'
if name.partition('_')[0] != 'Paste': if name.partition('_')[0] != 'Paste':
continue continue
self.pp_combo.addItem(name) self.ui.pp_combo.addItem(name)
self.reset_fields() self.reset_fields()

View File

@ -2301,7 +2301,7 @@ class App(QtCore.QObject):
self.inform.emit('[success] %s' % _("Editor exited. Editor content saved.")) self.inform.emit('[success] %s' % _("Editor exited. Editor content saved."))
# restore GUI to the Selected TAB # restore GUI to the Selected TAB
# Remove anything else in the appGUI # Remove anything else in the GUI
self.ui.selected_scroll_area.takeWidget() self.ui.selected_scroll_area.takeWidget()
elif isinstance(edited_obj, ExcellonObject): elif isinstance(edited_obj, ExcellonObject):
@ -2310,7 +2310,7 @@ class App(QtCore.QObject):
# self.exc_editor.update_options(edited_obj) # self.exc_editor.update_options(edited_obj)
# restore GUI to the Selected TAB # restore GUI to the Selected TAB
# Remove anything else in the appGUI # Remove anything else in the GUI
self.ui.tool_scroll_area.takeWidget() self.ui.tool_scroll_area.takeWidget()
# delete the old object (the source object) if it was an empty one # delete the old object (the source object) if it was an empty one
@ -2325,7 +2325,6 @@ class App(QtCore.QObject):
for tt in edited_obj.tools: for tt in edited_obj.tools:
if 'slots' in edited_obj.tools[tt] and edited_obj.tools[tt]['slots']: if 'slots' in edited_obj.tools[tt] and edited_obj.tools[tt]['slots']:
has_slots = True has_slots = True
slots_in_file = 1
break break
if has_drills is None and has_slots is None: if has_drills is None and has_slots is None:
old_name = edited_obj.options['name'] old_name = edited_obj.options['name']
@ -3001,8 +3000,8 @@ class App(QtCore.QObject):
"<b>click</b></a>" "<b>click</b></a>"
bugs_link = "<a href = 'https://bitbucket.org/jpcgt/flatcam/issues/new'<b>click</b></a>" bugs_link = "<a href = 'https://bitbucket.org/jpcgt/flatcam/issues/new'<b>click</b></a>"
donation_link = "<a href = 'https://www.paypal.com/cgi-bin/webscr?cmd=_" \ # donation_link = "<a href = 'https://www.paypal.com/cgi-bin/webscr?cmd=_" \
"donations&business=WLTJJ3Q77D98L&currency_code=USD&source=url'<b>click</b></a>" # "donations&business=WLTJJ3Q77D98L&currency_code=USD&source=url'<b>click</b></a>"
# Icon and title # Icon and title
self.setWindowIcon(parent.app_icon) self.setWindowIcon(parent.app_icon)
@ -3431,7 +3430,7 @@ class App(QtCore.QObject):
# quit app by signalling for self.kill_app() method # quit app by signalling for self.kill_app() method
# self.close_app_signal.emit() # self.close_app_signal.emit()
QtWidgets.qApp.quit() QtWidgets.qApp.quit()
# QtCore.QCoreApplication.quit() sys.exit(0)
# When the main event loop is not started yet in which case the qApp.quit() will do nothing # When the main event loop is not started yet in which case the qApp.quit() will do nothing
# we use the following command # we use the following command
@ -3899,8 +3898,10 @@ class App(QtCore.QObject):
(_("At least two objects are required for join. Objects currently selected"), len(objs))) (_("At least two objects are required for join. Objects currently selected"), len(objs)))
return 'fail' return 'fail'
fuse_tools = self.defaults["excellon_merge_fuse_tools"]
def initialize(exc_obj, app): def initialize(exc_obj, app):
ExcellonObject.merge(exc_list=objs, exc_final=exc_obj, decimals=self.decimals) ExcellonObject.merge(exc_list=objs, exc_final=exc_obj, decimals=self.decimals, fuse_tools=fuse_tools)
app.inform.emit('[success] %s.' % _("Excellon merging finished")) app.inform.emit('[success] %s.' % _("Excellon merging finished"))
self.app_obj.new_object("excellon", 'Combo_Excellon', initialize) self.app_obj.new_object("excellon", 'Combo_Excellon', initialize)

View File

@ -229,6 +229,7 @@ class FlatCAMDefaults:
"excellon_plot": True, "excellon_plot": True,
"excellon_solid": True, "excellon_solid": True,
"excellon_multicolored": False, "excellon_multicolored": False,
"excellon_merge_fuse_tools": True,
"excellon_format_upper_in": 2, "excellon_format_upper_in": 2,
"excellon_format_lower_in": 4, "excellon_format_lower_in": 4,
"excellon_format_upper_mm": 3, "excellon_format_upper_mm": 3,