- in AppTextEditor made some changes (added some placeholders and a message popup when reaching the end of document)

- when viewing GCode the Find field can now keep the focus
This commit is contained in:
Marius Stanciu
2021-11-22 03:26:09 +02:00
committed by Marius
parent c98066834a
commit 8f0b591d74
4 changed files with 53 additions and 4 deletions

View File

@@ -626,10 +626,13 @@ class IntEntry(FCLineEdit):
class FCEntry(FCLineEdit):
def __init__(self, decimals=None, alignment=None, border_color=None, parent=None):
def __init__(self, decimals=None, alignment=None, border_color=None, parent=None, keep_focus=False):
super(FCEntry, self).__init__(parent)
self.readyToEdit = True
self.editingFinished.connect(self.on_edit_finished)
self._keep_focus = keep_focus
if self._keep_focus is False:
self.editingFinished.connect(self.on_edit_finished)
self.decimals = decimals if decimals is not None else 4
if border_color:
@@ -644,6 +647,25 @@ class FCEntry(FCLineEdit):
align_val = QtCore.Qt.AlignmentFlag.AlignLeft
self.setAlignment(align_val)
@property
def keep_focus(self):
return self._keep_focus
@keep_focus.setter
def keep_focus(self, val):
self._keep_focus = val
if val is True:
try:
self.editingFinished.disconnect(self.on_edit_finished)
except (AttributeError, TypeError):
pass
self.editingFinished.connect(self.on_edit_finished)
else:
try:
self.editingFinished.disconnect(self.on_edit_finished)
except (AttributeError, TypeError):
pass
def on_edit_finished(self):
self.clearFocus()