eric7/Documentation/Source/eric7.EricWidgets.EricSpellCheckedTextEdit.html

branch
eric7
changeset 8427
5ccf32f95805
child 8428
2deec2f8a9ab
equal deleted inserted replaced
8425:63cc81d35ddc 8427:5ccf32f95805
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.EricWidgets.EricSpellCheckedTextEdit</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.EricWidgets.EricSpellCheckedTextEdit</h1>
24
25 <p>
26 Module implementing QTextEdit and QPlainTextEdit widgets with embedded spell
27 checking.
28 </p>
29 <h3>Global Attributes</h3>
30
31 <table>
32 <tr><td>None</td></tr>
33 </table>
34 <h3>Classes</h3>
35
36 <table>
37
38 <tr>
39 <td><a href="#EnchantHighlighter">EnchantHighlighter</a></td>
40 <td>Class implementing a QSyntaxHighlighter subclass that consults a pyEnchant dictionary to highlight misspelled words.</td>
41 </tr>
42 <tr>
43 <td><a href="#EricSpellCheckedPlainTextEdit">EricSpellCheckedPlainTextEdit</a></td>
44 <td>Class implementing a QPlainTextEdit with built-in spell checker.</td>
45 </tr>
46 <tr>
47 <td><a href="#EricSpellCheckedTextEdit">EricSpellCheckedTextEdit</a></td>
48 <td>Class implementing a QTextEdit with built-in spell checker.</td>
49 </tr>
50 <tr>
51 <td><a href="#SpellCheckMixin">SpellCheckMixin</a></td>
52 <td>Class implementing the spell-check mixin for the widget classes.</td>
53 </tr>
54 </table>
55 <h3>Functions</h3>
56
57 <table>
58 <tr><td>None</td></tr>
59 </table>
60 <hr />
61 <hr />
62 <a NAME="EnchantHighlighter" ID="EnchantHighlighter"></a>
63 <h2>EnchantHighlighter</h2>
64
65 <p>
66 Class implementing a QSyntaxHighlighter subclass that consults a
67 pyEnchant dictionary to highlight misspelled words.
68 </p>
69 <h3>Derived from</h3>
70 QSyntaxHighlighter
71 <h3>Class Attributes</h3>
72
73 <table>
74 <tr><td>ErrorFormat</td></tr><tr><td>TokenFilters</td></tr>
75 </table>
76 <h3>Class Methods</h3>
77
78 <table>
79 <tr><td>None</td></tr>
80 </table>
81 <h3>Methods</h3>
82
83 <table>
84
85 <tr>
86 <td><a href="#EnchantHighlighter.__init__">EnchantHighlighter</a></td>
87 <td>Constructor</td>
88 </tr>
89 <tr>
90 <td><a href="#EnchantHighlighter.chunkers">chunkers</a></td>
91 <td>Public method to get the chunkers in use.</td>
92 </tr>
93 <tr>
94 <td><a href="#EnchantHighlighter.dict">dict</a></td>
95 <td>Public method to get the spelling dictionary in use.</td>
96 </tr>
97 <tr>
98 <td><a href="#EnchantHighlighter.highlightBlock">highlightBlock</a></td>
99 <td>Public method to apply the text highlight.</td>
100 </tr>
101 <tr>
102 <td><a href="#EnchantHighlighter.setChunkers">setChunkers</a></td>
103 <td>Public method to set the chunkers to be used.</td>
104 </tr>
105 <tr>
106 <td><a href="#EnchantHighlighter.setDict">setDict</a></td>
107 <td>Public method to set the spelling dictionary to be used.</td>
108 </tr>
109 </table>
110 <h3>Static Methods</h3>
111
112 <table>
113 <tr><td>None</td></tr>
114 </table>
115
116 <a NAME="EnchantHighlighter.__init__" ID="EnchantHighlighter.__init__"></a>
117 <h4>EnchantHighlighter (Constructor)</h4>
118 <b>EnchantHighlighter</b>(<i>*args</i>)
119
120 <p>
121 Constructor
122 </p>
123 <dl>
124
125 <dt><i>*args</i> (list)</dt>
126 <dd>
127 list of arguments for the QSyntaxHighlighter
128 </dd>
129 </dl>
130 <a NAME="EnchantHighlighter.chunkers" ID="EnchantHighlighter.chunkers"></a>
131 <h4>EnchantHighlighter.chunkers</h4>
132 <b>chunkers</b>(<i></i>)
133
134 <p>
135 Public method to get the chunkers in use.
136 </p>
137 <dl>
138 <dt>Return:</dt>
139 <dd>
140 list of chunkers in use
141 </dd>
142 </dl>
143 <dl>
144 <dt>Return Type:</dt>
145 <dd>
146 list
147 </dd>
148 </dl>
149 <a NAME="EnchantHighlighter.dict" ID="EnchantHighlighter.dict"></a>
150 <h4>EnchantHighlighter.dict</h4>
151 <b>dict</b>(<i></i>)
152
153 <p>
154 Public method to get the spelling dictionary in use.
155 </p>
156 <dl>
157 <dt>Return:</dt>
158 <dd>
159 spelling dictionary
160 </dd>
161 </dl>
162 <dl>
163 <dt>Return Type:</dt>
164 <dd>
165 enchant.Dict
166 </dd>
167 </dl>
168 <a NAME="EnchantHighlighter.highlightBlock" ID="EnchantHighlighter.highlightBlock"></a>
169 <h4>EnchantHighlighter.highlightBlock</h4>
170 <b>highlightBlock</b>(<i>text</i>)
171
172 <p>
173 Public method to apply the text highlight.
174 </p>
175 <dl>
176
177 <dt><i>text</i> (str)</dt>
178 <dd>
179 text to be spell-checked
180 </dd>
181 </dl>
182 <a NAME="EnchantHighlighter.setChunkers" ID="EnchantHighlighter.setChunkers"></a>
183 <h4>EnchantHighlighter.setChunkers</h4>
184 <b>setChunkers</b>(<i>chunkers</i>)
185
186 <p>
187 Public method to set the chunkers to be used.
188 </p>
189 <dl>
190
191 <dt><i>chunkers</i> (list)</dt>
192 <dd>
193 chunkers to be used
194 </dd>
195 </dl>
196 <a NAME="EnchantHighlighter.setDict" ID="EnchantHighlighter.setDict"></a>
197 <h4>EnchantHighlighter.setDict</h4>
198 <b>setDict</b>(<i>spellDict</i>)
199
200 <p>
201 Public method to set the spelling dictionary to be used.
202 </p>
203 <dl>
204
205 <dt><i>spellDict</i> (enchant.Dict)</dt>
206 <dd>
207 spelling dictionary
208 </dd>
209 </dl>
210 <div align="right"><a href="#top">Up</a></div>
211 <hr />
212 <hr />
213 <a NAME="EricSpellCheckedPlainTextEdit" ID="EricSpellCheckedPlainTextEdit"></a>
214 <h2>EricSpellCheckedPlainTextEdit</h2>
215
216 <p>
217 Class implementing a QPlainTextEdit with built-in spell checker.
218 </p>
219 <h3>Derived from</h3>
220 QPlainTextEdit, SpellCheckMixin
221 <h3>Class Attributes</h3>
222
223 <table>
224 <tr><td>None</td></tr>
225 </table>
226 <h3>Class Methods</h3>
227
228 <table>
229 <tr><td>None</td></tr>
230 </table>
231 <h3>Methods</h3>
232
233 <table>
234
235 <tr>
236 <td><a href="#EricSpellCheckedPlainTextEdit.__init__">EricSpellCheckedPlainTextEdit</a></td>
237 <td>Constructor</td>
238 </tr>
239 </table>
240 <h3>Static Methods</h3>
241
242 <table>
243 <tr><td>None</td></tr>
244 </table>
245
246 <a NAME="EricSpellCheckedPlainTextEdit.__init__" ID="EricSpellCheckedPlainTextEdit.__init__"></a>
247 <h4>EricSpellCheckedPlainTextEdit (Constructor)</h4>
248 <b>EricSpellCheckedPlainTextEdit</b>(<i>*args</i>)
249
250 <p>
251 Constructor
252 </p>
253 <dl>
254
255 <dt><i>*args</i> (list)</dt>
256 <dd>
257 list of arguments for the QPlainTextEdit constructor.
258 </dd>
259 </dl>
260 <div align="right"><a href="#top">Up</a></div>
261 <hr />
262 <hr />
263 <a NAME="EricSpellCheckedTextEdit" ID="EricSpellCheckedTextEdit"></a>
264 <h2>EricSpellCheckedTextEdit</h2>
265
266 <p>
267 Class implementing a QTextEdit with built-in spell checker.
268 </p>
269 <h3>Derived from</h3>
270 QTextEdit, SpellCheckMixin
271 <h3>Class Attributes</h3>
272
273 <table>
274 <tr><td>None</td></tr>
275 </table>
276 <h3>Class Methods</h3>
277
278 <table>
279 <tr><td>None</td></tr>
280 </table>
281 <h3>Methods</h3>
282
283 <table>
284
285 <tr>
286 <td><a href="#EricSpellCheckedTextEdit.__init__">EricSpellCheckedTextEdit</a></td>
287 <td>Constructor</td>
288 </tr>
289 <tr>
290 <td><a href="#EricSpellCheckedTextEdit.setAcceptRichText">setAcceptRichText</a></td>
291 <td>Public method to set the text edit mode.</td>
292 </tr>
293 </table>
294 <h3>Static Methods</h3>
295
296 <table>
297 <tr><td>None</td></tr>
298 </table>
299
300 <a NAME="EricSpellCheckedTextEdit.__init__" ID="EricSpellCheckedTextEdit.__init__"></a>
301 <h4>EricSpellCheckedTextEdit (Constructor)</h4>
302 <b>EricSpellCheckedTextEdit</b>(<i>*args</i>)
303
304 <p>
305 Constructor
306 </p>
307 <dl>
308
309 <dt><i>*args</i> (list)</dt>
310 <dd>
311 list of arguments for the QPlainTextEdit constructor.
312 </dd>
313 </dl>
314 <a NAME="EricSpellCheckedTextEdit.setAcceptRichText" ID="EricSpellCheckedTextEdit.setAcceptRichText"></a>
315 <h4>EricSpellCheckedTextEdit.setAcceptRichText</h4>
316 <b>setAcceptRichText</b>(<i>accept</i>)
317
318 <p>
319 Public method to set the text edit mode.
320 </p>
321 <dl>
322
323 <dt><i>accept</i> (bool)</dt>
324 <dd>
325 flag indicating to accept rich text
326 </dd>
327 </dl>
328 <div align="right"><a href="#top">Up</a></div>
329 <hr />
330 <hr />
331 <a NAME="SpellCheckMixin" ID="SpellCheckMixin"></a>
332 <h2>SpellCheckMixin</h2>
333
334 <p>
335 Class implementing the spell-check mixin for the widget classes.
336 </p>
337 <h3>Derived from</h3>
338 None
339 <h3>Class Attributes</h3>
340
341 <table>
342 <tr><td>MaxSuggestions</td></tr>
343 </table>
344 <h3>Class Methods</h3>
345
346 <table>
347 <tr><td>None</td></tr>
348 </table>
349 <h3>Methods</h3>
350
351 <table>
352
353 <tr>
354 <td><a href="#SpellCheckMixin.__init__">SpellCheckMixin</a></td>
355 <td>Constructor</td>
356 </tr>
357 <tr>
358 <td><a href="#SpellCheckMixin.__correctWord">__correctWord</a></td>
359 <td>Private slot to correct the misspelled word with the selected correction.</td>
360 </tr>
361 <tr>
362 <td><a href="#SpellCheckMixin.__createCorrectionsMenu">__createCorrectionsMenu</a></td>
363 <td>Private method to create a menu for corrections of the selected word.</td>
364 </tr>
365 <tr>
366 <td><a href="#SpellCheckMixin.__createFormatsMenu">__createFormatsMenu</a></td>
367 <td>Private method to create a menu for selecting the document format.</td>
368 </tr>
369 <tr>
370 <td><a href="#SpellCheckMixin.__createLanguagesMenu">__createLanguagesMenu</a></td>
371 <td>Private method to create a menu for selecting the spell-check language.</td>
372 </tr>
373 <tr>
374 <td><a href="#SpellCheckMixin.__createSpellcheckContextMenu">__createSpellcheckContextMenu</a></td>
375 <td>Private method to create the spell-check context menu.</td>
376 </tr>
377 <tr>
378 <td><a href="#SpellCheckMixin.__cursorForMisspelling">__cursorForMisspelling</a></td>
379 <td>Private method to create a text cursor selecting the misspelled word.</td>
380 </tr>
381 <tr>
382 <td><a href="#SpellCheckMixin.__setFormat">__setFormat</a></td>
383 <td>Private slot to set the selected document format.</td>
384 </tr>
385 <tr>
386 <td><a href="#SpellCheckMixin.__setLanguage">__setLanguage</a></td>
387 <td>Private slot to set the selected language.</td>
388 </tr>
389 <tr>
390 <td><a href="#SpellCheckMixin.contextMenuEvent">contextMenuEvent</a></td>
391 <td>Protected method to handle context menu events to add a spelling suggestions submenu.</td>
392 </tr>
393 <tr>
394 <td><a href="#SpellCheckMixin.dict">dict</a></td>
395 <td>Public method to get a reference to the dictionary in use.</td>
396 </tr>
397 <tr>
398 <td><a href="#SpellCheckMixin.setDict">setDict</a></td>
399 <td>Public method to set the dictionary to be used.</td>
400 </tr>
401 <tr>
402 <td><a href="#SpellCheckMixin.setFormat">setFormat</a></td>
403 <td>Public method to set the document format.</td>
404 </tr>
405 </table>
406 <h3>Static Methods</h3>
407
408 <table>
409 <tr><td>None</td></tr>
410 </table>
411
412 <a NAME="SpellCheckMixin.__init__" ID="SpellCheckMixin.__init__"></a>
413 <h4>SpellCheckMixin (Constructor)</h4>
414 <b>SpellCheckMixin</b>(<i></i>)
415
416 <p>
417 Constructor
418 </p>
419 <a NAME="SpellCheckMixin.__correctWord" ID="SpellCheckMixin.__correctWord"></a>
420 <h4>SpellCheckMixin.__correctWord</h4>
421 <b>__correctWord</b>(<i>act</i>)
422
423 <p>
424 Private slot to correct the misspelled word with the selected
425 correction.
426 </p>
427 <dl>
428
429 <dt><i>act</i> (QAction)</dt>
430 <dd>
431 reference to the selected action
432 </dd>
433 </dl>
434 <a NAME="SpellCheckMixin.__createCorrectionsMenu" ID="SpellCheckMixin.__createCorrectionsMenu"></a>
435 <h4>SpellCheckMixin.__createCorrectionsMenu</h4>
436 <b>__createCorrectionsMenu</b>(<i>cursor, parent=None</i>)
437
438 <p>
439 Private method to create a menu for corrections of the selected word.
440 </p>
441 <dl>
442
443 <dt><i>cursor</i> (QTextCursor)</dt>
444 <dd>
445 reference to the text cursor
446 </dd>
447 <dt><i>parent</i> (QWidget (optional))</dt>
448 <dd>
449 reference to the parent widget (defaults to None)
450 </dd>
451 </dl>
452 <dl>
453 <dt>Return:</dt>
454 <dd>
455 menu with corrections
456 </dd>
457 </dl>
458 <dl>
459 <dt>Return Type:</dt>
460 <dd>
461 QMenu
462 </dd>
463 </dl>
464 <a NAME="SpellCheckMixin.__createFormatsMenu" ID="SpellCheckMixin.__createFormatsMenu"></a>
465 <h4>SpellCheckMixin.__createFormatsMenu</h4>
466 <b>__createFormatsMenu</b>(<i>parent=None</i>)
467
468 <p>
469 Private method to create a menu for selecting the document format.
470 </p>
471 <dl>
472
473 <dt><i>parent</i> (QWidget (optional))</dt>
474 <dd>
475 reference to the parent widget (defaults to None)
476 </dd>
477 </dl>
478 <dl>
479 <dt>Return:</dt>
480 <dd>
481 menu with document formats
482 </dd>
483 </dl>
484 <dl>
485 <dt>Return Type:</dt>
486 <dd>
487 QMenu
488 </dd>
489 </dl>
490 <a NAME="SpellCheckMixin.__createLanguagesMenu" ID="SpellCheckMixin.__createLanguagesMenu"></a>
491 <h4>SpellCheckMixin.__createLanguagesMenu</h4>
492 <b>__createLanguagesMenu</b>(<i>parent=None</i>)
493
494 <p>
495 Private method to create a menu for selecting the spell-check language.
496 </p>
497 <dl>
498
499 <dt><i>parent</i> (QWidget (optional))</dt>
500 <dd>
501 reference to the parent widget (defaults to None)
502 </dd>
503 </dl>
504 <dl>
505 <dt>Return:</dt>
506 <dd>
507 menu with spell-check languages
508 </dd>
509 </dl>
510 <dl>
511 <dt>Return Type:</dt>
512 <dd>
513 QMenu
514 </dd>
515 </dl>
516 <a NAME="SpellCheckMixin.__createSpellcheckContextMenu" ID="SpellCheckMixin.__createSpellcheckContextMenu"></a>
517 <h4>SpellCheckMixin.__createSpellcheckContextMenu</h4>
518 <b>__createSpellcheckContextMenu</b>(<i>pos</i>)
519
520 <p>
521 Private method to create the spell-check context menu.
522 </p>
523 <dl>
524
525 <dt><i>pos</i> (QPoint)</dt>
526 <dd>
527 position of the mouse pointer
528 </dd>
529 </dl>
530 <dl>
531 <dt>Return:</dt>
532 <dd>
533 context menu with additional spell-check entries
534 </dd>
535 </dl>
536 <dl>
537 <dt>Return Type:</dt>
538 <dd>
539 QMenu
540 </dd>
541 </dl>
542 <a NAME="SpellCheckMixin.__cursorForMisspelling" ID="SpellCheckMixin.__cursorForMisspelling"></a>
543 <h4>SpellCheckMixin.__cursorForMisspelling</h4>
544 <b>__cursorForMisspelling</b>(<i>pos</i>)
545
546 <p>
547 Private method to create a text cursor selecting the misspelled word.
548 </p>
549 <dl>
550
551 <dt><i>pos</i> (QPoint)</dt>
552 <dd>
553 position of the misspelled word
554 </dd>
555 </dl>
556 <dl>
557 <dt>Return:</dt>
558 <dd>
559 text cursor for the misspelled word
560 </dd>
561 </dl>
562 <dl>
563 <dt>Return Type:</dt>
564 <dd>
565 QTextCursor
566 </dd>
567 </dl>
568 <a NAME="SpellCheckMixin.__setFormat" ID="SpellCheckMixin.__setFormat"></a>
569 <h4>SpellCheckMixin.__setFormat</h4>
570 <b>__setFormat</b>(<i>act</i>)
571
572 <p>
573 Private slot to set the selected document format.
574 </p>
575 <dl>
576
577 <dt><i>act</i> (QAction)</dt>
578 <dd>
579 reference to the selected action
580 </dd>
581 </dl>
582 <a NAME="SpellCheckMixin.__setLanguage" ID="SpellCheckMixin.__setLanguage"></a>
583 <h4>SpellCheckMixin.__setLanguage</h4>
584 <b>__setLanguage</b>(<i>act</i>)
585
586 <p>
587 Private slot to set the selected language.
588 </p>
589 <dl>
590
591 <dt><i>act</i> (QAction)</dt>
592 <dd>
593 reference to the selected action
594 </dd>
595 </dl>
596 <a NAME="SpellCheckMixin.contextMenuEvent" ID="SpellCheckMixin.contextMenuEvent"></a>
597 <h4>SpellCheckMixin.contextMenuEvent</h4>
598 <b>contextMenuEvent</b>(<i>evt</i>)
599
600 <p>
601 Protected method to handle context menu events to add a spelling
602 suggestions submenu.
603 </p>
604 <dl>
605
606 <dt><i>evt</i> (QContextMenuEvent)</dt>
607 <dd>
608 reference to the context menu event
609 </dd>
610 </dl>
611 <a NAME="SpellCheckMixin.dict" ID="SpellCheckMixin.dict"></a>
612 <h4>SpellCheckMixin.dict</h4>
613 <b>dict</b>(<i></i>)
614
615 <p>
616 Public method to get a reference to the dictionary in use.
617 </p>
618 <dl>
619 <dt>Return:</dt>
620 <dd>
621 reference to the current dictionary
622 </dd>
623 </dl>
624 <dl>
625 <dt>Return Type:</dt>
626 <dd>
627 enchant.Dict
628 </dd>
629 </dl>
630 <a NAME="SpellCheckMixin.setDict" ID="SpellCheckMixin.setDict"></a>
631 <h4>SpellCheckMixin.setDict</h4>
632 <b>setDict</b>(<i>spellDict</i>)
633
634 <p>
635 Public method to set the dictionary to be used.
636 </p>
637 <dl>
638
639 <dt><i>spellDict</i> (emchant.Dict)</dt>
640 <dd>
641 reference to the spell-check dictionary
642 </dd>
643 </dl>
644 <a NAME="SpellCheckMixin.setFormat" ID="SpellCheckMixin.setFormat"></a>
645 <h4>SpellCheckMixin.setFormat</h4>
646 <b>setFormat</b>(<i>formatName</i>)
647
648 <p>
649 Public method to set the document format.
650 </p>
651 <dl>
652
653 <dt><i>formatName</i> (str)</dt>
654 <dd>
655 name of the document format
656 </dd>
657 </dl>
658 <div align="right"><a href="#top">Up</a></div>
659 <hr />
660 </body></html>

eric ide

mercurial