src/eric7/Documentation/Source/eric7.Plugins.UiExtensionPlugins.Translator.TranslatorWidget.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 9148
b31f0d894b55
child 10478
de9106c55c3d
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Plugins.UiExtensionPlugins.Translator.TranslatorWidget</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.Plugins.UiExtensionPlugins.Translator.TranslatorWidget</h1>
10
11 <p>
12 Module implementing the translator widget.
13 </p>
14 <h3>Global Attributes</h3>
15
16 <table>
17 <tr><td>None</td></tr>
18 </table>
19 <h3>Classes</h3>
20
21 <table>
22
23 <tr>
24 <td><a href="#TranslatorWidget">TranslatorWidget</a></td>
25 <td>Class implementing the translator widget.</td>
26 </tr>
27 </table>
28 <h3>Functions</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <hr />
34 <hr />
35 <a NAME="TranslatorWidget" ID="TranslatorWidget"></a>
36 <h2>TranslatorWidget</h2>
37
38 <p>
39 Class implementing the translator widget.
40 </p>
41 <h3>Derived from</h3>
42 QWidget, Ui_TranslatorWidget
43 <h3>Class Attributes</h3>
44
45 <table>
46 <tr><td>None</td></tr>
47 </table>
48 <h3>Class Methods</h3>
49
50 <table>
51 <tr><td>None</td></tr>
52 </table>
53 <h3>Methods</h3>
54
55 <table>
56
57 <tr>
58 <td><a href="#TranslatorWidget.__init__">TranslatorWidget</a></td>
59 <td>Constructor</td>
60 </tr>
61 <tr>
62 <td><a href="#TranslatorWidget.__availableTranslationsLoaded">__availableTranslationsLoaded</a></td>
63 <td>Private slot to handle the availability of translations.</td>
64 </tr>
65 <tr>
66 <td><a href="#TranslatorWidget.__engineComboBoxCurrentIndexChanged">__engineComboBoxCurrentIndexChanged</a></td>
67 <td>Private slot to handle the selection of a translation service.</td>
68 </tr>
69 <tr>
70 <td><a href="#TranslatorWidget.__ensureTranslationEngineReady">__ensureTranslationEngineReady</a></td>
71 <td>Private slot to ensure, that the currently selected translation engine is ready.</td>
72 </tr>
73 <tr>
74 <td><a href="#TranslatorWidget.__mediaPlayerError">__mediaPlayerError</a></td>
75 <td>Private slot to handle errors during playback of the data.</td>
76 </tr>
77 <tr>
78 <td><a href="#TranslatorWidget.__mediaPlayerPlaybackStateChanged">__mediaPlayerPlaybackStateChanged</a></td>
79 <td>Private slot handling changes of the media player state.</td>
80 </tr>
81 <tr>
82 <td><a href="#TranslatorWidget.__originalLanguage">__originalLanguage</a></td>
83 <td>Private method to return the code of the selected original language.</td>
84 </tr>
85 <tr>
86 <td><a href="#TranslatorWidget.__pronounce">__pronounce</a></td>
87 <td>Private method to pronounce the given text.</td>
88 </tr>
89 <tr>
90 <td><a href="#TranslatorWidget.__translate">__translate</a></td>
91 <td>Private method to translate the given text.</td>
92 </tr>
93 <tr>
94 <td><a href="#TranslatorWidget.__translationLanguage">__translationLanguage</a></td>
95 <td>Private method to return the code of the selected translation language.</td>
96 </tr>
97 <tr>
98 <td><a href="#TranslatorWidget.__updateClearButton">__updateClearButton</a></td>
99 <td>Private slot to set the state of the clear button.</td>
100 </tr>
101 <tr>
102 <td><a href="#TranslatorWidget.__updateEngines">__updateEngines</a></td>
103 <td>Private slot to update the engines combo box.</td>
104 </tr>
105 <tr>
106 <td><a href="#TranslatorWidget.__updateLanguages">__updateLanguages</a></td>
107 <td>Private slot to update the language combo boxes.</td>
108 </tr>
109 <tr>
110 <td><a href="#TranslatorWidget.__updatePronounceButtons">__updatePronounceButtons</a></td>
111 <td>Private slot to set the state of the pronounce buttons.</td>
112 </tr>
113 <tr>
114 <td><a href="#TranslatorWidget.__updateTranslateButton">__updateTranslateButton</a></td>
115 <td>Private slot to set the state of the translate button.</td>
116 </tr>
117 <tr>
118 <td><a href="#TranslatorWidget.on_clearButton_clicked">on_clearButton_clicked</a></td>
119 <td>Private slot to clear the text fields.</td>
120 </tr>
121 <tr>
122 <td><a href="#TranslatorWidget.on_origEdit_textChanged">on_origEdit_textChanged</a></td>
123 <td>Private slot to handle changes of the original text.</td>
124 </tr>
125 <tr>
126 <td><a href="#TranslatorWidget.on_origLanguageComboBox_currentIndexChanged">on_origLanguageComboBox_currentIndexChanged</a></td>
127 <td>Private slot to handle the selection of the original language.</td>
128 </tr>
129 <tr>
130 <td><a href="#TranslatorWidget.on_preferencesButton_clicked">on_preferencesButton_clicked</a></td>
131 <td>Private slot to open the Translator configuration page.</td>
132 </tr>
133 <tr>
134 <td><a href="#TranslatorWidget.on_pronounceOrigButton_clicked">on_pronounceOrigButton_clicked</a></td>
135 <td>Private slot to pronounce the original text.</td>
136 </tr>
137 <tr>
138 <td><a href="#TranslatorWidget.on_pronounceTransButton_clicked">on_pronounceTransButton_clicked</a></td>
139 <td>Private slot to pronounce the translated text.</td>
140 </tr>
141 <tr>
142 <td><a href="#TranslatorWidget.on_swapButton_clicked">on_swapButton_clicked</a></td>
143 <td>Private slot to swap the languages.</td>
144 </tr>
145 <tr>
146 <td><a href="#TranslatorWidget.on_transEdit_textChanged">on_transEdit_textChanged</a></td>
147 <td>Private slot to handle changes of the translation text.</td>
148 </tr>
149 <tr>
150 <td><a href="#TranslatorWidget.on_transLanguageComboBox_currentIndexChanged">on_transLanguageComboBox_currentIndexChanged</a></td>
151 <td>Private slot to handle the selection of the translation language.</td>
152 </tr>
153 <tr>
154 <td><a href="#TranslatorWidget.on_translateButton_clicked">on_translateButton_clicked</a></td>
155 <td>Private slot to translate the entered text.</td>
156 </tr>
157 </table>
158 <h3>Static Methods</h3>
159
160 <table>
161 <tr><td>None</td></tr>
162 </table>
163
164 <a NAME="TranslatorWidget.__init__" ID="TranslatorWidget.__init__"></a>
165 <h4>TranslatorWidget (Constructor)</h4>
166 <b>TranslatorWidget</b>(<i>plugin, translator, parent=None</i>)
167
168 <p>
169 Constructor
170 </p>
171 <dl>
172
173 <dt><i>plugin</i> (TranslatorPlugin)</dt>
174 <dd>
175 reference to the plugin object
176 </dd>
177 <dt><i>translator</i> (Translator)</dt>
178 <dd>
179 reference to the translator object
180 </dd>
181 <dt><i>parent</i> (QWidget)</dt>
182 <dd>
183 reference to the parent widget
184 </dd>
185 </dl>
186 <a NAME="TranslatorWidget.__availableTranslationsLoaded" ID="TranslatorWidget.__availableTranslationsLoaded"></a>
187 <h4>TranslatorWidget.__availableTranslationsLoaded</h4>
188 <b>__availableTranslationsLoaded</b>(<i></i>)
189
190 <p>
191 Private slot to handle the availability of translations.
192 </p>
193 <a NAME="TranslatorWidget.__engineComboBoxCurrentIndexChanged" ID="TranslatorWidget.__engineComboBoxCurrentIndexChanged"></a>
194 <h4>TranslatorWidget.__engineComboBoxCurrentIndexChanged</h4>
195 <b>__engineComboBoxCurrentIndexChanged</b>(<i>index</i>)
196
197 <p>
198 Private slot to handle the selection of a translation service.
199 </p>
200 <dl>
201
202 <dt><i>index</i> (int)</dt>
203 <dd>
204 current index
205 </dd>
206 </dl>
207 <a NAME="TranslatorWidget.__ensureTranslationEngineReady" ID="TranslatorWidget.__ensureTranslationEngineReady"></a>
208 <h4>TranslatorWidget.__ensureTranslationEngineReady</h4>
209 <b>__ensureTranslationEngineReady</b>(<i></i>)
210
211 <p>
212 Private slot to ensure, that the currently selected translation engine
213 is ready.
214 </p>
215 <a NAME="TranslatorWidget.__mediaPlayerError" ID="TranslatorWidget.__mediaPlayerError"></a>
216 <h4>TranslatorWidget.__mediaPlayerError</h4>
217 <b>__mediaPlayerError</b>(<i>error, errorString</i>)
218
219 <p>
220 Private slot to handle errors during playback of the data.
221 </p>
222 <dl>
223
224 <dt><i>error</i> (QMediaPlayer.Error)</dt>
225 <dd>
226 media player error condition
227 </dd>
228 <dt><i>errorString</i> (str)</dt>
229 <dd>
230 string representation for the error
231 </dd>
232 </dl>
233 <a NAME="TranslatorWidget.__mediaPlayerPlaybackStateChanged" ID="TranslatorWidget.__mediaPlayerPlaybackStateChanged"></a>
234 <h4>TranslatorWidget.__mediaPlayerPlaybackStateChanged</h4>
235 <b>__mediaPlayerPlaybackStateChanged</b>(<i>state</i>)
236
237 <p>
238 Private slot handling changes of the media player state.
239 </p>
240 <dl>
241
242 <dt><i>state</i> (QMediaPlayer.PlaybackState)</dt>
243 <dd>
244 media player state
245 </dd>
246 </dl>
247 <a NAME="TranslatorWidget.__originalLanguage" ID="TranslatorWidget.__originalLanguage"></a>
248 <h4>TranslatorWidget.__originalLanguage</h4>
249 <b>__originalLanguage</b>(<i></i>)
250
251 <p>
252 Private method to return the code of the selected original language.
253 </p>
254 <dl>
255 <dt>Return:</dt>
256 <dd>
257 code of the original language
258 </dd>
259 </dl>
260 <dl>
261 <dt>Return Type:</dt>
262 <dd>
263 str
264 </dd>
265 </dl>
266 <a NAME="TranslatorWidget.__pronounce" ID="TranslatorWidget.__pronounce"></a>
267 <h4>TranslatorWidget.__pronounce</h4>
268 <b>__pronounce</b>(<i>text, language</i>)
269
270 <p>
271 Private method to pronounce the given text.
272 </p>
273 <dl>
274
275 <dt><i>text</i> (str)</dt>
276 <dd>
277 text to be pronounced
278 </dd>
279 <dt><i>language</i> (str)</dt>
280 <dd>
281 language code of the text
282 </dd>
283 </dl>
284 <a NAME="TranslatorWidget.__translate" ID="TranslatorWidget.__translate"></a>
285 <h4>TranslatorWidget.__translate</h4>
286 <b>__translate</b>(<i>text, originalLanguage, translationLanguage</i>)
287
288 <p>
289 Private method to translate the given text.
290 </p>
291 <dl>
292
293 <dt><i>text</i> (str)</dt>
294 <dd>
295 text to be translated
296 </dd>
297 <dt><i>originalLanguage</i> (str)</dt>
298 <dd>
299 language code of the original
300 </dd>
301 <dt><i>translationLanguage</i> (str)</dt>
302 <dd>
303 language code of the translation
304 </dd>
305 </dl>
306 <dl>
307 <dt>Return:</dt>
308 <dd>
309 tuple of translated text and flag indicating success
310 </dd>
311 </dl>
312 <dl>
313 <dt>Return Type:</dt>
314 <dd>
315 tuple of (str, bool)
316 </dd>
317 </dl>
318 <a NAME="TranslatorWidget.__translationLanguage" ID="TranslatorWidget.__translationLanguage"></a>
319 <h4>TranslatorWidget.__translationLanguage</h4>
320 <b>__translationLanguage</b>(<i></i>)
321
322 <p>
323 Private method to return the code of the selected translation language.
324 </p>
325 <dl>
326 <dt>Return:</dt>
327 <dd>
328 code of the translation language
329 </dd>
330 </dl>
331 <dl>
332 <dt>Return Type:</dt>
333 <dd>
334 str
335 </dd>
336 </dl>
337 <a NAME="TranslatorWidget.__updateClearButton" ID="TranslatorWidget.__updateClearButton"></a>
338 <h4>TranslatorWidget.__updateClearButton</h4>
339 <b>__updateClearButton</b>(<i></i>)
340
341 <p>
342 Private slot to set the state of the clear button.
343 </p>
344 <a NAME="TranslatorWidget.__updateEngines" ID="TranslatorWidget.__updateEngines"></a>
345 <h4>TranslatorWidget.__updateEngines</h4>
346 <b>__updateEngines</b>(<i></i>)
347
348 <p>
349 Private slot to update the engines combo box.
350 </p>
351 <a NAME="TranslatorWidget.__updateLanguages" ID="TranslatorWidget.__updateLanguages"></a>
352 <h4>TranslatorWidget.__updateLanguages</h4>
353 <b>__updateLanguages</b>(<i></i>)
354
355 <p>
356 Private slot to update the language combo boxes.
357 </p>
358 <a NAME="TranslatorWidget.__updatePronounceButtons" ID="TranslatorWidget.__updatePronounceButtons"></a>
359 <h4>TranslatorWidget.__updatePronounceButtons</h4>
360 <b>__updatePronounceButtons</b>(<i></i>)
361
362 <p>
363 Private slot to set the state of the pronounce buttons.
364 </p>
365 <a NAME="TranslatorWidget.__updateTranslateButton" ID="TranslatorWidget.__updateTranslateButton"></a>
366 <h4>TranslatorWidget.__updateTranslateButton</h4>
367 <b>__updateTranslateButton</b>(<i></i>)
368
369 <p>
370 Private slot to set the state of the translate button.
371 </p>
372 <a NAME="TranslatorWidget.on_clearButton_clicked" ID="TranslatorWidget.on_clearButton_clicked"></a>
373 <h4>TranslatorWidget.on_clearButton_clicked</h4>
374 <b>on_clearButton_clicked</b>(<i></i>)
375
376 <p>
377 Private slot to clear the text fields.
378 </p>
379 <a NAME="TranslatorWidget.on_origEdit_textChanged" ID="TranslatorWidget.on_origEdit_textChanged"></a>
380 <h4>TranslatorWidget.on_origEdit_textChanged</h4>
381 <b>on_origEdit_textChanged</b>(<i></i>)
382
383 <p>
384 Private slot to handle changes of the original text.
385 </p>
386 <a NAME="TranslatorWidget.on_origLanguageComboBox_currentIndexChanged" ID="TranslatorWidget.on_origLanguageComboBox_currentIndexChanged"></a>
387 <h4>TranslatorWidget.on_origLanguageComboBox_currentIndexChanged</h4>
388 <b>on_origLanguageComboBox_currentIndexChanged</b>(<i>index</i>)
389
390 <p>
391 Private slot to handle the selection of the original language.
392 </p>
393 <dl>
394
395 <dt><i>index</i> (int)</dt>
396 <dd>
397 current index
398 </dd>
399 </dl>
400 <a NAME="TranslatorWidget.on_preferencesButton_clicked" ID="TranslatorWidget.on_preferencesButton_clicked"></a>
401 <h4>TranslatorWidget.on_preferencesButton_clicked</h4>
402 <b>on_preferencesButton_clicked</b>(<i></i>)
403
404 <p>
405 Private slot to open the Translator configuration page.
406 </p>
407 <a NAME="TranslatorWidget.on_pronounceOrigButton_clicked" ID="TranslatorWidget.on_pronounceOrigButton_clicked"></a>
408 <h4>TranslatorWidget.on_pronounceOrigButton_clicked</h4>
409 <b>on_pronounceOrigButton_clicked</b>(<i></i>)
410
411 <p>
412 Private slot to pronounce the original text.
413 </p>
414 <a NAME="TranslatorWidget.on_pronounceTransButton_clicked" ID="TranslatorWidget.on_pronounceTransButton_clicked"></a>
415 <h4>TranslatorWidget.on_pronounceTransButton_clicked</h4>
416 <b>on_pronounceTransButton_clicked</b>(<i></i>)
417
418 <p>
419 Private slot to pronounce the translated text.
420 </p>
421 <a NAME="TranslatorWidget.on_swapButton_clicked" ID="TranslatorWidget.on_swapButton_clicked"></a>
422 <h4>TranslatorWidget.on_swapButton_clicked</h4>
423 <b>on_swapButton_clicked</b>(<i></i>)
424
425 <p>
426 Private slot to swap the languages.
427 </p>
428 <a NAME="TranslatorWidget.on_transEdit_textChanged" ID="TranslatorWidget.on_transEdit_textChanged"></a>
429 <h4>TranslatorWidget.on_transEdit_textChanged</h4>
430 <b>on_transEdit_textChanged</b>(<i></i>)
431
432 <p>
433 Private slot to handle changes of the translation text.
434 </p>
435 <a NAME="TranslatorWidget.on_transLanguageComboBox_currentIndexChanged" ID="TranslatorWidget.on_transLanguageComboBox_currentIndexChanged"></a>
436 <h4>TranslatorWidget.on_transLanguageComboBox_currentIndexChanged</h4>
437 <b>on_transLanguageComboBox_currentIndexChanged</b>(<i>index</i>)
438
439 <p>
440 Private slot to handle the selection of the translation language.
441 </p>
442 <dl>
443
444 <dt><i>index</i> (int)</dt>
445 <dd>
446 current index
447 </dd>
448 </dl>
449 <a NAME="TranslatorWidget.on_translateButton_clicked" ID="TranslatorWidget.on_translateButton_clicked"></a>
450 <h4>TranslatorWidget.on_translateButton_clicked</h4>
451 <b>on_translateButton_clicked</b>(<i></i>)
452
453 <p>
454 Private slot to translate the entered text.
455 </p>
456 <div align="right"><a href="#top">Up</a></div>
457 <hr />
458 </body></html>

eric ide

mercurial