From 1d4a0cd24bfdea82e8e70aa0ad9a82679447f4d9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Apr 2014 11:06:36 +0530 Subject: [PATCH] Spell check: Improve performance of scrolling through the word list using arrow keys by not updating the list of suggestions immediately --- src/calibre/gui2/tweak_book/spell.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/gui2/tweak_book/spell.py b/src/calibre/gui2/tweak_book/spell.py index 4fced9a6cf..06a277e996 100644 --- a/src/calibre/gui2/tweak_book/spell.py +++ b/src/calibre/gui2/tweak_book/spell.py @@ -807,6 +807,9 @@ class SpellCheck(Dialog): self.thread = None self.cancel = False dictionaries.initialize() + self.current_word_changed_timer = t = QTimer() + t.timeout.connect(self.do_current_word_changed) + t.setSingleShot(True), t.setInterval(100) Dialog.__init__(self, _('Check spelling'), 'spell-check', parent) self.work_finished.connect(self.work_done, type=Qt.QueuedConnection) self.setAttribute(Qt.WA_DeleteOnClose, False) @@ -960,6 +963,9 @@ class SpellCheck(Dialog): self.user_dictionaries_missing_label.setVisible(not self.user_dictionaries.isVisible()) def current_word_changed(self, *args): + self.current_word_changed_timer.start(self.current_word_changed_timer.interval()) + + def do_current_word_changed(self): try: b = self.ignore_button except AttributeError: