diff --git a/CHANGELOG.md b/CHANGELOG.md index deb8300f..57aecec8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta 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 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 diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index 684b970a..78a04a65 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -659,7 +659,7 @@ class EvalEntry2(QtWidgets.QLineEdit): 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: /,*,+,-,% """ diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index 20e206ed..6b7d9e18 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -171,6 +171,7 @@ class PreferencesUIManager: "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_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": self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry, "excellon_format_lower_in": diff --git a/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py b/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py index c7cda214..7be28cef 100644 --- a/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py +++ b/appGUI/preferences/excellon/ExcellonGenPrefGroupUI.py @@ -263,9 +263,25 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): separator_line.setFrameShadow(QtWidgets.QFrame.Sunken) grid2.addWidget(separator_line, 11, 0, 1, 2) + # Fuse Tools + self.join_geo_label = QtWidgets.QLabel('%s:' % _('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 self.gerber_color_label = QtWidgets.QLabel('%s' % _('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 self.line_color_label = QtWidgets.QLabel('%s:' % _('Outline')) @@ -274,8 +290,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): ) self.line_color_entry = FCColorEntry() - grid2.addWidget(self.line_color_label, 13, 0) - grid2.addWidget(self.line_color_entry, 13, 1) + grid2.addWidget(self.line_color_label, 19, 0) + grid2.addWidget(self.line_color_entry, 19, 1) # Plot Fill Color self.fill_color_label = QtWidgets.QLabel('%s:' % _('Fill')) @@ -286,8 +302,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): ) self.fill_color_entry = FCColorEntry() - grid2.addWidget(self.fill_color_label, 14, 0) - grid2.addWidget(self.fill_color_entry, 14, 1) + grid2.addWidget(self.fill_color_label, 22, 0) + grid2.addWidget(self.fill_color_entry, 22, 1) # Plot Fill Transparency Level self.excellon_alpha_label = QtWidgets.QLabel('%s:' % _('Alpha')) @@ -296,8 +312,8 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI): ) self.excellon_alpha_entry = FCSliderWithSpinner(0, 255, 1) - grid2.addWidget(self.excellon_alpha_label, 15, 0) - grid2.addWidget(self.excellon_alpha_entry, 15, 1) + grid2.addWidget(self.excellon_alpha_label, 24, 0) + grid2.addWidget(self.excellon_alpha_entry, 24, 1) self.layout.addStretch() diff --git a/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py b/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py index 34658d0b..fb719908 100644 --- a/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py +++ b/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py @@ -87,14 +87,13 @@ class GeometryGenPrefGroupUI(OptionsGroupUI): grid0.addWidget(separator_line, 9, 0, 1, 2) # Fuse Tools - self.join_geo_label = QtWidgets.QLabel('%s:' % _('Join Geometry')) + self.join_geo_label = QtWidgets.QLabel('%s:' % _('Join Option')) grid0.addWidget(self.join_geo_label, 10, 0, 1, 2) self.fuse_tools_cb = FCCheckBox(_("Fuse Tools")) self.fuse_tools_cb.setToolTip( - _("When checked the joined (merged) geometry object tools\n" - "will be merged also but only if they share the same attributes,\n" - "like diameter, tool_type or type.") + _("When checked the joined (merged) object tools\n" + "will be merged also but only if they share some of their attributes.") ) grid0.addWidget(self.fuse_tools_cb, 11, 0, 1, 2) diff --git a/appTools/ToolPanelize.py b/appTools/ToolPanelize.py index 7137d415..7920b574 100644 --- a/appTools/ToolPanelize.py +++ b/appTools/ToolPanelize.py @@ -94,7 +94,7 @@ class Panelize(AppTool): def set_tool_ui(self): 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 \ 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]}) def reset_fields(self): - self.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.object_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: diff --git a/appTools/ToolPunchGerber.py b/appTools/ToolPunchGerber.py index 0edbbf9b..10865b04 100644 --- a/appTools/ToolPunchGerber.py +++ b/appTools/ToolPunchGerber.py @@ -674,8 +674,8 @@ class ToolPunchGerber(AppTool): self.app.app_obj.new_object('gerber', outname, init_func) def reset_fields(self): - self.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.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex())) + self.ui.exc_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex())) self.ui_disconnect() diff --git a/appTools/ToolSolderPaste.py b/appTools/ToolSolderPaste.py index 83d289ba..adc7d31f 100644 --- a/appTools/ToolSolderPaste.py +++ b/appTools/ToolSolderPaste.py @@ -194,7 +194,7 @@ class SolderPaste(AppTool): # populate only with preprocessor files that start with 'Paste_' if name.partition('_')[0] != 'Paste': continue - self.pp_combo.addItem(name) + self.ui.pp_combo.addItem(name) self.reset_fields() diff --git a/app_Main.py b/app_Main.py index c236ae38..39e09f1b 100644 --- a/app_Main.py +++ b/app_Main.py @@ -2301,7 +2301,7 @@ class App(QtCore.QObject): self.inform.emit('[success] %s' % _("Editor exited. Editor content saved.")) # restore GUI to the Selected TAB - # Remove anything else in the appGUI + # Remove anything else in the GUI self.ui.selected_scroll_area.takeWidget() elif isinstance(edited_obj, ExcellonObject): @@ -2310,7 +2310,7 @@ class App(QtCore.QObject): # self.exc_editor.update_options(edited_obj) # restore GUI to the Selected TAB - # Remove anything else in the appGUI + # Remove anything else in the GUI self.ui.tool_scroll_area.takeWidget() # 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: if 'slots' in edited_obj.tools[tt] and edited_obj.tools[tt]['slots']: has_slots = True - slots_in_file = 1 break if has_drills is None and has_slots is None: old_name = edited_obj.options['name'] @@ -3001,8 +3000,8 @@ class App(QtCore.QObject): "click" bugs_link = "click" - donation_link = "click" + # donation_link = "click" # Icon and title self.setWindowIcon(parent.app_icon) @@ -3431,7 +3430,7 @@ class App(QtCore.QObject): # quit app by signalling for self.kill_app() method # self.close_app_signal.emit() 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 # 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))) return 'fail' + fuse_tools = self.defaults["excellon_merge_fuse_tools"] + 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")) self.app_obj.new_object("excellon", 'Combo_Excellon', initialize) diff --git a/defaults.py b/defaults.py index 103aa659..882a26fb 100644 --- a/defaults.py +++ b/defaults.py @@ -229,6 +229,7 @@ class FlatCAMDefaults: "excellon_plot": True, "excellon_solid": True, "excellon_multicolored": False, + "excellon_merge_fuse_tools": True, "excellon_format_upper_in": 2, "excellon_format_lower_in": 4, "excellon_format_upper_mm": 3,