- fixed bug in FCSpinner and FCDoubleSpinner GUI elements, that are now the main GUI element in FlatCAM, that made partial selection difficult
- updated the Paint Tool in Geometry Editor to use the FCDoublepinbox - added the possibility for suffix presence on the FCSpinner and FCDoubleSpinner GUI Elements - added the '%' symbol for overlap fields; I still need to divide the conntet by 100 to get the original decimal
This commit is contained in:
@@ -511,14 +511,20 @@ class FCSpinner(QtWidgets.QSpinBox):
|
||||
|
||||
returnPressed = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, suffix=None, parent=None):
|
||||
super(FCSpinner, self).__init__(parent)
|
||||
self.readyToEdit = True
|
||||
self.editingFinished.connect(self.on_edit_finished)
|
||||
self.lineEdit().installEventFilter(self)
|
||||
|
||||
if suffix:
|
||||
self.setSuffix(' %s' % str(suffix))
|
||||
|
||||
self.prev_readyToEdit = True
|
||||
|
||||
def eventFilter(self, object, event):
|
||||
if event.type() == QtCore.QEvent.MouseButtonPress:
|
||||
if event.type() == QtCore.QEvent.MouseButtonPress and self.prev_readyToEdit is True:
|
||||
self.prev_readyToEdit = False
|
||||
if self.isEnabled():
|
||||
if self.readyToEdit:
|
||||
self.lineEdit().selectAll()
|
||||
@@ -580,7 +586,7 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
|
||||
|
||||
returnPressed = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, suffix=None, parent=None):
|
||||
super(FCDoubleSpinner, self).__init__(parent)
|
||||
self.readyToEdit = True
|
||||
|
||||
@@ -592,18 +598,26 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
|
||||
self.lineEdit().setValidator(
|
||||
QtGui.QRegExpValidator(QtCore.QRegExp("[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self))
|
||||
|
||||
if suffix:
|
||||
self.setSuffix(' %s' % str(suffix))
|
||||
|
||||
self.prev_readyToEdit = True
|
||||
|
||||
def on_edit_finished(self):
|
||||
self.clearFocus()
|
||||
self.returnPressed.emit()
|
||||
|
||||
def eventFilter(self, object, event):
|
||||
if event.type() == QtCore.QEvent.MouseButtonPress:
|
||||
if event.type() == QtCore.QEvent.MouseButtonPress and self.prev_readyToEdit is True:
|
||||
self.prev_readyToEdit = False
|
||||
if self.isEnabled():
|
||||
if self.readyToEdit:
|
||||
self.cursor_pos = self.lineEdit().cursorPosition()
|
||||
self.lineEdit().selectAll()
|
||||
self.readyToEdit = False
|
||||
else:
|
||||
self.lineEdit().deselect()
|
||||
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -625,6 +639,7 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
|
||||
super(FCDoubleSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.lineEdit().deselect()
|
||||
self.readyToEdit = True
|
||||
self.prev_readyToEdit = True
|
||||
|
||||
def valueFromText(self, p_str):
|
||||
text = p_str.replace(',', '.')
|
||||
|
||||
@@ -376,7 +376,7 @@ class GerberObjectUI(ObjectUI):
|
||||
"A value here of 0.25 means an overlap of 25%% from the tool diameter found above.")
|
||||
)
|
||||
overlabel.setMinimumWidth(90)
|
||||
self.iso_overlap_entry = FCDoubleSpinner()
|
||||
self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
|
||||
self.iso_overlap_entry.set_precision(self.decimals)
|
||||
self.iso_overlap_entry.setWrapping(True)
|
||||
self.iso_overlap_entry.setRange(0.000, 0.999)
|
||||
|
||||
Reference in New Issue
Block a user