- updated all the FlatCAM Tools and the Gerber UI FCComboBoxes to update the box value with the latest object loaded in the App

- some fixes in the NCC Tool
- modified some strings
This commit is contained in:
Marius Stanciu
2020-03-04 00:27:51 +02:00
committed by Marius
parent 0477a9860a
commit 15ee54d057
23 changed files with 309 additions and 200 deletions

View File

@@ -1286,6 +1286,7 @@ class FCComboBox(QtWidgets.QComboBox):
self.view.setContextMenuPolicy(Qt.CustomContextMenu)
self._set_last = False
self._obj_type = None
# the callback() will be called on customcontextmenu event and will be be passed 2 parameters:
# pos = mouse right click click position
@@ -1309,17 +1310,27 @@ class FCComboBox(QtWidgets.QComboBox):
self.setCurrentIndex(self.findText(str(val)))
@property
def set_last(self):
def is_last(self):
return self._set_last
@set_last.setter
def set_last(self, val):
@is_last.setter
def is_last(self, val):
self._set_last = val
if self._set_last is True:
self.model().rowsInserted.connect(self.on_model_changed)
self.setCurrentIndex(1)
def on_model_changed(self, first, last):
self.setCurrentIndex(last)
@property
def obj_type(self):
return self._obj_type
@obj_type.setter
def obj_type(self, val):
self._obj_type = val
def on_model_changed(self, parent, first, last):
if self.model().data(parent, QtCore.Qt.DisplayRole) == self.obj_type:
self.setCurrentIndex(first)
class FCInputDialog(QtWidgets.QInputDialog):

View File

@@ -446,11 +446,7 @@ class GerberObjectUI(ObjectUI):
# ##### Type of object to be excepted ############
# ################################################
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")
self.type_obj_combo.addItems([_("Gerber"), _("Geometry")])
# we get rid of item1 ("Excellon") as it is not suitable
# self.type_obj_combo.view().setRowHidden(1, True)