Kaynağa Gözat

- small update to NCC Tool UI

Marius Stanciu 6 yıl önce
ebeveyn
işleme
d1408a3d2c
3 değiştirilmiş dosya ile 25 ekleme ve 15 silme
  1. 4 0
      README.md
  2. 19 13
      flatcamTools/ToolNonCopperClear.py
  3. 2 2
      flatcamTools/ToolPaint.py

+ 4 - 0
README.md

@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
 
 =================================================
 
+16.02.2020
+
+- small update to NCC Tool UI
+
 15.02.2020
 
 - in Paint Tool added a new method of painting named Combo who will pass through all the methods until the polygon is cleared

+ 19 - 13
flatcamTools/ToolNonCopperClear.py

@@ -8,7 +8,7 @@
 from PyQt5 import QtWidgets, QtCore, QtGui
 
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCInputDialog, FCButton
+from flatcamGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCInputDialog, FCButton, FCComboBox
 from flatcamParsers.ParseGerber import Gerber
 
 import FlatCAMApp
@@ -70,15 +70,15 @@ class NonCopperClear(FlatCAMTool, Gerber):
         # ################################################
         # ##### Type of object to be copper cleaned ######
         # ################################################
-        self.type_obj_combo = QtWidgets.QComboBox()
-        self.type_obj_combo.addItem("Gerber")
-        self.type_obj_combo.addItem("Excellon")
-        self.type_obj_combo.addItem("Geometry")
-
-        # we get rid of item1 ("Excellon") as it is not suitable
-        self.type_obj_combo.view().setRowHidden(1, True)
-        self.type_obj_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png"))
-        self.type_obj_combo.setItemIcon(2, QtGui.QIcon(self.app.resource_location + "/geometry16.png"))
+        # self.type_obj_combo = QtWidgets.QComboBox()
+        # self.type_obj_combo.addItem("Gerber")
+        # self.type_obj_combo.addItem("Excellon")
+        # self.type_obj_combo.addItem("Geometry")
+        #
+        # # we get rid of item1 ("Excellon") as it is not suitable
+        # self.type_obj_combo.view().setRowHidden(1, True)
+        # self.type_obj_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png"))
+        # self.type_obj_combo.setItemIcon(2, QtGui.QIcon(self.app.resource_location + "/geometry16.png"))
 
         self.type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Obj Type"))
         self.type_obj_combo_label.setToolTip(
@@ -88,6 +88,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
               "of objects that will populate the 'Object' combobox.")
         )
         self.type_obj_combo_label.setMinimumWidth(60)
+
+        self.type_obj_combo = RadioSet([{'label': "Geometry", 'value': 'geometry'},
+                                        {'label': "Gerber", 'value': 'gerber'}])
+
         form_layout.addRow(self.type_obj_combo_label, self.type_obj_combo)
 
         # ################################################
@@ -683,11 +687,11 @@ class NonCopperClear(FlatCAMTool, Gerber):
         self.ncc_rest_cb.stateChanged.connect(self.on_rest_machining_check)
         self.ncc_order_radio.activated_custom[str].connect(self.on_order_changed)
 
-        self.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed)
+        self.type_obj_combo.activated_custom.connect(self.on_type_obj_index_changed)
         self.reset_button.clicked.connect(self.set_tool_ui)
 
-    def on_type_obj_index_changed(self, index):
-        obj_type = self.type_obj_combo.currentIndex()
+    def on_type_obj_index_changed(self, val):
+        obj_type = 0 if val == 'gerber' else 2
         self.object_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
         self.object_combo.setCurrentIndex(0)
 
@@ -885,6 +889,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
 
         self.tools_frame.show()
 
+        self.type_obj_combo.set_value('gerber')
+
         self.ncc_order_radio.set_value(self.app.defaults["tools_nccorder"])
         self.ncc_overlap_entry.set_value(self.app.defaults["tools_nccoverlap"])
         self.ncc_margin_entry.set_value(self.app.defaults["tools_nccmargin"])

+ 2 - 2
flatcamTools/ToolPaint.py

@@ -636,7 +636,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         self.rest_cb.stateChanged.connect(self.on_rest_machining_check)
 
         self.box_combo_type.currentIndexChanged.connect(self.on_combo_box_type)
-        self.type_obj_combo.activated_custom.connect(self.on_type_obj_index_changed)
+        self.type_obj_combo.activated_custom.connect(self.on_type_obj_changed)
         self.reset_button.clicked.connect(self.set_tool_ui)
 
         # #############################################################################
@@ -655,7 +655,7 @@ class ToolPaint(FlatCAMTool, Gerber):
             icon=QtGui.QIcon(self.app.resource_location + "/delete32.png")
         )
 
-    def on_type_obj_index_changed(self, val):
+    def on_type_obj_changed(self, val):
         obj_type = 0 if val == 'gerber' else 2
         self.obj_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
         self.obj_combo.setCurrentIndex(0)