- autocomplete in Code Editor is finished by hitting either TAB key or ENTER key

This commit is contained in:
Marius Stanciu
2019-03-20 04:05:32 +02:00
parent 0eb3ea0283
commit ec75a68976
2 changed files with 5 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing.
19.03.2019
- added autocomplete for Code editor; TODO: needs to be enabled only when doing Scripts, right now is available for everyone.
- autocomplete in Code Editor is finished by hitting either TAB key or ENTER key
- fixed the Gerber.merge() to work for the case when one of the merged Gerber objects solid_geometry type is Polygon and not a list
18.03.2019

View File

@@ -517,6 +517,7 @@ class FCTextAreaExtended(QtWidgets.QTextEdit):
if self.completer:
self.completer.setWidget(self)
QTextEdit.focusInEvent(self, event)
def set_value(self, val):
self.setText(val)
@@ -555,12 +556,13 @@ class FCTextAreaExtended(QtWidgets.QTextEdit):
self.insertPlainText(clip_text)
tc = self.textCursor()
if event.key() == Qt.Key_Tab and self.completer.popup().isVisible():
if (key == Qt.Key_Tab or key == Qt.Key_Enter or key == Qt.Key_Return) and self.completer.popup().isVisible():
self.completer.insertText.emit(self.completer.getSelected())
self.completer.setCompletionMode(QCompleter.PopupCompletion)
return
else:
super(FCTextAreaExtended, self).keyPressEvent(event)
super(FCTextAreaExtended, self).keyPressEvent(event)
tc.select(QTextCursor.WordUnderCursor)
cr = self.cursorRect()