- in all text editors, when writing in the Find entry, all instances of typed chars will be selected
- in all text editors, pressing Enter on Find Entry will search for next instance of the searched text (no longer for focus out)
This commit is contained in:
@@ -12,6 +12,8 @@ CHANGELOG for FlatCAM beta
|
|||||||
- added a last resort option to load old projects; the result is not guaranteed if the differences are too great
|
- added a last resort option to load old projects; the result is not guaranteed if the differences are too great
|
||||||
- updated the code in FlatCAMCNCJob object such that more attributes will be serialized in order for loading a project correctly when it has CNCJob objects
|
- updated the code in FlatCAMCNCJob object such that more attributes will be serialized in order for loading a project correctly when it has CNCJob objects
|
||||||
- another fix to make the app save correctly the CNCJob objects when saving a project
|
- another fix to make the app save correctly the CNCJob objects when saving a project
|
||||||
|
- in all text editors, when writing in the Find entry, all instances of typed chars will be selected
|
||||||
|
- in all text editors, pressing Enter on Find Entry will search for next instance of the searched text (no longer for focus out)
|
||||||
|
|
||||||
19.03.2022
|
19.03.2022
|
||||||
|
|
||||||
|
|||||||
@@ -165,8 +165,11 @@ class AppTextEditor(QtWidgets.QWidget):
|
|||||||
self.buttonPrint.clicked.connect(self.handlePrint)
|
self.buttonPrint.clicked.connect(self.handlePrint)
|
||||||
self.buttonPreview.clicked.connect(self.handlePreview)
|
self.buttonPreview.clicked.connect(self.handlePreview)
|
||||||
self.buttonFind.clicked.connect(self.handleFindGCode)
|
self.buttonFind.clicked.connect(self.handleFindGCode)
|
||||||
self.entryFind.editingFinished.connect(self.handleFindGCode)
|
self.entryFind.returnPressed.connect(self.handleFindGCode)
|
||||||
self.buttonReplace.clicked.connect(self.handleReplaceGCode)
|
self.buttonReplace.clicked.connect(self.handleReplaceGCode)
|
||||||
|
|
||||||
|
self.entryFind.textChanged.connect(self.on_text_changed)
|
||||||
|
|
||||||
# self.button_copy_all.clicked.connect(self.handleCopyAll)
|
# self.button_copy_all.clicked.connect(self.handleCopyAll)
|
||||||
|
|
||||||
self.code_editor.set_model_data(self.app.myKeywords)
|
self.code_editor.set_model_data(self.app.myKeywords)
|
||||||
@@ -350,7 +353,7 @@ class AppTextEditor(QtWidgets.QWidget):
|
|||||||
bt_ok = msgbox.addButton(_('Ok'), QtWidgets.QMessageBox.ButtonRole.AcceptRole)
|
bt_ok = msgbox.addButton(_('Ok'), QtWidgets.QMessageBox.ButtonRole.AcceptRole)
|
||||||
bt_cancel = msgbox.addButton(_('Cancel'), QtWidgets.QMessageBox.ButtonRole.RejectRole)
|
bt_cancel = msgbox.addButton(_('Cancel'), QtWidgets.QMessageBox.ButtonRole.RejectRole)
|
||||||
|
|
||||||
msgbox.setDefaultButton(bt_cancel)
|
msgbox.setDefaultButton(bt_ok)
|
||||||
msgbox.exec()
|
msgbox.exec()
|
||||||
response = msgbox.clickedButton()
|
response = msgbox.clickedButton()
|
||||||
|
|
||||||
@@ -388,6 +391,22 @@ class AppTextEditor(QtWidgets.QWidget):
|
|||||||
# Mark end of undo block
|
# Mark end of undo block
|
||||||
cursor.endEditBlock()
|
cursor.endEditBlock()
|
||||||
|
|
||||||
|
def on_text_changed(self, txt):
|
||||||
|
extra_sel_list = []
|
||||||
|
flags = QtGui.QTextDocument.FindFlag.FindCaseSensitively
|
||||||
|
self.code_editor.moveCursor(QtGui.QTextCursor.MoveOperation.Start)
|
||||||
|
|
||||||
|
while self.code_editor.find(str(txt), flags):
|
||||||
|
extra_sel = QtWidgets.QTextEdit.ExtraSelection()
|
||||||
|
extra_sel.cursor = self.code_editor.textCursor()
|
||||||
|
fmt = QtGui.QTextCharFormat()
|
||||||
|
fmt.setBackground(QtCore.Qt.GlobalColor.yellow)
|
||||||
|
extra_sel.format = fmt
|
||||||
|
extra_sel_list.append(extra_sel)
|
||||||
|
|
||||||
|
self.code_editor.moveCursor(QtGui.QTextCursor.MoveOperation.Start)
|
||||||
|
self.code_editor.setExtraSelections(extra_sel_list)
|
||||||
|
|
||||||
# def handleCopyAll(self):
|
# def handleCopyAll(self):
|
||||||
# text = self.code_editor.toPlainText()
|
# text = self.code_editor.toPlainText()
|
||||||
# self.app.clipboard.setText(text)
|
# self.app.clipboard.setText(text)
|
||||||
|
|||||||
Reference in New Issue
Block a user