From ec75a68976765c0a435fa12661cc0ee4d8dcdb0b Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 20 Mar 2019 04:05:32 +0200 Subject: [PATCH] - autocomplete in Code Editor is finished by hitting either TAB key or ENTER key --- README.md | 1 + flatcamGUI/GUIElements.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d4d5adb5..837dc545 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/flatcamGUI/GUIElements.py b/flatcamGUI/GUIElements.py index 7da9acbb..d74953cf 100644 --- a/flatcamGUI/GUIElements.py +++ b/flatcamGUI/GUIElements.py @@ -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()