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

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

eric ide

mercurial