- fixed the issue with GUI entries content being deselected on right click in the box in order to copy the value
This commit is contained in:
@@ -19,6 +19,7 @@ CAD program, and create G-Code for Isolation routing.
|
||||
- in Paint Tool and NCC Tool, for the Area option, now mouse panning is allowed while adding areas to process
|
||||
- for all the tools launched rom toolbar the behavior is modified: first click it will launch the tool; second click: if the Tool tab has focus it will close the tool but if another tab is selected, the tool will have focus
|
||||
- modified the NCC Tool and Paint Tool to work multiple times after first launch
|
||||
- fixed the issue with GUI entries content being deselected on right click in the box in order to copy the value
|
||||
|
||||
22.08.2019
|
||||
|
||||
|
||||
@@ -171,6 +171,8 @@ class LengthEntry(QtWidgets.QLineEdit):
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
# don't focus out if the user requests an popup menu
|
||||
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||
super(LengthEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.deselect()
|
||||
self.readyToEdit = True
|
||||
@@ -225,6 +227,8 @@ class FloatEntry(QtWidgets.QLineEdit):
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
# don't focus out if the user requests an popup menu
|
||||
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||
super(FloatEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.deselect()
|
||||
self.readyToEdit = True
|
||||
@@ -274,6 +278,8 @@ class FloatEntry2(QtWidgets.QLineEdit):
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
# don't focus out if the user requests an popup menu
|
||||
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||
super(FloatEntry2, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.deselect()
|
||||
self.readyToEdit = True
|
||||
@@ -316,6 +322,8 @@ class IntEntry(QtWidgets.QLineEdit):
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
# don't focus out if the user requests an popup menu
|
||||
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||
super(IntEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.deselect()
|
||||
self.readyToEdit = True
|
||||
@@ -353,13 +361,14 @@ class FCEntry(QtWidgets.QLineEdit):
|
||||
def on_edit_finished(self):
|
||||
self.clearFocus()
|
||||
|
||||
def mousePressEvent(self, e, Parent=None):
|
||||
def mousePressEvent(self, e, parent=None):
|
||||
super(FCEntry, self).mousePressEvent(e) # required to deselect on 2e click
|
||||
if self.readyToEdit:
|
||||
self.selectAll()
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||
super(FCEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.deselect()
|
||||
self.readyToEdit = True
|
||||
@@ -381,36 +390,24 @@ class FCEntry(QtWidgets.QLineEdit):
|
||||
class FCEntry2(FCEntry):
|
||||
def __init__(self, parent=None):
|
||||
super(FCEntry2, self).__init__(parent)
|
||||
self.readyToEdit = True
|
||||
self.editingFinished.connect(self.on_edit_finished)
|
||||
|
||||
def on_edit_finished(self):
|
||||
self.clearFocus()
|
||||
|
||||
def set_value(self, val, decimals=4):
|
||||
try:
|
||||
fval = float(val)
|
||||
except ValueError:
|
||||
return
|
||||
|
||||
self.setText('%.*f' % (decimals, fval))
|
||||
|
||||
|
||||
class FCEntry3(FCEntry):
|
||||
def __init__(self, parent=None):
|
||||
super(FCEntry3, self).__init__(parent)
|
||||
self.readyToEdit = True
|
||||
self.editingFinished.connect(self.on_edit_finished)
|
||||
|
||||
def on_edit_finished(self):
|
||||
self.clearFocus()
|
||||
|
||||
def set_value(self, val, decimals=4):
|
||||
try:
|
||||
fval = float(val)
|
||||
except ValueError:
|
||||
return
|
||||
|
||||
self.setText('%.*f' % (decimals, fval))
|
||||
|
||||
def get_value(self):
|
||||
@@ -432,13 +429,14 @@ class EvalEntry(QtWidgets.QLineEdit):
|
||||
def on_edit_finished(self):
|
||||
self.clearFocus()
|
||||
|
||||
def mousePressEvent(self, e, Parent=None):
|
||||
def mousePressEvent(self, e, parent=None):
|
||||
super(EvalEntry, self).mousePressEvent(e) # required to deselect on 2e click
|
||||
if self.readyToEdit:
|
||||
self.selectAll()
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||
super(EvalEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.deselect()
|
||||
self.readyToEdit = True
|
||||
@@ -478,13 +476,14 @@ class EvalEntry2(QtWidgets.QLineEdit):
|
||||
def on_edit_finished(self):
|
||||
self.clearFocus()
|
||||
|
||||
def mousePressEvent(self, e, Parent=None):
|
||||
def mousePressEvent(self, e, parent=None):
|
||||
super(EvalEntry2, self).mousePressEvent(e) # required to deselect on 2e click
|
||||
if self.readyToEdit:
|
||||
self.selectAll()
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||
super(EvalEntry2, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.deselect()
|
||||
self.readyToEdit = True
|
||||
@@ -1626,6 +1625,8 @@ class FCSpinner(QtWidgets.QSpinBox):
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
# don't focus out if the user requests an popup menu
|
||||
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||
super(FCSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.lineEdit().deselect()
|
||||
self.readyToEdit = True
|
||||
@@ -1665,6 +1666,8 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
# don't focus out if the user requests an popup menu
|
||||
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||
super(FCDoubleSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.lineEdit().deselect()
|
||||
self.readyToEdit = True
|
||||
@@ -1712,6 +1715,8 @@ class Dialog_box(QtWidgets.QWidget):
|
||||
self.readyToEdit = False
|
||||
|
||||
def focusOutEvent(self, e):
|
||||
# don't focus out if the user requests an popup menu
|
||||
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||
super(Dialog_box, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||
self.lineEdit().deselect()
|
||||
self.readyToEdit = True
|
||||
|
||||
Reference in New Issue
Block a user