Bladeren bron

- Gerber UI - optimized the mark shapes to use only on ShapeCollection

Marius Stanciu 5 jaren geleden
bovenliggende
commit
5badd7a26b

+ 5 - 1
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
 

+ 10 - 0
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(

+ 1 - 0
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,

+ 8 - 0
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()

+ 8 - 0
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('<span style="color:red;"><b>%s</b></span>' % _('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

+ 3 - 13
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)

+ 1 - 0
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',