- 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
|
- 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
|
- 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
|
- 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
|
22.08.2019
|
||||||
|
|
||||||
|
|||||||
@@ -171,9 +171,11 @@ class LengthEntry(QtWidgets.QLineEdit):
|
|||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
|
|
||||||
def focusOutEvent(self, e):
|
def focusOutEvent(self, e):
|
||||||
super(LengthEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
# don't focus out if the user requests an popup menu
|
||||||
self.deselect()
|
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||||
self.readyToEdit = True
|
super(LengthEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
|
self.deselect()
|
||||||
|
self.readyToEdit = True
|
||||||
|
|
||||||
def returnPressed(self, *args, **kwargs):
|
def returnPressed(self, *args, **kwargs):
|
||||||
val = self.get_value()
|
val = self.get_value()
|
||||||
@@ -225,9 +227,11 @@ class FloatEntry(QtWidgets.QLineEdit):
|
|||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
|
|
||||||
def focusOutEvent(self, e):
|
def focusOutEvent(self, e):
|
||||||
super(FloatEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
# don't focus out if the user requests an popup menu
|
||||||
self.deselect()
|
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||||
self.readyToEdit = True
|
super(FloatEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
|
self.deselect()
|
||||||
|
self.readyToEdit = True
|
||||||
|
|
||||||
def returnPressed(self, *args, **kwargs):
|
def returnPressed(self, *args, **kwargs):
|
||||||
val = self.get_value()
|
val = self.get_value()
|
||||||
@@ -274,9 +278,11 @@ class FloatEntry2(QtWidgets.QLineEdit):
|
|||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
|
|
||||||
def focusOutEvent(self, e):
|
def focusOutEvent(self, e):
|
||||||
super(FloatEntry2, self).focusOutEvent(e) # required to remove cursor on focusOut
|
# don't focus out if the user requests an popup menu
|
||||||
self.deselect()
|
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||||
self.readyToEdit = True
|
super(FloatEntry2, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
|
self.deselect()
|
||||||
|
self.readyToEdit = True
|
||||||
|
|
||||||
def get_value(self):
|
def get_value(self):
|
||||||
raw = str(self.text()).strip(' ')
|
raw = str(self.text()).strip(' ')
|
||||||
@@ -316,9 +322,11 @@ class IntEntry(QtWidgets.QLineEdit):
|
|||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
|
|
||||||
def focusOutEvent(self, e):
|
def focusOutEvent(self, e):
|
||||||
super(IntEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
# don't focus out if the user requests an popup menu
|
||||||
self.deselect()
|
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||||
self.readyToEdit = True
|
super(IntEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
|
self.deselect()
|
||||||
|
self.readyToEdit = True
|
||||||
|
|
||||||
def get_value(self):
|
def get_value(self):
|
||||||
|
|
||||||
@@ -353,16 +361,17 @@ class FCEntry(QtWidgets.QLineEdit):
|
|||||||
def on_edit_finished(self):
|
def on_edit_finished(self):
|
||||||
self.clearFocus()
|
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
|
super(FCEntry, self).mousePressEvent(e) # required to deselect on 2e click
|
||||||
if self.readyToEdit:
|
if self.readyToEdit:
|
||||||
self.selectAll()
|
self.selectAll()
|
||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
|
|
||||||
def focusOutEvent(self, e):
|
def focusOutEvent(self, e):
|
||||||
super(FCEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||||
self.deselect()
|
super(FCEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
self.readyToEdit = True
|
self.deselect()
|
||||||
|
self.readyToEdit = True
|
||||||
|
|
||||||
def get_value(self):
|
def get_value(self):
|
||||||
return str(self.text())
|
return str(self.text())
|
||||||
@@ -381,36 +390,24 @@ class FCEntry(QtWidgets.QLineEdit):
|
|||||||
class FCEntry2(FCEntry):
|
class FCEntry2(FCEntry):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(FCEntry2, self).__init__(parent)
|
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):
|
def set_value(self, val, decimals=4):
|
||||||
try:
|
try:
|
||||||
fval = float(val)
|
fval = float(val)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.setText('%.*f' % (decimals, fval))
|
self.setText('%.*f' % (decimals, fval))
|
||||||
|
|
||||||
|
|
||||||
class FCEntry3(FCEntry):
|
class FCEntry3(FCEntry):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(FCEntry3, self).__init__(parent)
|
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):
|
def set_value(self, val, decimals=4):
|
||||||
try:
|
try:
|
||||||
fval = float(val)
|
fval = float(val)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.setText('%.*f' % (decimals, fval))
|
self.setText('%.*f' % (decimals, fval))
|
||||||
|
|
||||||
def get_value(self):
|
def get_value(self):
|
||||||
@@ -432,16 +429,17 @@ class EvalEntry(QtWidgets.QLineEdit):
|
|||||||
def on_edit_finished(self):
|
def on_edit_finished(self):
|
||||||
self.clearFocus()
|
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
|
super(EvalEntry, self).mousePressEvent(e) # required to deselect on 2e click
|
||||||
if self.readyToEdit:
|
if self.readyToEdit:
|
||||||
self.selectAll()
|
self.selectAll()
|
||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
|
|
||||||
def focusOutEvent(self, e):
|
def focusOutEvent(self, e):
|
||||||
super(EvalEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||||
self.deselect()
|
super(EvalEntry, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
self.readyToEdit = True
|
self.deselect()
|
||||||
|
self.readyToEdit = True
|
||||||
|
|
||||||
def returnPressed(self, *args, **kwargs):
|
def returnPressed(self, *args, **kwargs):
|
||||||
val = self.get_value()
|
val = self.get_value()
|
||||||
@@ -478,16 +476,17 @@ class EvalEntry2(QtWidgets.QLineEdit):
|
|||||||
def on_edit_finished(self):
|
def on_edit_finished(self):
|
||||||
self.clearFocus()
|
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
|
super(EvalEntry2, self).mousePressEvent(e) # required to deselect on 2e click
|
||||||
if self.readyToEdit:
|
if self.readyToEdit:
|
||||||
self.selectAll()
|
self.selectAll()
|
||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
|
|
||||||
def focusOutEvent(self, e):
|
def focusOutEvent(self, e):
|
||||||
super(EvalEntry2, self).focusOutEvent(e) # required to remove cursor on focusOut
|
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||||
self.deselect()
|
super(EvalEntry2, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
self.readyToEdit = True
|
self.deselect()
|
||||||
|
self.readyToEdit = True
|
||||||
|
|
||||||
def get_value(self):
|
def get_value(self):
|
||||||
raw = str(self.text()).strip(' ')
|
raw = str(self.text()).strip(' ')
|
||||||
@@ -1626,9 +1625,11 @@ class FCSpinner(QtWidgets.QSpinBox):
|
|||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
|
|
||||||
def focusOutEvent(self, e):
|
def focusOutEvent(self, e):
|
||||||
super(FCSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut
|
# don't focus out if the user requests an popup menu
|
||||||
self.lineEdit().deselect()
|
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||||
self.readyToEdit = True
|
super(FCSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
|
self.lineEdit().deselect()
|
||||||
|
self.readyToEdit = True
|
||||||
|
|
||||||
def get_value(self):
|
def get_value(self):
|
||||||
return str(self.value())
|
return str(self.value())
|
||||||
@@ -1665,9 +1666,11 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
|
|||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
|
|
||||||
def focusOutEvent(self, e):
|
def focusOutEvent(self, e):
|
||||||
super(FCDoubleSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut
|
# don't focus out if the user requests an popup menu
|
||||||
self.lineEdit().deselect()
|
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||||
self.readyToEdit = True
|
super(FCDoubleSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
|
self.lineEdit().deselect()
|
||||||
|
self.readyToEdit = True
|
||||||
|
|
||||||
def get_value(self):
|
def get_value(self):
|
||||||
return str(self.value())
|
return str(self.value())
|
||||||
@@ -1712,9 +1715,11 @@ class Dialog_box(QtWidgets.QWidget):
|
|||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
|
|
||||||
def focusOutEvent(self, e):
|
def focusOutEvent(self, e):
|
||||||
super(Dialog_box, self).focusOutEvent(e) # required to remove cursor on focusOut
|
# don't focus out if the user requests an popup menu
|
||||||
self.lineEdit().deselect()
|
if e.reason() != QtCore.Qt.PopupFocusReason:
|
||||||
self.readyToEdit = True
|
super(Dialog_box, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
|
self.lineEdit().deselect()
|
||||||
|
self.readyToEdit = True
|
||||||
|
|
||||||
|
|
||||||
class _BrowserTextEdit(QTextEdit):
|
class _BrowserTextEdit(QTextEdit):
|
||||||
|
|||||||
Reference in New Issue
Block a user