diff options
| author | Adrien Tétar | 2015-10-06 14:02:34 +0200 |
|---|---|---|
| committer | Adrien Tétar | 2015-10-06 14:02:34 +0200 |
| commit | 8af06af1cf3b3d4e554b67f6ef64c68219166fbf (patch) | |
| tree | 574f54fe383327576fe26b5e508c82e907b2e7e7 /Lib/defconQt/scriptingWindow.py | |
| parent | b11dbffcf986b527cbb280e0dc6f655033e6aa2b (diff) | |
| download | trufont-8af06af1cf3b3d4e554b67f6ef64c68219166fbf.tar.bz2 | |
meta: CurrentGlyph() support, drop dead code, nits
Diffstat (limited to 'Lib/defconQt/scriptingWindow.py')
| -rw-r--r-- | Lib/defconQt/scriptingWindow.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/defconQt/scriptingWindow.py b/Lib/defconQt/scriptingWindow.py index eef90e3..f48fd0a 100644 --- a/Lib/defconQt/scriptingWindow.py +++ b/Lib/defconQt/scriptingWindow.py @@ -8,7 +8,6 @@ from PyQt5.QtWidgets import QApplication, QMainWindow, QMenu, QPlainTextEdit class MainScriptingWindow(QMainWindow): def __init__(self): super(MainScriptingWindow, self).__init__() - self.setAttribute(Qt.WA_DeleteOnClose) self.editor = PythonEditor(parent=self) self.resize(600, 500) @@ -31,6 +30,7 @@ class MainScriptingWindow(QMainWindow): "__builtins__": __builtins__, "AllFonts": app.allFonts, "CurrentFont": app.currentFont, + "CurrentGlyph": app.currentGlyph, } try: code = compile(script, "<string>", "exec") @@ -57,9 +57,11 @@ class PythonEditor(CodeEditor): if key in self.autocomplete.keys(): super(PythonEditor, self).keyPressEvent(event) cursor = self.textCursor() - cursor.insertText(self.autocomplete[key][-1]) - cursor.movePosition(QTextCursor.PreviousCharacter) - self.setTextCursor(cursor) + ok = cursor.movePosition(QTextCursor.NextCharacter) + if not ok: + cursor.insertText(self.autocomplete[key][-1]) + cursor.movePosition(QTextCursor.PreviousCharacter) + self.setTextCursor(cursor) event.accept() return elif key == Qt.Key_Backspace: |
