diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 82baf8e3..7440e782 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -16,9 +16,9 @@ import enchant from time import time -from PyQt5.QtWidgets import QTextEdit, QAction, QMenu +from PyQt5.QtWidgets import QTextEdit, QAction, QMenu, QShortcut +from PyQt5.QtGui import QTextCursor, QTextOption, QIcon, QKeySequence from PyQt5.QtCore import Qt, QTimer -from PyQt5.QtGui import QTextCursor, QTextOption, QIcon from nw.gui.dochighlight import GuiDocHighlighter from nw.gui.wordcounter import WordCounter @@ -80,6 +80,9 @@ class GuiDocEditor(QTextEdit): self.setAcceptRichText(False) self.setFontPointSize(self.mainConf.textSize) + # Custom Shortcuts + QShortcut(QKeySequence("Ctrl+."), self, context=Qt.WidgetShortcut, activated=self._openSpellContext) + # Set Up Word Count Thread and Timer self.wcInterval = self.mainConf.wordCountTimer self.wcTimer = QTimer() @@ -163,6 +166,10 @@ class GuiDocEditor(QTextEdit): # Internal Functions ## + def _openSpellContext(self): + self._openContextMenu(self.cursorRect().center()) + return + def _openContextMenu(self, thePos): theCursor = self.cursorForPosition(thePos)