From 5badd7a26bd8485107ca4d5057062c2d930c8433 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 14 Jul 2020 14:20:19 +0300 Subject: [PATCH] - Gerber UI - optimized the mark shapes to use only on ShapeCollection --- CHANGELOG.md | 6 +++++- appGUI/ObjectUI.py | 10 ++++++++++ appGUI/preferences/PreferencesUIManager.py | 1 + .../excellon/ExcellonAdvOptPrefGroupUI.py | 8 ++++++++ appObjects/FlatCAMExcellon.py | 8 ++++++++ appTools/ToolDrilling.py | 16 +++------------- defaults.py | 1 + 7 files changed, 36 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cee853c8..5ad11fa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta ================================================= +14.07.2020 + +- Drilling Tool - now there is an Excellon preference that control the autoload of tools from the Tools Database + 13.07.2020 - fixed a bug in Tools Database: due of not disconnecting the signals it created a race that was concluded into a RuntimeError exception (an dict changed size during iteration) @@ -37,7 +41,7 @@ CHANGELOG for FlatCAM beta - Isolation Tool - modified the UI; preparing to add new feature of polishing at the end of the milling job - Tool Paint - fixed an issue when launching the tool and an object other than Geometry or Excellon is selected - Geometry UI - moved the UI for polishing from Isolation Tool to Geometry UI (actually in the future Milling Tool) where it belongs -- Gerber UI - optimized the mark shapes to use only on ShapeCollection +- Gerber UI - optimized the mark shapes to use only one ShapeCollection 10.07.2020 diff --git a/appGUI/ObjectUI.py b/appGUI/ObjectUI.py index 77c1cc8a..9de7289b 100644 --- a/appGUI/ObjectUI.py +++ b/appGUI/ObjectUI.py @@ -603,6 +603,16 @@ class ExcellonObjectUI(ObjectUI): # this column is not used; reserved for future usage self.tools_table.setColumnHidden(4, True) + # Excellon Tools autoload from DB + + # Auto Load Tools from DB + self.autoload_db_cb = FCCheckBox('%s' % _("Auto load from DB")) + self.autoload_db_cb.setToolTip( + _("Automatic replacement of the tools from related application tools\n" + "with tools from DB that have a close diameter value.") + ) + self.tools_box.addWidget(self.autoload_db_cb) + # Editor self.editor_button = QtWidgets.QPushButton(_('Excellon Editor')) self.editor_button.setToolTip( diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index 08d2f908..955d9bca 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -199,6 +199,7 @@ class PreferencesUIManager: # Excellon Advanced Options "excellon_tools_table_display": self.ui.excellon_defaults_form.excellon_adv_opt_group.table_visibility_cb, + "excellon_autoload_db": self.ui.excellon_defaults_form.excellon_adv_opt_group.autoload_db_cb, # Excellon Export "excellon_exp_units": self.ui.excellon_defaults_form.excellon_exp_group.excellon_units_radio, diff --git a/appGUI/preferences/excellon/ExcellonAdvOptPrefGroupUI.py b/appGUI/preferences/excellon/ExcellonAdvOptPrefGroupUI.py index 0261b9c8..c2e5a614 100644 --- a/appGUI/preferences/excellon/ExcellonAdvOptPrefGroupUI.py +++ b/appGUI/preferences/excellon/ExcellonAdvOptPrefGroupUI.py @@ -51,4 +51,12 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI): ) grid0.addWidget(self.table_visibility_cb, 0, 0, 1, 2) + # Auto Load Tools from DB + self.autoload_db_cb = FCCheckBox('%s' % _("Auto load from DB")) + self.autoload_db_cb.setToolTip( + _("Automatic replacement of the tools from related application tools\n" + "with tools from DB that have a close diameter value.") + ) + grid0.addWidget(self.autoload_db_cb, 1, 0, 1, 2) + self.layout.addStretch() diff --git a/appObjects/FlatCAMExcellon.py b/appObjects/FlatCAMExcellon.py index a567260a..b1dd63bb 100644 --- a/appObjects/FlatCAMExcellon.py +++ b/appObjects/FlatCAMExcellon.py @@ -138,6 +138,7 @@ class ExcellonObject(FlatCAMObj, Excellon): "solid": self.ui.solid_cb, "multicolored": self.ui.multicolored_cb, + "autoload_db": self.ui.autoload_db_cb, "tooldia": self.ui.tooldia_entry, "slot_tooldia": self.ui.slot_tooldia_entry, }) @@ -152,11 +153,14 @@ class ExcellonObject(FlatCAMObj, Excellon): self.ui.tools_table.setColumnHidden(5, True) self.ui.table_visibility_cb.set_value(True) self.ui.table_visibility_cb.hide() + self.ui.autoload_db_cb.set_value(False) + self.ui.autoload_db_cb.hide() else: self.ui.level.setText('%s' % _('Advanced')) self.ui.table_visibility_cb.show() self.ui.table_visibility_cb.set_value(self.app.defaults["excellon_tools_table_display"]) self.on_table_visibility_toggle(state=self.app.defaults["excellon_tools_table_display"]) + self.ui.autoload_db_cb.show() assert isinstance(self.ui, ExcellonObjectUI), \ "Expected a ExcellonObjectUI, got %s" % type(self.ui) @@ -164,6 +168,7 @@ class ExcellonObject(FlatCAMObj, Excellon): self.ui.plot_cb.stateChanged.connect(self.on_plot_cb_click) self.ui.solid_cb.stateChanged.connect(self.on_solid_cb_click) self.ui.multicolored_cb.stateChanged.connect(self.on_multicolored_cb_click) + self.ui.autoload_db_cb.stateChanged.connect(self.on_autoload_db_toggled) # Editor self.ui.editor_button.clicked.connect(lambda: self.app.object2editor()) @@ -1042,6 +1047,9 @@ class ExcellonObject(FlatCAMObj, Excellon): self.read_form_item('multicolored') self.plot() + def on_autoload_db_toggled(self, state): + self.app.defaults["excellon_autoload_db"] = True if state else False + def on_plot_cb_click(self, *args): if self.muted_ui: return diff --git a/appTools/ToolDrilling.py b/appTools/ToolDrilling.py index 0f415d09..41662f20 100644 --- a/appTools/ToolDrilling.py +++ b/appTools/ToolDrilling.py @@ -709,7 +709,7 @@ class ToolDrilling(AppTool, Excellon): self.app.collection.set_active(self.obj_name) self.t_ui.exc_param_frame.setDisabled(False) - if self.t_ui.autoload_db_cb.get_value(): + if self.app.defaults["excellon_autoload_db"]: self.excellon_tools = self.excellon_obj.tools self.on_tool_db_load() else: @@ -1957,24 +1957,14 @@ class DrillingUI: grid0.addWidget(self.order_label, 4, 0) grid0.addWidget(self.order_radio, 4, 1) - # Auto Load Tools from DB - self.autoload_db_cb = FCCheckBox('%s:' % _("Auto Load DB")) - self.autoload_db_cb.setToolTip( - _("Automatic replacement of the tools from Tools Table\n" - "with tools from DB that have a close diameter value.") - ) - # Manual Load of Tools from DB - self.manual_load_db_btn = FCButton(_("Manual Load DB")) + self.manual_load_db_btn = FCButton(_("Manual Load from DB")) self.manual_load_db_btn.setToolTip( _("Manual replacement of the tools from Tools Table\n" "with tools from DB that have a close diameter value.") ) - grid0.addWidget(self.autoload_db_cb, 5, 0) - grid0.addWidget(self.manual_load_db_btn, 5, 1) - - self.l_ois = OptionalInputSection(self.autoload_db_cb, [self.manual_load_db_btn], logic=False) + grid0.addWidget(self.manual_load_db_btn, 5, 0, 1, 2) separator_line = QtWidgets.QFrame() separator_line.setFrameShape(QtWidgets.QFrame.HLine) diff --git a/defaults.py b/defaults.py index e5fd96c6..c5fac837 100644 --- a/defaults.py +++ b/defaults.py @@ -260,6 +260,7 @@ class FlatCAMDefaults: # Excellon Advanced options "excellon_tools_table_display": True, + "excellon_autoload_db": False, # Excellon Export "excellon_exp_units": 'INCH',