- small update to NCC Tool UI

This commit is contained in:
Marius Stanciu
2020-02-16 16:50:24 +02:00
committed by Marius
parent 64912949c6
commit d1408a3d2c
3 changed files with 25 additions and 15 deletions

View File

@@ -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"])

View File

@@ -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)