Jelajahi Sumber

- added property that allow the FCComboBox to update the view with the last item loaded; updated the app to use this property

Marius Stanciu 5 tahun lalu
induk
melakukan
0477a9860a

+ 4 - 4
FlatCAMObj.py

@@ -733,7 +733,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
         # set the model for the Area Exception comboboxes
         # set the model for the Area Exception comboboxes
         self.ui.obj_combo.setModel(self.app.collection)
         self.ui.obj_combo.setModel(self.app.collection)
         self.ui.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.ui.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.ui.obj_combo.setCurrentIndex(1)
+        self.ui.obj_combo.set_last = True
         self.ui.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed)
         self.ui.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed)
 
 
         self.ui.tool_type_radio.activated_custom.connect(self.on_tool_type_change)
         self.ui.tool_type_radio.activated_custom.connect(self.on_tool_type_change)
@@ -4101,21 +4101,21 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
 
 
             dia_item.setFlags(QtCore.Qt.ItemIsEnabled)
             dia_item.setFlags(QtCore.Qt.ItemIsEnabled)
 
 
-            offset_item = QtWidgets.QComboBox()
+            offset_item = FCComboBox()
             for item in self.offset_item_options:
             for item in self.offset_item_options:
                 offset_item.addItem(item)
                 offset_item.addItem(item)
             # offset_item.setStyleSheet('background-color: rgb(255,255,255)')
             # offset_item.setStyleSheet('background-color: rgb(255,255,255)')
             idx = offset_item.findText(tooluid_value['offset'])
             idx = offset_item.findText(tooluid_value['offset'])
             offset_item.setCurrentIndex(idx)
             offset_item.setCurrentIndex(idx)
 
 
-            type_item = QtWidgets.QComboBox()
+            type_item = FCComboBox()
             for item in self.type_item_options:
             for item in self.type_item_options:
                 type_item.addItem(item)
                 type_item.addItem(item)
             # type_item.setStyleSheet('background-color: rgb(255,255,255)')
             # type_item.setStyleSheet('background-color: rgb(255,255,255)')
             idx = type_item.findText(tooluid_value['type'])
             idx = type_item.findText(tooluid_value['type'])
             type_item.setCurrentIndex(idx)
             type_item.setCurrentIndex(idx)
 
 
-            tool_type_item = QtWidgets.QComboBox()
+            tool_type_item = FCComboBox()
             for item in self.tool_type_item_options:
             for item in self.tool_type_item_options:
                 tool_type_item.addItem(item)
                 tool_type_item.addItem(item)
                 # tool_type_item.setStyleSheet('background-color: rgb(255,255,255)')
                 # tool_type_item.setStyleSheet('background-color: rgb(255,255,255)')

+ 4 - 1
README.md

@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
 
 
 =================================================
 =================================================
 
 
+02.03.2020
+
+- added property that allow the FCComboBox to update the view with the last item loaded; updated the app to use this property
+
 01.03.2020
 01.03.2020
 
 
 - updated the CutOut Tool such that while adding manual gaps, the cutting geometry is updated on-the-fly if the gap size or tool diameter parameters are adjusted
 - updated the CutOut Tool such that while adding manual gaps, the cutting geometry is updated on-the-fly if the gap size or tool diameter parameters are adjusted
@@ -42,7 +46,6 @@ CAD program, and create G-Code for Isolation routing.
 - fixed an issue in Gerber Editor where the multiprocessing pool was reported as closed and an ValueError exception was raised in a certain scneraio
 - fixed an issue in Gerber Editor where the multiprocessing pool was reported as closed and an ValueError exception was raised in a certain scneraio
 - on Set Origin, Move to Origin and Move actions for Gerber and Excellon objects the source file will be also updated (the export functions will export an updated object)
 - on Set Origin, Move to Origin and Move actions for Gerber and Excellon objects the source file will be also updated (the export functions will export an updated object)
 - in FlatCAMObj.export_gerber() method took into account the possibility of polygons of type 'clear' (the ones found in the Gerber files under the LPC command)
 - in FlatCAMObj.export_gerber() method took into account the possibility of polygons of type 'clear' (the ones found in the Gerber files under the LPC command)
-
 17.02.2020
 17.02.2020
 
 
 - updated the Excellon UI to hold data for each tool
 - updated the Excellon UI to hold data for each tool

+ 19 - 4
flatcamGUI/GUIElements.py

@@ -302,7 +302,7 @@ class LengthEntry(QtWidgets.QLineEdit):
             units = raw[-2:]
             units = raw[-2:]
             units = self.scales[self.output_units][units.upper()]
             units = self.scales[self.output_units][units.upper()]
             value = raw[:-2]
             value = raw[:-2]
-            return float(eval(value))*  units
+            return float(eval(value)) * units
         except IndexError:
         except IndexError:
             value = raw
             value = raw
             return float(eval(value))
             return float(eval(value))
@@ -334,7 +334,7 @@ class FloatEntry(QtWidgets.QLineEdit):
 
 
     def mousePressEvent(self, e, Parent=None):
     def mousePressEvent(self, e, Parent=None):
         super(FloatEntry, self).mousePressEvent(e)  # required to deselect on 2e click
         super(FloatEntry, self).mousePressEvent(e)  # required to deselect on 2e click
-        if self.readyToEdit == True:
+        if self.readyToEdit is True:
             self.selectAll()
             self.selectAll()
             self.readyToEdit = False
             self.readyToEdit = False
 
 
@@ -1285,6 +1285,8 @@ class FCComboBox(QtWidgets.QComboBox):
         self.view.viewport().installEventFilter(self)
         self.view.viewport().installEventFilter(self)
         self.view.setContextMenuPolicy(Qt.CustomContextMenu)
         self.view.setContextMenuPolicy(Qt.CustomContextMenu)
 
 
+        self._set_last = False
+
         # the callback() will be called on customcontextmenu event and will be be passed 2 parameters:
         # the callback() will be called on customcontextmenu event and will be be passed 2 parameters:
         # pos = mouse right click click position
         # pos = mouse right click click position
         # self = is the combobox object itself
         # self = is the combobox object itself
@@ -1306,6 +1308,19 @@ class FCComboBox(QtWidgets.QComboBox):
     def set_value(self, val):
     def set_value(self, val):
         self.setCurrentIndex(self.findText(str(val)))
         self.setCurrentIndex(self.findText(str(val)))
 
 
+    @property
+    def set_last(self):
+        return self._set_last
+
+    @set_last.setter
+    def set_last(self, val):
+        self._set_last = val
+        if self._set_last is True:
+            self.model().rowsInserted.connect(self.on_model_changed)
+
+    def on_model_changed(self, first, last):
+        self.setCurrentIndex(last)
+
 
 
 class FCInputDialog(QtWidgets.QInputDialog):
 class FCInputDialog(QtWidgets.QInputDialog):
     def __init__(self, parent=None, ok=False, val=None, title=None, text=None, min=None, max=None, decimals=None,
     def __init__(self, parent=None, ok=False, val=None, title=None, text=None, min=None, max=None, decimals=None,
@@ -1436,7 +1451,7 @@ class FCDetachableTab(QtWidgets.QTabWidget):
         self.protect_by_name = protect_by_name if isinstance(protect_by_name, list) else None
         self.protect_by_name = protect_by_name if isinstance(protect_by_name, list) else None
 
 
         # Close all detached tabs if the application is closed explicitly
         # Close all detached tabs if the application is closed explicitly
-        QtWidgets.qApp.aboutToQuit.connect(self.closeDetachedTabs) # @UndefinedVariable
+        QtWidgets.qApp.aboutToQuit.connect(self.closeDetachedTabs)  # @UndefinedVariable
 
 
         # used by the property self.useOldIndex(param)
         # used by the property self.useOldIndex(param)
         self.use_old_index = None
         self.use_old_index = None
@@ -1916,7 +1931,7 @@ class FCDetachableTab(QtWidgets.QTabWidget):
                 self.dragInitiated = True
                 self.dragInitiated = True
 
 
             # If the current movement is a drag initiated by the left button
             # If the current movement is a drag initiated by the left button
-            if ((event.buttons() & QtCore.Qt.LeftButton)) and self.dragInitiated and self.can_be_dragged:
+            if (event.buttons() & QtCore.Qt.LeftButton) and self.dragInitiated and self.can_be_dragged:
 
 
                 # Stop the move event
                 # Stop the move event
                 finishMoveEvent = QtGui.QMouseEvent(
                 finishMoveEvent = QtGui.QMouseEvent(

+ 9 - 7
flatcamGUI/ObjectUI.py

@@ -445,15 +445,17 @@ class GerberObjectUI(ObjectUI):
         # ################################################
         # ################################################
         # ##### Type of object to be excepted ############
         # ##### Type of object to be excepted ############
         # ################################################
         # ################################################
-        self.type_obj_combo = QtWidgets.QComboBox()
-        self.type_obj_combo.addItem("Gerber")
-        self.type_obj_combo.addItem("Excellon")
-        self.type_obj_combo.addItem("Geometry")
+        self.type_obj_combo = FCComboBox()
+        self.type_obj_combo.addItems(["Gerber", "Geometry"])
+
+        # 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
         # we get rid of item1 ("Excellon") as it is not suitable
-        self.type_obj_combo.view().setRowHidden(1, True)
+        # self.type_obj_combo.view().setRowHidden(1, True)
         self.type_obj_combo.setItemIcon(0, QtGui.QIcon(self.resource_loc + "/flatcam_icon16.png"))
         self.type_obj_combo.setItemIcon(0, QtGui.QIcon(self.resource_loc + "/flatcam_icon16.png"))
-        self.type_obj_combo.setItemIcon(2, QtGui.QIcon(self.resource_loc + "/geometry16.png"))
+        self.type_obj_combo.setItemIcon(1, QtGui.QIcon(self.resource_loc + "/geometry16.png"))
 
 
         self.type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Obj Type"))
         self.type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Obj Type"))
         self.type_obj_combo_label.setToolTip(
         self.type_obj_combo_label.setToolTip(
@@ -468,7 +470,7 @@ class GerberObjectUI(ObjectUI):
         # ################################################
         # ################################################
         # ##### The object to be excepted ################
         # ##### The object to be excepted ################
         # ################################################
         # ################################################
-        self.obj_combo = QtWidgets.QComboBox()
+        self.obj_combo = FCComboBox()
 
 
         self.obj_label = QtWidgets.QLabel('%s:' % _("Object"))
         self.obj_label = QtWidgets.QLabel('%s:' % _("Object"))
         self.obj_label.setToolTip(_("Object whose area will be removed from isolation geometry."))
         self.obj_label.setToolTip(_("Object whose area will be removed from isolation geometry."))

+ 2 - 2
flatcamTools/ToolAlignObjects.py

@@ -80,7 +80,7 @@ class AlignObjects(FlatCAMTool):
         self.object_combo = FCComboBox()
         self.object_combo = FCComboBox()
         self.object_combo.setModel(self.app.collection)
         self.object_combo.setModel(self.app.collection)
         self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.object_combo.setCurrentIndex(1)
+        self.object_combo.set_last = True
 
 
         self.object_combo.setToolTip(
         self.object_combo.setToolTip(
             _("Object to be aligned.")
             _("Object to be aligned.")
@@ -116,7 +116,7 @@ class AlignObjects(FlatCAMTool):
         self.aligner_object_combo = FCComboBox()
         self.aligner_object_combo = FCComboBox()
         self.aligner_object_combo.setModel(self.app.collection)
         self.aligner_object_combo.setModel(self.app.collection)
         self.aligner_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.aligner_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.aligner_object_combo.setCurrentIndex(1)
+        self.aligner_object_combo.set_last = True
 
 
         self.aligner_object_combo.setToolTip(
         self.aligner_object_combo.setToolTip(
             _("Object to be aligned to. Aligner.")
             _("Object to be aligned to. Aligner.")

+ 2 - 2
flatcamTools/ToolCalibration.py

@@ -206,7 +206,7 @@ class ToolCalibration(FlatCAMTool):
         self.object_combo = FCComboBox()
         self.object_combo = FCComboBox()
         self.object_combo.setModel(self.app.collection)
         self.object_combo.setModel(self.app.collection)
         self.object_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
         self.object_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
-        self.object_combo.setCurrentIndex(1)
+        self.object_combo.set_last = True
 
 
         self.object_label = QtWidgets.QLabel("%s:" % _("Source object selection"))
         self.object_label = QtWidgets.QLabel("%s:" % _("Source object selection"))
         self.object_label.setToolTip(
         self.object_label.setToolTip(
@@ -628,7 +628,7 @@ class ToolCalibration(FlatCAMTool):
         )
         )
         grid_lay.addWidget(step_5, 45, 0, 1, 3)
         grid_lay.addWidget(step_5, 45, 0, 1, 3)
 
 
-        self.adj_object_type_combo = QtWidgets.QComboBox()
+        self.adj_object_type_combo = FCComboBox()
         self.adj_object_type_combo.addItems([_("Gerber"), _("Excellon"), _("Geometry")])
         self.adj_object_type_combo.addItems([_("Gerber"), _("Excellon"), _("Geometry")])
         self.adj_object_type_combo.setCurrentIndex(0)
         self.adj_object_type_combo.setCurrentIndex(0)
 
 

+ 8 - 8
flatcamTools/ToolCopperThieving.py

@@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore
 
 
 import FlatCAMApp
 import FlatCAMApp
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry
+from flatcamGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry, FCComboBox
 from FlatCAMObj import FlatCAMGerber, FlatCAMGeometry, FlatCAMExcellon
 from FlatCAMObj import FlatCAMGerber, FlatCAMGeometry, FlatCAMExcellon
 
 
 import shapely.geometry.base as base
 import shapely.geometry.base as base
@@ -66,10 +66,10 @@ class ToolCopperThieving(FlatCAMTool):
         i_grid_lay.setColumnStretch(0, 0)
         i_grid_lay.setColumnStretch(0, 0)
         i_grid_lay.setColumnStretch(1, 1)
         i_grid_lay.setColumnStretch(1, 1)
 
 
-        self.grb_object_combo = QtWidgets.QComboBox()
+        self.grb_object_combo = FCComboBox()
         self.grb_object_combo.setModel(self.app.collection)
         self.grb_object_combo.setModel(self.app.collection)
         self.grb_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.grb_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.grb_object_combo.setCurrentIndex(1)
+        self.grb_object_combo.set_last = True
 
 
         self.grbobj_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
         self.grbobj_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
         self.grbobj_label.setToolTip(
         self.grbobj_label.setToolTip(
@@ -140,7 +140,7 @@ class ToolCopperThieving(FlatCAMTool):
             _("The type of FlatCAM object to be used as copper thieving reference.\n"
             _("The type of FlatCAM object to be used as copper thieving reference.\n"
               "It can be Gerber, Excellon or Geometry.")
               "It can be Gerber, Excellon or Geometry.")
         )
         )
-        self.box_combo_type = QtWidgets.QComboBox()
+        self.box_combo_type = FCComboBox()
         self.box_combo_type.addItem(_("Reference Gerber"))
         self.box_combo_type.addItem(_("Reference Gerber"))
         self.box_combo_type.addItem(_("Reference Excellon"))
         self.box_combo_type.addItem(_("Reference Excellon"))
         self.box_combo_type.addItem(_("Reference Geometry"))
         self.box_combo_type.addItem(_("Reference Geometry"))
@@ -152,10 +152,10 @@ class ToolCopperThieving(FlatCAMTool):
         self.box_combo_label.setToolTip(
         self.box_combo_label.setToolTip(
             _("The FlatCAM object to be used as non copper clearing reference.")
             _("The FlatCAM object to be used as non copper clearing reference.")
         )
         )
-        self.box_combo = QtWidgets.QComboBox()
+        self.box_combo = FCComboBox()
         self.box_combo.setModel(self.app.collection)
         self.box_combo.setModel(self.app.collection)
         self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.box_combo.setCurrentIndex(1)
+        self.box_combo.set_last = True
 
 
         grid_lay.addWidget(self.box_combo_label, 5, 0)
         grid_lay.addWidget(self.box_combo_label, 5, 0)
         grid_lay.addWidget(self.box_combo, 5, 1)
         grid_lay.addWidget(self.box_combo, 5, 1)
@@ -417,10 +417,10 @@ class ToolCopperThieving(FlatCAMTool):
               "the pattern plating mask.")
               "the pattern plating mask.")
         )
         )
 
 
-        self.sm_object_combo = QtWidgets.QComboBox()
+        self.sm_object_combo = FCComboBox()
         self.sm_object_combo.setModel(self.app.collection)
         self.sm_object_combo.setModel(self.app.collection)
         self.sm_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.sm_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.sm_object_combo.setCurrentIndex(1)
+        self.sm_object_combo.set_last = True
 
 
         grid_lay_1.addWidget(self.sm_obj_label, 7, 0, 1, 3)
         grid_lay_1.addWidget(self.sm_obj_label, 7, 0, 1, 3)
         grid_lay_1.addWidget(self.sm_object_combo, 8, 0, 1, 3)
         grid_lay_1.addWidget(self.sm_object_combo, 8, 0, 1, 3)

+ 6 - 6
flatcamTools/ToolCutOut.py

@@ -73,7 +73,7 @@ class CutOut(FlatCAMTool):
         grid0.addWidget(self.object_label, 0, 0, 1, 2)
         grid0.addWidget(self.object_label, 0, 0, 1, 2)
 
 
         # Object kind
         # Object kind
-        self.kindlabel = QtWidgets.QLabel('%s:' % _('Object kind'))
+        self.kindlabel = QtWidgets.QLabel('%s:' % _('Kind'))
         self.kindlabel.setToolTip(
         self.kindlabel.setToolTip(
             _("Choice of what kind the object we want to cutout is.<BR>"
             _("Choice of what kind the object we want to cutout is.<BR>"
               "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
               "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
@@ -93,7 +93,7 @@ class CutOut(FlatCAMTool):
             {"label": _("Geometry"), "value": "geo"},
             {"label": _("Geometry"), "value": "geo"},
         ])
         ])
 
 
-        self.type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Object Type"))
+        self.type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Type"))
         self.type_obj_combo_label.setToolTip(
         self.type_obj_combo_label.setToolTip(
             _("Specify the type of object to be cutout.\n"
             _("Specify the type of object to be cutout.\n"
               "It can be of type: Gerber or Geometry.\n"
               "It can be of type: Gerber or Geometry.\n"
@@ -105,10 +105,10 @@ class CutOut(FlatCAMTool):
         grid0.addWidget(self.type_obj_radio, 2, 1)
         grid0.addWidget(self.type_obj_radio, 2, 1)
 
 
         # Object to be cutout
         # Object to be cutout
-        self.obj_combo = QtWidgets.QComboBox()
+        self.obj_combo = FCComboBox()
         self.obj_combo.setModel(self.app.collection)
         self.obj_combo.setModel(self.app.collection)
         self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.obj_combo.setCurrentIndex(1)
+        self.obj_combo.set_last = True
 
 
         grid0.addWidget(self.obj_combo, 3, 0, 1, 2)
         grid0.addWidget(self.obj_combo, 3, 0, 1, 2)
 
 
@@ -318,10 +318,10 @@ class CutOut(FlatCAMTool):
         self.layout.addLayout(form_layout_3)
         self.layout.addLayout(form_layout_3)
 
 
         # Manual Geo Object
         # Manual Geo Object
-        self.man_object_combo = QtWidgets.QComboBox()
+        self.man_object_combo = FCComboBox()
         self.man_object_combo.setModel(self.app.collection)
         self.man_object_combo.setModel(self.app.collection)
         self.man_object_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
         self.man_object_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
-        self.man_object_combo.setCurrentIndex(1)
+        self.man_object_combo.set_last = True
 
 
         self.man_object_label = QtWidgets.QLabel('%s:' % _("Geometry Object"))
         self.man_object_label = QtWidgets.QLabel('%s:' % _("Geometry Object"))
         self.man_object_label.setToolTip(
         self.man_object_label.setToolTip(

+ 9 - 9
flatcamTools/ToolDblSided.py

@@ -2,7 +2,7 @@
 from PyQt5 import QtWidgets, QtCore
 from PyQt5 import QtWidgets, QtCore
 
 
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, EvalEntry, FCEntry, FCButton
+from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, EvalEntry, FCEntry, FCButton, FCComboBox
 from FlatCAMObj import FlatCAMGerber, FlatCAMExcellon, FlatCAMGeometry
 from FlatCAMObj import FlatCAMGerber, FlatCAMExcellon, FlatCAMGeometry
 
 
 from numpy import Inf
 from numpy import Inf
@@ -56,10 +56,10 @@ class DblSidedTool(FlatCAMTool):
         grid_lay.addWidget(self.m_objects_label, 0, 0, 1, 2)
         grid_lay.addWidget(self.m_objects_label, 0, 0, 1, 2)
 
 
         # ## Gerber Object to mirror
         # ## Gerber Object to mirror
-        self.gerber_object_combo = QtWidgets.QComboBox()
+        self.gerber_object_combo = FCComboBox()
         self.gerber_object_combo.setModel(self.app.collection)
         self.gerber_object_combo.setModel(self.app.collection)
         self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.gerber_object_combo.setCurrentIndex(1)
+        self.gerber_object_combo.set_last = True
 
 
         self.botlay_label = QtWidgets.QLabel("%s:" % _("GERBER"))
         self.botlay_label = QtWidgets.QLabel("%s:" % _("GERBER"))
         self.botlay_label.setToolTip('%s.' % _("Gerber to be mirrored"))
         self.botlay_label.setToolTip('%s.' % _("Gerber to be mirrored"))
@@ -83,10 +83,10 @@ class DblSidedTool(FlatCAMTool):
         grid_lay.addWidget(self.mirror_gerber_button, 2, 1)
         grid_lay.addWidget(self.mirror_gerber_button, 2, 1)
 
 
         # ## Excellon Object to mirror
         # ## Excellon Object to mirror
-        self.exc_object_combo = QtWidgets.QComboBox()
+        self.exc_object_combo = FCComboBox()
         self.exc_object_combo.setModel(self.app.collection)
         self.exc_object_combo.setModel(self.app.collection)
         self.exc_object_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
         self.exc_object_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
-        self.exc_object_combo.setCurrentIndex(1)
+        self.exc_object_combo.set_last = True
 
 
         self.excobj_label = QtWidgets.QLabel("%s:" % _("EXCELLON"))
         self.excobj_label = QtWidgets.QLabel("%s:" % _("EXCELLON"))
         self.excobj_label.setToolTip(_("Excellon Object to be mirrored."))
         self.excobj_label.setToolTip(_("Excellon Object to be mirrored."))
@@ -110,10 +110,10 @@ class DblSidedTool(FlatCAMTool):
         grid_lay.addWidget(self.mirror_exc_button, 4, 1)
         grid_lay.addWidget(self.mirror_exc_button, 4, 1)
 
 
         # ## Geometry Object to mirror
         # ## Geometry Object to mirror
-        self.geo_object_combo = QtWidgets.QComboBox()
+        self.geo_object_combo = FCComboBox()
         self.geo_object_combo.setModel(self.app.collection)
         self.geo_object_combo.setModel(self.app.collection)
         self.geo_object_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
         self.geo_object_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
-        self.geo_object_combo.setCurrentIndex(1)
+        self.geo_object_combo.set_last = True
 
 
         self.geoobj_label = QtWidgets.QLabel("%s:" % _("GEOMETRY"))
         self.geoobj_label = QtWidgets.QLabel("%s:" % _("GEOMETRY"))
         self.geoobj_label.setToolTip(
         self.geoobj_label.setToolTip(
@@ -229,10 +229,10 @@ class DblSidedTool(FlatCAMTool):
         grid_lay2.addWidget(self.box_type_radio, 1, 0, 1, 2)
         grid_lay2.addWidget(self.box_type_radio, 1, 0, 1, 2)
 
 
         # Object used as BOX reference
         # Object used as BOX reference
-        self.box_combo = QtWidgets.QComboBox()
+        self.box_combo = FCComboBox()
         self.box_combo.setModel(self.app.collection)
         self.box_combo.setModel(self.app.collection)
         self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.box_combo.setCurrentIndex(1)
+        self.box_combo.set_last = True
 
 
         self.box_combo.hide()
         self.box_combo.hide()
 
 

+ 3 - 3
flatcamTools/ToolExtractDrills.py

@@ -8,7 +8,7 @@
 from PyQt5 import QtWidgets, QtCore
 from PyQt5 import QtWidgets, QtCore
 
 
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox
+from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox
 
 
 from shapely.geometry import Point
 from shapely.geometry import Point
 
 
@@ -52,10 +52,10 @@ class ToolExtractDrills(FlatCAMTool):
         grid_lay.setColumnStretch(1, 0)
         grid_lay.setColumnStretch(1, 0)
 
 
         # ## Gerber Object
         # ## Gerber Object
-        self.gerber_object_combo = QtWidgets.QComboBox()
+        self.gerber_object_combo = FCComboBox()
         self.gerber_object_combo.setModel(self.app.collection)
         self.gerber_object_combo.setModel(self.app.collection)
         self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.gerber_object_combo.setCurrentIndex(1)
+        self.gerber_object_combo.set_last = True
 
 
         self.grb_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
         self.grb_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
         self.grb_label.setToolTip('%s.' % _("Gerber from which to extract drill holes"))
         self.grb_label.setToolTip('%s.' % _("Gerber from which to extract drill holes"))

+ 5 - 5
flatcamTools/ToolFiducials.py

@@ -8,7 +8,7 @@
 from PyQt5 import QtWidgets, QtCore
 from PyQt5 import QtWidgets, QtCore
 
 
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import FCDoubleSpinner, RadioSet, EvalEntry, FCTable
+from flatcamGUI.GUIElements import FCDoubleSpinner, RadioSet, EvalEntry, FCTable, FCComboBox
 
 
 from shapely.geometry import Point, Polygon, MultiPolygon, LineString
 from shapely.geometry import Point, Polygon, MultiPolygon, LineString
 from shapely.geometry import box as box
 from shapely.geometry import box as box
@@ -250,10 +250,10 @@ class ToolFiducials(FlatCAMTool):
         grid_lay.addWidget(separator_line_1, 8, 0, 1, 2)
         grid_lay.addWidget(separator_line_1, 8, 0, 1, 2)
 
 
         # Copper Gerber object
         # Copper Gerber object
-        self.grb_object_combo = QtWidgets.QComboBox()
+        self.grb_object_combo = FCComboBox()
         self.grb_object_combo.setModel(self.app.collection)
         self.grb_object_combo.setModel(self.app.collection)
         self.grb_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.grb_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.grb_object_combo.setCurrentIndex(1)
+        self.grb_object_combo.set_last = True
 
 
         self.grbobj_label = QtWidgets.QLabel("<b>%s:</b>" % _("Copper Gerber"))
         self.grbobj_label = QtWidgets.QLabel("<b>%s:</b>" % _("Copper Gerber"))
         self.grbobj_label.setToolTip(
         self.grbobj_label.setToolTip(
@@ -286,10 +286,10 @@ class ToolFiducials(FlatCAMTool):
         self.sm_object_label.setToolTip(
         self.sm_object_label.setToolTip(
             _("The Soldermask Gerber object.")
             _("The Soldermask Gerber object.")
         )
         )
-        self.sm_object_combo = QtWidgets.QComboBox()
+        self.sm_object_combo = FCComboBox()
         self.sm_object_combo.setModel(self.app.collection)
         self.sm_object_combo.setModel(self.app.collection)
         self.sm_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.sm_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.sm_object_combo.setCurrentIndex(1)
+        self.sm_object_combo.set_last = True
 
 
         grid_lay.addWidget(self.sm_object_label, 13, 0, 1, 2)
         grid_lay.addWidget(self.sm_object_label, 13, 0, 1, 2)
         grid_lay.addWidget(self.sm_object_combo, 14, 0, 1, 2)
         grid_lay.addWidget(self.sm_object_combo, 14, 0, 1, 2)

+ 21 - 18
flatcamTools/ToolFilm.py

@@ -65,15 +65,16 @@ class Film(FlatCAMTool):
         grid0.setColumnStretch(1, 1)
         grid0.setColumnStretch(1, 1)
 
 
         # Type of object for which to create the film
         # Type of object for which to create the film
-        self.tf_type_obj_combo = QtWidgets.QComboBox()
-        self.tf_type_obj_combo.addItem("Gerber")
-        self.tf_type_obj_combo.addItem("Excellon")
-        self.tf_type_obj_combo.addItem("Geometry")
+        self.tf_type_obj_combo = FCComboBox()
+        self.tf_type_obj_combo.addItems(["Gerber", "Geometry"])
+        # self.tf_type_obj_combo.addItem("Gerber")
+        # self.tf_type_obj_combo.addItem("Excellon")
+        # self.tf_type_obj_combo.addItem("Geometry")
 
 
         # we get rid of item1 ("Excellon") as it is not suitable for creating film
         # we get rid of item1 ("Excellon") as it is not suitable for creating film
-        self.tf_type_obj_combo.view().setRowHidden(1, True)
+        # self.tf_type_obj_combo.view().setRowHidden(1, True)
         self.tf_type_obj_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png"))
         self.tf_type_obj_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png"))
-        self.tf_type_obj_combo.setItemIcon(2, QtGui.QIcon(self.app.resource_location + "/geometry16.png"))
+        self.tf_type_obj_combo.setItemIcon(1, QtGui.QIcon(self.app.resource_location + "/geometry16.png"))
 
 
         self.tf_type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Object Type"))
         self.tf_type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Object Type"))
         self.tf_type_obj_combo_label.setToolTip(
         self.tf_type_obj_combo_label.setToolTip(
@@ -86,10 +87,10 @@ class Film(FlatCAMTool):
         grid0.addWidget(self.tf_type_obj_combo, 0, 1)
         grid0.addWidget(self.tf_type_obj_combo, 0, 1)
 
 
         # List of objects for which we can create the film
         # List of objects for which we can create the film
-        self.tf_object_combo = QtWidgets.QComboBox()
+        self.tf_object_combo = FCComboBox()
         self.tf_object_combo.setModel(self.app.collection)
         self.tf_object_combo.setModel(self.app.collection)
         self.tf_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.tf_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.tf_object_combo.setCurrentIndex(1)
+        self.tf_object_combo.set_last = True
 
 
         self.tf_object_label = QtWidgets.QLabel('%s:' % _("Film Object"))
         self.tf_object_label = QtWidgets.QLabel('%s:' % _("Film Object"))
         self.tf_object_label.setToolTip(
         self.tf_object_label.setToolTip(
@@ -100,15 +101,17 @@ class Film(FlatCAMTool):
 
 
         # Type of Box Object to be used as an envelope for film creation
         # Type of Box Object to be used as an envelope for film creation
         # Within this we can create negative
         # Within this we can create negative
-        self.tf_type_box_combo = QtWidgets.QComboBox()
-        self.tf_type_box_combo.addItem("Gerber")
-        self.tf_type_box_combo.addItem("Excellon")
-        self.tf_type_box_combo.addItem("Geometry")
+        self.tf_type_box_combo = FCComboBox()
+        self.tf_type_box_combo.addItems(["Gerber", "Geometry"])
+
+        # self.tf_type_box_combo.addItem("Gerber")
+        # self.tf_type_box_combo.addItem("Excellon")
+        # self.tf_type_box_combo.addItem("Geometry")
 
 
         # we get rid of item1 ("Excellon") as it is not suitable for box when creating film
         # we get rid of item1 ("Excellon") as it is not suitable for box when creating film
-        self.tf_type_box_combo.view().setRowHidden(1, True)
+        # self.tf_type_box_combo.view().setRowHidden(1, True)
         self.tf_type_box_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png"))
         self.tf_type_box_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png"))
-        self.tf_type_box_combo.setItemIcon(2, QtGui.QIcon(self.app.resource_location + "/geometry16.png"))
+        self.tf_type_box_combo.setItemIcon(1, QtGui.QIcon(self.app.resource_location + "/geometry16.png"))
 
 
         self.tf_type_box_combo_label = QtWidgets.QLabel(_("Box Type:"))
         self.tf_type_box_combo_label = QtWidgets.QLabel(_("Box Type:"))
         self.tf_type_box_combo_label.setToolTip(
         self.tf_type_box_combo_label.setToolTip(
@@ -121,10 +124,10 @@ class Film(FlatCAMTool):
         grid0.addWidget(self.tf_type_box_combo, 2, 1)
         grid0.addWidget(self.tf_type_box_combo, 2, 1)
 
 
         # Box
         # Box
-        self.tf_box_combo = QtWidgets.QComboBox()
+        self.tf_box_combo = FCComboBox()
         self.tf_box_combo.setModel(self.app.collection)
         self.tf_box_combo.setModel(self.app.collection)
         self.tf_box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.tf_box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.tf_box_combo.setCurrentIndex(1)
+        self.tf_box_combo.set_last = True
 
 
         self.tf_box_combo_label = QtWidgets.QLabel('%s:' % _("Box Object"))
         self.tf_box_combo_label = QtWidgets.QLabel('%s:' % _("Box Object"))
         self.tf_box_combo_label.setToolTip(
         self.tf_box_combo_label.setToolTip(
@@ -366,10 +369,10 @@ class Film(FlatCAMTool):
         self.exc_label.setToolTip(
         self.exc_label.setToolTip(
             _("Remove the geometry of Excellon from the Film to create the holes in pads.")
             _("Remove the geometry of Excellon from the Film to create the holes in pads.")
         )
         )
-        self.exc_combo = QtWidgets.QComboBox()
+        self.exc_combo = FCComboBox()
         self.exc_combo.setModel(self.app.collection)
         self.exc_combo.setModel(self.app.collection)
         self.exc_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
         self.exc_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
-        self.exc_combo.setCurrentIndex(1)
+        self.exc_combo.set_last = True
         punch_grid.addWidget(self.exc_label, 1, 0)
         punch_grid.addWidget(self.exc_label, 1, 0)
         punch_grid.addWidget(self.exc_combo, 1, 1)
         punch_grid.addWidget(self.exc_combo, 1, 1)
 
 

+ 3 - 3
flatcamTools/ToolInvertGerber.py

@@ -8,7 +8,7 @@
 from PyQt5 import QtWidgets, QtCore
 from PyQt5 import QtWidgets, QtCore
 
 
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import FCButton, FCDoubleSpinner, RadioSet
+from flatcamGUI.GUIElements import FCButton, FCDoubleSpinner, RadioSet, FCComboBox
 
 
 from shapely.geometry import box
 from shapely.geometry import box
 
 
@@ -63,10 +63,10 @@ class ToolInvertGerber(FlatCAMTool):
         grid0.addWidget(QtWidgets.QLabel(''), 0, 0, 1, 2)
         grid0.addWidget(QtWidgets.QLabel(''), 0, 0, 1, 2)
 
 
         # Target Gerber Object
         # Target Gerber Object
-        self.gerber_combo = QtWidgets.QComboBox()
+        self.gerber_combo = FCComboBox()
         self.gerber_combo.setModel(self.app.collection)
         self.gerber_combo.setModel(self.app.collection)
         self.gerber_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.gerber_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.gerber_combo.setCurrentIndex(1)
+        self.gerber_combo.set_last = True
 
 
         self.gerber_label = QtWidgets.QLabel('<b>%s:</b>' % _("GERBER"))
         self.gerber_label = QtWidgets.QLabel('<b>%s:</b>' % _("GERBER"))
         self.gerber_label.setToolTip(
         self.gerber_label.setToolTip(

+ 3 - 2
flatcamTools/ToolNCC.py

@@ -101,7 +101,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
         self.object_combo = FCComboBox()
         self.object_combo = FCComboBox()
         self.object_combo.setModel(self.app.collection)
         self.object_combo.setModel(self.app.collection)
         self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.object_combo.setCurrentIndex(1)
+        # self.object_combo.setCurrentIndex(1)
+        self.object_combo.set_last = True
 
 
         self.object_label = QtWidgets.QLabel('%s:' % _("Object"))
         self.object_label = QtWidgets.QLabel('%s:' % _("Object"))
         self.object_label.setToolTip(_("Object to be cleared of excess copper."))
         self.object_label.setToolTip(_("Object to be cleared of excess copper."))
@@ -563,7 +564,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
         self.box_combo = FCComboBox()
         self.box_combo = FCComboBox()
         self.box_combo.setModel(self.app.collection)
         self.box_combo.setModel(self.app.collection)
         self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.box_combo.setCurrentIndex(1)
+        self.box_combo.set_last = True
         form1.addRow(self.box_combo_label, self.box_combo)
         form1.addRow(self.box_combo_label, self.box_combo)
 
 
         self.box_combo.hide()
         self.box_combo.hide()

+ 3 - 3
flatcamTools/ToolOptimal.py

@@ -8,7 +8,7 @@
 from PyQt5 import QtWidgets, QtCore, QtGui
 from PyQt5 import QtWidgets, QtCore, QtGui
 
 
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import OptionalHideInputSection, FCTextArea, FCEntry, FCSpinner, FCCheckBox
+from flatcamGUI.GUIElements import OptionalHideInputSection, FCTextArea, FCEntry, FCSpinner, FCCheckBox, FCComboBox
 from FlatCAMObj import FlatCAMGerber
 from FlatCAMObj import FlatCAMGerber
 import FlatCAMApp
 import FlatCAMApp
 
 
@@ -63,10 +63,10 @@ class ToolOptimal(FlatCAMTool):
         form_lay.addRow(QtWidgets.QLabel(""))
         form_lay.addRow(QtWidgets.QLabel(""))
 
 
         # ## Gerber Object to mirror
         # ## Gerber Object to mirror
-        self.gerber_object_combo = QtWidgets.QComboBox()
+        self.gerber_object_combo = FCComboBox()
         self.gerber_object_combo.setModel(self.app.collection)
         self.gerber_object_combo.setModel(self.app.collection)
         self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.gerber_object_combo.setCurrentIndex(1)
+        self.gerber_object_combo.set_last = True
 
 
         self.gerber_object_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
         self.gerber_object_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
         self.gerber_object_label.setToolTip(
         self.gerber_object_label.setToolTip(

+ 6 - 6
flatcamTools/ToolPaint.py

@@ -94,10 +94,10 @@ class ToolPaint(FlatCAMTool, Gerber):
         # ################################################
         # ################################################
         # ##### The object to be painted #################
         # ##### The object to be painted #################
         # ################################################
         # ################################################
-        self.obj_combo = QtWidgets.QComboBox()
+        self.obj_combo = FCComboBox()
         self.obj_combo.setModel(self.app.collection)
         self.obj_combo.setModel(self.app.collection)
         self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.obj_combo.setCurrentIndex(1)
+        self.obj_combo.set_last = True
 
 
         self.object_label = QtWidgets.QLabel('%s:' % _("Object"))
         self.object_label = QtWidgets.QLabel('%s:' % _("Object"))
         self.object_label.setToolTip(_("Object to be painted."))
         self.object_label.setToolTip(_("Object to be painted."))
@@ -496,7 +496,7 @@ class ToolPaint(FlatCAMTool, Gerber):
             _("The type of FlatCAM object to be used as paint reference.\n"
             _("The type of FlatCAM object to be used as paint reference.\n"
               "It can be Gerber, Excellon or Geometry.")
               "It can be Gerber, Excellon or Geometry.")
         )
         )
-        self.box_combo_type = QtWidgets.QComboBox()
+        self.box_combo_type = FCComboBox()
         self.box_combo_type.addItem(_("Reference Gerber"))
         self.box_combo_type.addItem(_("Reference Gerber"))
         self.box_combo_type.addItem(_("Reference Excellon"))
         self.box_combo_type.addItem(_("Reference Excellon"))
         self.box_combo_type.addItem(_("Reference Geometry"))
         self.box_combo_type.addItem(_("Reference Geometry"))
@@ -506,10 +506,10 @@ class ToolPaint(FlatCAMTool, Gerber):
         self.box_combo_label.setToolTip(
         self.box_combo_label.setToolTip(
             _("The FlatCAM object to be used as non copper clearing reference.")
             _("The FlatCAM object to be used as non copper clearing reference.")
         )
         )
-        self.box_combo = QtWidgets.QComboBox()
+        self.box_combo = FCComboBox()
         self.box_combo.setModel(self.app.collection)
         self.box_combo.setModel(self.app.collection)
         self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.box_combo.setCurrentIndex(1)
+        self.box_combo.set_last = True
         form1.addRow(self.box_combo_label, self.box_combo)
         form1.addRow(self.box_combo_label, self.box_combo)
 
 
         self.box_combo.hide()
         self.box_combo.hide()
@@ -1058,7 +1058,7 @@ class ToolPaint(FlatCAMTool, Gerber):
 
 
                     dia.setFlags(QtCore.Qt.ItemIsEnabled)
                     dia.setFlags(QtCore.Qt.ItemIsEnabled)
 
 
-                    tool_type_item = QtWidgets.QComboBox()
+                    tool_type_item = FCComboBox()
                     for item in self.tool_type_item_options:
                     for item in self.tool_type_item_options:
                         tool_type_item.addItem(item)
                         tool_type_item.addItem(item)
                         # tool_type_item.setStyleSheet('background-color: rgb(255,255,255)')
                         # tool_type_item.setStyleSheet('background-color: rgb(255,255,255)')

+ 13 - 12
flatcamTools/ToolPanelize.py

@@ -8,7 +8,7 @@
 from PyQt5 import QtWidgets, QtGui, QtCore
 from PyQt5 import QtWidgets, QtGui, QtCore
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
 
 
-from flatcamGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet, FCCheckBox, OptionalInputSection
+from flatcamGUI.GUIElements import FCSpinner, FCDoubleSpinner, RadioSet, FCCheckBox, OptionalInputSection, FCComboBox
 from FlatCAMObj import FlatCAMGeometry, FlatCAMGerber, FlatCAMExcellon
 from FlatCAMObj import FlatCAMGeometry, FlatCAMGerber, FlatCAMExcellon
 import FlatCAMApp
 import FlatCAMApp
 from copy import deepcopy
 from copy import deepcopy
@@ -66,7 +66,7 @@ class Panelize(FlatCAMTool):
         self.layout.addLayout(form_layout_0)
         self.layout.addLayout(form_layout_0)
 
 
         # Type of object to be panelized
         # Type of object to be panelized
-        self.type_obj_combo = QtWidgets.QComboBox()
+        self.type_obj_combo = FCComboBox()
         self.type_obj_combo.addItem("Gerber")
         self.type_obj_combo.addItem("Gerber")
         self.type_obj_combo.addItem("Excellon")
         self.type_obj_combo.addItem("Excellon")
         self.type_obj_combo.addItem("Geometry")
         self.type_obj_combo.addItem("Geometry")
@@ -80,10 +80,10 @@ class Panelize(FlatCAMTool):
         form_layout_0.addRow(self.type_object_label, self.type_obj_combo)
         form_layout_0.addRow(self.type_object_label, self.type_obj_combo)
 
 
         # Object to be panelized
         # Object to be panelized
-        self.object_combo = QtWidgets.QComboBox()
+        self.object_combo = FCComboBox()
         self.object_combo.setModel(self.app.collection)
         self.object_combo.setModel(self.app.collection)
         self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.object_combo.setCurrentIndex(1)
+        self.object_combo.set_last = True
 
 
         self.object_combo.setToolTip(
         self.object_combo.setToolTip(
             _("Object to be panelized. This means that it will\n"
             _("Object to be panelized. This means that it will\n"
@@ -114,15 +114,16 @@ class Panelize(FlatCAMTool):
         form_layout.addRow(self.reference_radio)
         form_layout.addRow(self.reference_radio)
 
 
         # Type of Box Object to be used as an envelope for panelization
         # Type of Box Object to be used as an envelope for panelization
-        self.type_box_combo = QtWidgets.QComboBox()
-        self.type_box_combo.addItem("Gerber")
-        self.type_box_combo.addItem("Excellon")
-        self.type_box_combo.addItem("Geometry")
+        self.type_box_combo = FCComboBox()
+        self.type_box_combo.addItems(["Gerber", "Geometry"])
+        # self.type_box_combo.addItem("Gerber")
+        # self.type_box_combo.addItem("Excellon")
+        # self.type_box_combo.addItem("Geometry")
 
 
         # we get rid of item1 ("Excellon") as it is not suitable for use as a "box" for panelizing
         # we get rid of item1 ("Excellon") as it is not suitable for use as a "box" for panelizing
-        self.type_box_combo.view().setRowHidden(1, True)
+        # self.type_box_combo.view().setRowHidden(1, True)
         self.type_box_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png"))
         self.type_box_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png"))
-        self.type_box_combo.setItemIcon(2, QtGui.QIcon(self.app.resource_location + "/geometry16.png"))
+        self.type_box_combo.setItemIcon(1, QtGui.QIcon(self.app.resource_location + "/geometry16.png"))
 
 
         self.type_box_combo_label = QtWidgets.QLabel('%s:' % _("Box Type"))
         self.type_box_combo_label = QtWidgets.QLabel('%s:' % _("Box Type"))
         self.type_box_combo_label.setToolTip(
         self.type_box_combo_label.setToolTip(
@@ -134,10 +135,10 @@ class Panelize(FlatCAMTool):
         form_layout.addRow(self.type_box_combo_label, self.type_box_combo)
         form_layout.addRow(self.type_box_combo_label, self.type_box_combo)
 
 
         # Box
         # Box
-        self.box_combo = QtWidgets.QComboBox()
+        self.box_combo = FCComboBox()
         self.box_combo.setModel(self.app.collection)
         self.box_combo.setModel(self.app.collection)
         self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.box_combo.setCurrentIndex(1)
+        self.box_combo.set_last = True
 
 
         self.box_combo.setToolTip(
         self.box_combo.setToolTip(
             _("The actual object that is used a container for the\n "
             _("The actual object that is used a container for the\n "

+ 5 - 5
flatcamTools/ToolPunchGerber.py

@@ -8,7 +8,7 @@
 from PyQt5 import QtCore, QtWidgets
 from PyQt5 import QtCore, QtWidgets
 
 
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox
+from flatcamGUI.GUIElements import RadioSet, FCDoubleSpinner, FCCheckBox, FCComboBox
 
 
 from copy import deepcopy
 from copy import deepcopy
 import logging
 import logging
@@ -55,10 +55,10 @@ class ToolPunchGerber(FlatCAMTool):
         grid_lay.setColumnStretch(1, 0)
         grid_lay.setColumnStretch(1, 0)
 
 
         # ## Gerber Object
         # ## Gerber Object
-        self.gerber_object_combo = QtWidgets.QComboBox()
+        self.gerber_object_combo = FCComboBox()
         self.gerber_object_combo.setModel(self.app.collection)
         self.gerber_object_combo.setModel(self.app.collection)
         self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.gerber_object_combo.setCurrentIndex(1)
+        self.gerber_object_combo.set_last = True
 
 
         self.grb_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
         self.grb_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
         self.grb_label.setToolTip('%s.' % _("Gerber into which to punch holes"))
         self.grb_label.setToolTip('%s.' % _("Gerber into which to punch holes"))
@@ -165,10 +165,10 @@ class ToolPunchGerber(FlatCAMTool):
             _("Remove the geometry of Excellon from the Gerber to create the holes in pads.")
             _("Remove the geometry of Excellon from the Gerber to create the holes in pads.")
         )
         )
 
 
-        self.exc_combo = QtWidgets.QComboBox()
+        self.exc_combo = FCComboBox()
         self.exc_combo.setModel(self.app.collection)
         self.exc_combo.setModel(self.app.collection)
         self.exc_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
         self.exc_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
-        self.exc_combo.setCurrentIndex(1)
+        self.exc_combo.set_last = True
 
 
         grid0.addWidget(self.exc_label, 3, 0, 1, 2)
         grid0.addWidget(self.exc_label, 3, 0, 1, 2)
         grid0.addWidget(self.exc_combo, 4, 0, 1, 2)
         grid0.addWidget(self.exc_combo, 4, 0, 1, 2)

+ 3 - 3
flatcamTools/ToolQRCode.py

@@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui
 from PyQt5.QtCore import Qt
 from PyQt5.QtCore import Qt
 
 
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import RadioSet, FCTextArea, FCSpinner, FCEntry, FCCheckBox
+from flatcamGUI.GUIElements import RadioSet, FCTextArea, FCSpinner, FCEntry, FCCheckBox, FCComboBox
 from flatcamParsers.ParseSVG import *
 from flatcamParsers.ParseSVG import *
 
 
 from shapely.geometry.base import *
 from shapely.geometry.base import *
@@ -69,10 +69,10 @@ class QRCode(FlatCAMTool):
         i_grid_lay.setColumnStretch(0, 0)
         i_grid_lay.setColumnStretch(0, 0)
         i_grid_lay.setColumnStretch(1, 1)
         i_grid_lay.setColumnStretch(1, 1)
 
 
-        self.grb_object_combo = QtWidgets.QComboBox()
+        self.grb_object_combo = FCComboBox()
         self.grb_object_combo.setModel(self.app.collection)
         self.grb_object_combo.setModel(self.app.collection)
         self.grb_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.grb_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.grb_object_combo.setCurrentIndex(1)
+        self.grb_object_combo.set_last = True
 
 
         self.grbobj_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
         self.grbobj_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
         self.grbobj_label.setToolTip(
         self.grbobj_label.setToolTip(

+ 19 - 19
flatcamTools/ToolRulesCheck.py

@@ -8,7 +8,7 @@
 from PyQt5 import QtWidgets
 from PyQt5 import QtWidgets
 
 
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection
+from flatcamGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection, FCComboBox
 from copy import deepcopy
 from copy import deepcopy
 
 
 from FlatCAMPool import *
 from FlatCAMPool import *
@@ -69,10 +69,10 @@ class RulesCheck(FlatCAMTool):
         self.grid_layout.addWidget(self.all_obj_cb, 0, 2)
         self.grid_layout.addWidget(self.all_obj_cb, 0, 2)
 
 
         # Copper Top object
         # Copper Top object
-        self.copper_t_object = QtWidgets.QComboBox()
+        self.copper_t_object = FCComboBox()
         self.copper_t_object.setModel(self.app.collection)
         self.copper_t_object.setModel(self.app.collection)
         self.copper_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.copper_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.copper_t_object.setCurrentIndex(1)
+        self.copper_t_object.set_last = True
 
 
         self.copper_t_object_lbl = QtWidgets.QLabel('%s:' % _("Top"))
         self.copper_t_object_lbl = QtWidgets.QLabel('%s:' % _("Top"))
         self.copper_t_object_lbl.setToolTip(
         self.copper_t_object_lbl.setToolTip(
@@ -86,10 +86,10 @@ class RulesCheck(FlatCAMTool):
         self.grid_layout.addWidget(self.copper_t_cb, 1, 2)
         self.grid_layout.addWidget(self.copper_t_cb, 1, 2)
 
 
         # Copper Bottom object
         # Copper Bottom object
-        self.copper_b_object = QtWidgets.QComboBox()
+        self.copper_b_object = FCComboBox()
         self.copper_b_object.setModel(self.app.collection)
         self.copper_b_object.setModel(self.app.collection)
         self.copper_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.copper_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.copper_b_object.setCurrentIndex(1)
+        self.copper_b_object.set_last = True
 
 
         self.copper_b_object_lbl = QtWidgets.QLabel('%s:' % _("Bottom"))
         self.copper_b_object_lbl = QtWidgets.QLabel('%s:' % _("Bottom"))
         self.copper_b_object_lbl.setToolTip(
         self.copper_b_object_lbl.setToolTip(
@@ -103,10 +103,10 @@ class RulesCheck(FlatCAMTool):
         self.grid_layout.addWidget(self.copper_b_cb, 2, 2)
         self.grid_layout.addWidget(self.copper_b_cb, 2, 2)
 
 
         # SolderMask Top object
         # SolderMask Top object
-        self.sm_t_object = QtWidgets.QComboBox()
+        self.sm_t_object = FCComboBox()
         self.sm_t_object.setModel(self.app.collection)
         self.sm_t_object.setModel(self.app.collection)
         self.sm_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.sm_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.sm_t_object.setCurrentIndex(1)
+        self.sm_t_object.set_last = True
 
 
         self.sm_t_object_lbl = QtWidgets.QLabel('%s:' % _("SM Top"))
         self.sm_t_object_lbl = QtWidgets.QLabel('%s:' % _("SM Top"))
         self.sm_t_object_lbl.setToolTip(
         self.sm_t_object_lbl.setToolTip(
@@ -120,10 +120,10 @@ class RulesCheck(FlatCAMTool):
         self.grid_layout.addWidget(self.sm_t_cb, 3, 2)
         self.grid_layout.addWidget(self.sm_t_cb, 3, 2)
 
 
         # SolderMask Bottom object
         # SolderMask Bottom object
-        self.sm_b_object = QtWidgets.QComboBox()
+        self.sm_b_object = FCComboBox()
         self.sm_b_object.setModel(self.app.collection)
         self.sm_b_object.setModel(self.app.collection)
         self.sm_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.sm_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.sm_b_object.setCurrentIndex(1)
+        self.sm_b_object.set_last = True
 
 
         self.sm_b_object_lbl = QtWidgets.QLabel('%s:' % _("SM Bottom"))
         self.sm_b_object_lbl = QtWidgets.QLabel('%s:' % _("SM Bottom"))
         self.sm_b_object_lbl.setToolTip(
         self.sm_b_object_lbl.setToolTip(
@@ -137,10 +137,10 @@ class RulesCheck(FlatCAMTool):
         self.grid_layout.addWidget(self.sm_b_cb, 4, 2)
         self.grid_layout.addWidget(self.sm_b_cb, 4, 2)
 
 
         # SilkScreen Top object
         # SilkScreen Top object
-        self.ss_t_object = QtWidgets.QComboBox()
+        self.ss_t_object = FCComboBox()
         self.ss_t_object.setModel(self.app.collection)
         self.ss_t_object.setModel(self.app.collection)
         self.ss_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.ss_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.ss_t_object.setCurrentIndex(1)
+        self.ss_t_object.set_last = True
 
 
         self.ss_t_object_lbl = QtWidgets.QLabel('%s:' % _("Silk Top"))
         self.ss_t_object_lbl = QtWidgets.QLabel('%s:' % _("Silk Top"))
         self.ss_t_object_lbl.setToolTip(
         self.ss_t_object_lbl.setToolTip(
@@ -154,10 +154,10 @@ class RulesCheck(FlatCAMTool):
         self.grid_layout.addWidget(self.ss_t_cb, 5, 2)
         self.grid_layout.addWidget(self.ss_t_cb, 5, 2)
 
 
         # SilkScreen Bottom object
         # SilkScreen Bottom object
-        self.ss_b_object = QtWidgets.QComboBox()
+        self.ss_b_object = FCComboBox()
         self.ss_b_object.setModel(self.app.collection)
         self.ss_b_object.setModel(self.app.collection)
         self.ss_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.ss_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.ss_b_object.setCurrentIndex(1)
+        self.ss_b_object.set_last = True
 
 
         self.ss_b_object_lbl = QtWidgets.QLabel('%s:' % _("Silk Bottom"))
         self.ss_b_object_lbl = QtWidgets.QLabel('%s:' % _("Silk Bottom"))
         self.ss_b_object_lbl.setToolTip(
         self.ss_b_object_lbl.setToolTip(
@@ -171,10 +171,10 @@ class RulesCheck(FlatCAMTool):
         self.grid_layout.addWidget(self.ss_b_cb, 6, 2)
         self.grid_layout.addWidget(self.ss_b_cb, 6, 2)
 
 
         # Outline object
         # Outline object
-        self.outline_object = QtWidgets.QComboBox()
+        self.outline_object = FCComboBox()
         self.outline_object.setModel(self.app.collection)
         self.outline_object.setModel(self.app.collection)
         self.outline_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.outline_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.outline_object.setCurrentIndex(1)
+        self.outline_object.set_last = True
 
 
         self.outline_object_lbl = QtWidgets.QLabel('%s:' % _("Outline"))
         self.outline_object_lbl = QtWidgets.QLabel('%s:' % _("Outline"))
         self.outline_object_lbl.setToolTip(
         self.outline_object_lbl.setToolTip(
@@ -197,10 +197,10 @@ class RulesCheck(FlatCAMTool):
         self.grid_layout.addWidget(self.excellon_title_lbl, 9, 0, 1, 3)
         self.grid_layout.addWidget(self.excellon_title_lbl, 9, 0, 1, 3)
 
 
         # Excellon 1 object
         # Excellon 1 object
-        self.e1_object = QtWidgets.QComboBox()
+        self.e1_object = FCComboBox()
         self.e1_object.setModel(self.app.collection)
         self.e1_object.setModel(self.app.collection)
         self.e1_object.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
         self.e1_object.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
-        self.e1_object.setCurrentIndex(1)
+        self.e1_object.set_last = True
 
 
         self.e1_object_lbl = QtWidgets.QLabel('%s:' % _("Excellon 1"))
         self.e1_object_lbl = QtWidgets.QLabel('%s:' % _("Excellon 1"))
         self.e1_object_lbl.setToolTip(
         self.e1_object_lbl.setToolTip(
@@ -215,10 +215,10 @@ class RulesCheck(FlatCAMTool):
         self.grid_layout.addWidget(self.e1_cb, 10, 2)
         self.grid_layout.addWidget(self.e1_cb, 10, 2)
 
 
         # Excellon 2 object
         # Excellon 2 object
-        self.e2_object = QtWidgets.QComboBox()
+        self.e2_object = FCComboBox()
         self.e2_object.setModel(self.app.collection)
         self.e2_object.setModel(self.app.collection)
         self.e2_object.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
         self.e2_object.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
-        self.e2_object.setCurrentIndex(1)
+        self.e2_object.set_last = True
 
 
         self.e2_object_lbl = QtWidgets.QLabel('%s:' % _("Excellon 2"))
         self.e2_object_lbl = QtWidgets.QLabel('%s:' % _("Excellon 2"))
         self.e2_object_lbl.setToolTip(
         self.e2_object_lbl.setToolTip(

+ 3 - 3
flatcamTools/ToolSolderPaste.py

@@ -61,7 +61,7 @@ class SolderPaste(FlatCAMTool):
         self.obj_combo = FCComboBox(callback=self.on_rmb_combo)
         self.obj_combo = FCComboBox(callback=self.on_rmb_combo)
         self.obj_combo.setModel(self.app.collection)
         self.obj_combo.setModel(self.app.collection)
         self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.obj_combo.setCurrentIndex(1)
+        self.obj_combo.set_last = True
 
 
         self.object_label = QtWidgets.QLabel("Gerber:   ")
         self.object_label = QtWidgets.QLabel("Gerber:   ")
         self.object_label.setToolTip(
         self.object_label.setToolTip(
@@ -383,7 +383,7 @@ class SolderPaste(FlatCAMTool):
         self.geo_obj_combo = FCComboBox(callback=self.on_rmb_combo)
         self.geo_obj_combo = FCComboBox(callback=self.on_rmb_combo)
         self.geo_obj_combo.setModel(self.app.collection)
         self.geo_obj_combo.setModel(self.app.collection)
         self.geo_obj_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
         self.geo_obj_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
-        self.geo_obj_combo.setCurrentIndex(1)
+        self.geo_obj_combo.set_last = True
 
 
         self.geo_object_label = QtWidgets.QLabel('%s:' % _("Geo Result"))
         self.geo_object_label = QtWidgets.QLabel('%s:' % _("Geo Result"))
         self.geo_object_label.setToolTip(
         self.geo_object_label.setToolTip(
@@ -416,7 +416,7 @@ class SolderPaste(FlatCAMTool):
         self.cnc_obj_combo = FCComboBox(callback=self.on_rmb_combo)
         self.cnc_obj_combo = FCComboBox(callback=self.on_rmb_combo)
         self.cnc_obj_combo.setModel(self.app.collection)
         self.cnc_obj_combo.setModel(self.app.collection)
         self.cnc_obj_combo.setRootModelIndex(self.app.collection.index(3, 0, QtCore.QModelIndex()))
         self.cnc_obj_combo.setRootModelIndex(self.app.collection.index(3, 0, QtCore.QModelIndex()))
-        self.cnc_obj_combo.setCurrentIndex(1)
+        self.cnc_obj_combo.set_last = True
 
 
         self.cnc_object_label = QtWidgets.QLabel('%s:' % _("CNC Result"))
         self.cnc_object_label = QtWidgets.QLabel('%s:' % _("CNC Result"))
         self.cnc_object_label.setToolTip(
         self.cnc_object_label.setToolTip(

+ 7 - 7
flatcamTools/ToolSub.py

@@ -8,7 +8,7 @@
 from PyQt5 import QtWidgets, QtCore
 from PyQt5 import QtWidgets, QtCore
 
 
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import FCCheckBox, FCButton
+from flatcamGUI.GUIElements import FCCheckBox, FCButton, FCComboBox
 
 
 from shapely.geometry import Polygon, MultiPolygon, MultiLineString, LineString
 from shapely.geometry import Polygon, MultiPolygon, MultiLineString, LineString
 from shapely.ops import cascaded_union
 from shapely.ops import cascaded_union
@@ -66,7 +66,7 @@ class ToolSub(FlatCAMTool):
         form_layout.addRow(self.gerber_title)
         form_layout.addRow(self.gerber_title)
 
 
         # Target Gerber Object
         # Target Gerber Object
-        self.target_gerber_combo = QtWidgets.QComboBox()
+        self.target_gerber_combo = FCComboBox()
         self.target_gerber_combo.setModel(self.app.collection)
         self.target_gerber_combo.setModel(self.app.collection)
         self.target_gerber_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.target_gerber_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.target_gerber_combo.setCurrentIndex(1)
         self.target_gerber_combo.setCurrentIndex(1)
@@ -80,10 +80,10 @@ class ToolSub(FlatCAMTool):
         form_layout.addRow(self.target_gerber_label, self.target_gerber_combo)
         form_layout.addRow(self.target_gerber_label, self.target_gerber_combo)
 
 
         # Substractor Gerber Object
         # Substractor Gerber Object
-        self.sub_gerber_combo = QtWidgets.QComboBox()
+        self.sub_gerber_combo = FCComboBox()
         self.sub_gerber_combo.setModel(self.app.collection)
         self.sub_gerber_combo.setModel(self.app.collection)
         self.sub_gerber_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
         self.sub_gerber_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
-        self.sub_gerber_combo.setCurrentIndex(1)
+        self.sub_gerber_combo.set_last = True
 
 
         self.sub_gerber_label = QtWidgets.QLabel('%s:' % _("Subtractor"))
         self.sub_gerber_label = QtWidgets.QLabel('%s:' % _("Subtractor"))
         self.sub_gerber_label.setToolTip(
         self.sub_gerber_label.setToolTip(
@@ -118,7 +118,7 @@ class ToolSub(FlatCAMTool):
         form_geo_layout.addRow(self.geo_title)
         form_geo_layout.addRow(self.geo_title)
 
 
         # Target Geometry Object
         # Target Geometry Object
-        self.target_geo_combo = QtWidgets.QComboBox()
+        self.target_geo_combo = FCComboBox()
         self.target_geo_combo.setModel(self.app.collection)
         self.target_geo_combo.setModel(self.app.collection)
         self.target_geo_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
         self.target_geo_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
         self.target_geo_combo.setCurrentIndex(1)
         self.target_geo_combo.setCurrentIndex(1)
@@ -132,10 +132,10 @@ class ToolSub(FlatCAMTool):
         form_geo_layout.addRow(self.target_geo_label, self.target_geo_combo)
         form_geo_layout.addRow(self.target_geo_label, self.target_geo_combo)
 
 
         # Substractor Geometry Object
         # Substractor Geometry Object
-        self.sub_geo_combo = QtWidgets.QComboBox()
+        self.sub_geo_combo = FCComboBox()
         self.sub_geo_combo.setModel(self.app.collection)
         self.sub_geo_combo.setModel(self.app.collection)
         self.sub_geo_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
         self.sub_geo_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
-        self.sub_geo_combo.setCurrentIndex(1)
+        self.sub_geo_combo.set_last = True
 
 
         self.sub_geo_label = QtWidgets.QLabel('%s:' % _("Subtractor"))
         self.sub_geo_label = QtWidgets.QLabel('%s:' % _("Subtractor"))
         self.sub_geo_label.setToolTip(
         self.sub_geo_label.setToolTip(