BackgroundChecker Class Reference
from PyKDE4.kdecore import *
Inherits: QObject
Namespace: Sonnet
Detailed Description
BackgroundChecker is used to perform spell checking without
blocking the application. You can use it as is by calling
the checkText function or subclass it and reimplement
getMoreText function.
The misspelling signal is emitted whenever a misspelled word
is found. The background checker stops right before emitting
the signal. So the parent has to call continueChecking function
to resume the checking.
done signal is emitted when whole text is spell checked.
- Author:
- Zack Rusin <zack@kde.org>
class used for spell checking in the background
Signals |
| done () |
| misspelling (QString word, int start) |
Methods |
| __init__ (self, QObject parent=0) |
| __init__ (self, Sonnet.Speller speller, QObject parent=0) |
bool | addWordToPersonal (self, QString word) |
| changeLanguage (self, QString lang) |
bool | checkWord (self, QString word) |
| continueChecking (self) |
QString | currentContext (self) |
QString | fetchMoreText (self) |
| finishedCurrentFeed (self) |
| replace (self, int start, QString oldText, QString newText) |
| setSpeller (self, Sonnet.Speller speller) |
| setText (self, QString text) |
| slotEngineDone (self) |
Sonnet.Speller | speller (self) |
| start (self) |
| stop (self) |
QStringList | suggest (self, QString word) |
QString | text (self) |
Signal Documentation
Emitted after the whole text has been spell checked.
- Signal syntax:
QObject.connect(source, SIGNAL("done()"), target_slot)
misspelling |
( |
QString |
word, |
|
|
int |
start |
|
) |
|
|
|
Emitted whenever a misspelled word is found
- Signal syntax:
QObject.connect(source, SIGNAL("misspelling(const QString&, int)"), target_slot)
Method Documentation
__init__ |
( |
self, |
|
|
|
QObject |
parent=0 |
|
) |
|
|
|
bool addWordToPersonal |
( |
self, |
|
|
|
QString |
word |
|
) |
|
|
|
changeLanguage |
( |
self, |
|
|
|
QString |
lang |
|
) |
|
|
|
bool checkWord |
( |
self, |
|
|
|
QString |
word |
|
) |
|
|
|
continueChecking |
( |
|
self ) |
|
After emitting misspelling signal the background
checker stops. The catcher is responsible for calling
continueChecking function to resume checking.
This function is called to get the text to spell check.
It will be called continuesly until it returns QString()
in which case the done() signal is emitted.
Note: the start parameter in mispelling() is not a combined
position but a position in the last string returned
by fetchMoreText. You need to store the state in the derivatives.
finishedCurrentFeed |
( |
|
self ) |
|
This function will be called whenever the background checker
will be finished text which it got from fetchMoreText.
This method is used to spell check static text.
It automatically invokes start().
Use fetchMoreText() with start() to spell check a stream.