|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.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><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.Plugins.UiExtensionPlugins.Translator.TranslatorWidget</h1> |
|
23 <p> |
|
24 Module implementing the translator widget. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#TranslatorWidget">TranslatorWidget</a></td> |
|
34 <td>Class implementing the translator widget.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <h3>Functions</h3> |
|
38 <table> |
|
39 <tr><td>None</td></tr> |
|
40 </table> |
|
41 <hr /><hr /> |
|
42 <a NAME="TranslatorWidget" ID="TranslatorWidget"></a> |
|
43 <h2>TranslatorWidget</h2> |
|
44 <p> |
|
45 Class implementing the translator widget. |
|
46 </p> |
|
47 <h3>Derived from</h3> |
|
48 QWidget, Ui_TranslatorWidget |
|
49 <h3>Class Attributes</h3> |
|
50 <table> |
|
51 <tr><td>None</td></tr> |
|
52 </table> |
|
53 <h3>Class Methods</h3> |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 <table> |
|
59 <tr> |
|
60 <td><a href="#TranslatorWidget.__init__">TranslatorWidget</a></td> |
|
61 <td>Constructor</td> |
|
62 </tr><tr> |
|
63 <td><a href="#TranslatorWidget.__engineComboBoxCurrentIndexChanged">__engineComboBoxCurrentIndexChanged</a></td> |
|
64 <td>Private slot to handle the selection of a translation service.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#TranslatorWidget.__mediaPlayerStateChanged">__mediaPlayerStateChanged</a></td> |
|
67 <td>Private slot handling changes of the media player state.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#TranslatorWidget.__originalLanguage">__originalLanguage</a></td> |
|
70 <td>Private method to return the code of the selected original language.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#TranslatorWidget.__pronounce">__pronounce</a></td> |
|
73 <td>Private method to pronounce the given text.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#TranslatorWidget.__translate">__translate</a></td> |
|
76 <td>Private method to translate the given text.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#TranslatorWidget.__translationLanguage">__translationLanguage</a></td> |
|
79 <td>Private method to return the code of the selected translation language.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#TranslatorWidget.__updateClearButton">__updateClearButton</a></td> |
|
82 <td>Private slot to set the state of the clear button.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#TranslatorWidget.__updateEngines">__updateEngines</a></td> |
|
85 <td>Private slot to update the engines combo box.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#TranslatorWidget.__updateLanguages">__updateLanguages</a></td> |
|
88 <td>Private slot to update the language combo boxes.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#TranslatorWidget.__updatePronounceButtons">__updatePronounceButtons</a></td> |
|
91 <td>Private slot to set the state of the pronounce buttons.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#TranslatorWidget.on_clearButton_clicked">on_clearButton_clicked</a></td> |
|
94 <td>Private slot to clear the text fields.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#TranslatorWidget.on_origEdit_textChanged">on_origEdit_textChanged</a></td> |
|
97 <td>Private slot to handle changes of the original text.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#TranslatorWidget.on_origLanguageComboBox_currentIndexChanged">on_origLanguageComboBox_currentIndexChanged</a></td> |
|
100 <td>Private slot to handle the selection of the original language.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#TranslatorWidget.on_pronounceOrigButton_clicked">on_pronounceOrigButton_clicked</a></td> |
|
103 <td>Private slot to pronounce the original text.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#TranslatorWidget.on_pronounceTransButton_clicked">on_pronounceTransButton_clicked</a></td> |
|
106 <td>Private slot to pronounce the translated text.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#TranslatorWidget.on_swapButton_clicked">on_swapButton_clicked</a></td> |
|
109 <td>Private slot to swap the languages.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#TranslatorWidget.on_transEdit_textChanged">on_transEdit_textChanged</a></td> |
|
112 <td>Private slot to handle changes of the translation text.</td> |
|
113 </tr><tr> |
|
114 <td><a href="#TranslatorWidget.on_transLanguageComboBox_currentIndexChanged">on_transLanguageComboBox_currentIndexChanged</a></td> |
|
115 <td>Private slot to handle the selection of the translation language.</td> |
|
116 </tr><tr> |
|
117 <td><a href="#TranslatorWidget.on_translateButton_clicked">on_translateButton_clicked</a></td> |
|
118 <td>Private slot to translate the entered text.</td> |
|
119 </tr> |
|
120 </table> |
|
121 <h3>Static Methods</h3> |
|
122 <table> |
|
123 <tr><td>None</td></tr> |
|
124 </table> |
|
125 <a NAME="TranslatorWidget.__init__" ID="TranslatorWidget.__init__"></a> |
|
126 <h4>TranslatorWidget (Constructor)</h4> |
|
127 <b>TranslatorWidget</b>(<i>plugin, translator, parent=None</i>) |
|
128 <p> |
|
129 Constructor |
|
130 </p><dl> |
|
131 <dt><i>plugin</i></dt> |
|
132 <dd> |
|
133 reference to the plugin object (TranslatorPlugin) |
|
134 </dd><dt><i>translator</i></dt> |
|
135 <dd> |
|
136 reference to the translator object (Translator) |
|
137 </dd><dt><i>parent</i></dt> |
|
138 <dd> |
|
139 reference to the parent widget (QWidget) |
|
140 </dd> |
|
141 </dl><a NAME="TranslatorWidget.__engineComboBoxCurrentIndexChanged" ID="TranslatorWidget.__engineComboBoxCurrentIndexChanged"></a> |
|
142 <h4>TranslatorWidget.__engineComboBoxCurrentIndexChanged</h4> |
|
143 <b>__engineComboBoxCurrentIndexChanged</b>(<i>index</i>) |
|
144 <p> |
|
145 Private slot to handle the selection of a translation service. |
|
146 </p><dl> |
|
147 <dt><i>index</i></dt> |
|
148 <dd> |
|
149 current index (integer) |
|
150 </dd> |
|
151 </dl><a NAME="TranslatorWidget.__mediaPlayerStateChanged" ID="TranslatorWidget.__mediaPlayerStateChanged"></a> |
|
152 <h4>TranslatorWidget.__mediaPlayerStateChanged</h4> |
|
153 <b>__mediaPlayerStateChanged</b>(<i>state</i>) |
|
154 <p> |
|
155 Private slot handling changes of the media player state. |
|
156 </p><dl> |
|
157 <dt><i>state</i></dt> |
|
158 <dd> |
|
159 media player state (QAudio.State) |
|
160 </dd> |
|
161 </dl><a NAME="TranslatorWidget.__originalLanguage" ID="TranslatorWidget.__originalLanguage"></a> |
|
162 <h4>TranslatorWidget.__originalLanguage</h4> |
|
163 <b>__originalLanguage</b>(<i></i>) |
|
164 <p> |
|
165 Private method to return the code of the selected original language. |
|
166 </p><dl> |
|
167 <dt>Returns:</dt> |
|
168 <dd> |
|
169 code of the original language (string) |
|
170 </dd> |
|
171 </dl><a NAME="TranslatorWidget.__pronounce" ID="TranslatorWidget.__pronounce"></a> |
|
172 <h4>TranslatorWidget.__pronounce</h4> |
|
173 <b>__pronounce</b>(<i>text, language</i>) |
|
174 <p> |
|
175 Private method to pronounce the given text. |
|
176 </p><dl> |
|
177 <dt><i>text</i></dt> |
|
178 <dd> |
|
179 text to be pronounced (string) |
|
180 </dd><dt><i>language</i></dt> |
|
181 <dd> |
|
182 language code of the text (string) |
|
183 </dd> |
|
184 </dl><a NAME="TranslatorWidget.__translate" ID="TranslatorWidget.__translate"></a> |
|
185 <h4>TranslatorWidget.__translate</h4> |
|
186 <b>__translate</b>(<i>text, originalLanguage, translationLanguage</i>) |
|
187 <p> |
|
188 Private method to translate the given text. |
|
189 </p><dl> |
|
190 <dt><i>text</i></dt> |
|
191 <dd> |
|
192 text to be translated (string) |
|
193 </dd><dt><i>originalLanguage</i></dt> |
|
194 <dd> |
|
195 language code of the original (string) |
|
196 </dd><dt><i>translationLanguage</i></dt> |
|
197 <dd> |
|
198 language code of the translation (string) |
|
199 </dd> |
|
200 </dl><dl> |
|
201 <dt>Returns:</dt> |
|
202 <dd> |
|
203 tuple of translated text (string) and flag indicating |
|
204 success (boolean) |
|
205 </dd> |
|
206 </dl><a NAME="TranslatorWidget.__translationLanguage" ID="TranslatorWidget.__translationLanguage"></a> |
|
207 <h4>TranslatorWidget.__translationLanguage</h4> |
|
208 <b>__translationLanguage</b>(<i></i>) |
|
209 <p> |
|
210 Private method to return the code of the selected translation language. |
|
211 </p><dl> |
|
212 <dt>Returns:</dt> |
|
213 <dd> |
|
214 code of the translation language (string) |
|
215 </dd> |
|
216 </dl><a NAME="TranslatorWidget.__updateClearButton" ID="TranslatorWidget.__updateClearButton"></a> |
|
217 <h4>TranslatorWidget.__updateClearButton</h4> |
|
218 <b>__updateClearButton</b>(<i></i>) |
|
219 <p> |
|
220 Private slot to set the state of the clear button. |
|
221 </p><a NAME="TranslatorWidget.__updateEngines" ID="TranslatorWidget.__updateEngines"></a> |
|
222 <h4>TranslatorWidget.__updateEngines</h4> |
|
223 <b>__updateEngines</b>(<i></i>) |
|
224 <p> |
|
225 Private slot to update the engines combo box. |
|
226 </p><a NAME="TranslatorWidget.__updateLanguages" ID="TranslatorWidget.__updateLanguages"></a> |
|
227 <h4>TranslatorWidget.__updateLanguages</h4> |
|
228 <b>__updateLanguages</b>(<i></i>) |
|
229 <p> |
|
230 Private slot to update the language combo boxes. |
|
231 </p><a NAME="TranslatorWidget.__updatePronounceButtons" ID="TranslatorWidget.__updatePronounceButtons"></a> |
|
232 <h4>TranslatorWidget.__updatePronounceButtons</h4> |
|
233 <b>__updatePronounceButtons</b>(<i></i>) |
|
234 <p> |
|
235 Private slot to set the state of the pronounce buttons. |
|
236 </p><a NAME="TranslatorWidget.on_clearButton_clicked" ID="TranslatorWidget.on_clearButton_clicked"></a> |
|
237 <h4>TranslatorWidget.on_clearButton_clicked</h4> |
|
238 <b>on_clearButton_clicked</b>(<i></i>) |
|
239 <p> |
|
240 Private slot to clear the text fields. |
|
241 </p><a NAME="TranslatorWidget.on_origEdit_textChanged" ID="TranslatorWidget.on_origEdit_textChanged"></a> |
|
242 <h4>TranslatorWidget.on_origEdit_textChanged</h4> |
|
243 <b>on_origEdit_textChanged</b>(<i></i>) |
|
244 <p> |
|
245 Private slot to handle changes of the original text. |
|
246 </p><a NAME="TranslatorWidget.on_origLanguageComboBox_currentIndexChanged" ID="TranslatorWidget.on_origLanguageComboBox_currentIndexChanged"></a> |
|
247 <h4>TranslatorWidget.on_origLanguageComboBox_currentIndexChanged</h4> |
|
248 <b>on_origLanguageComboBox_currentIndexChanged</b>(<i>index</i>) |
|
249 <p> |
|
250 Private slot to handle the selection of the original language. |
|
251 </p><dl> |
|
252 <dt><i>index</i></dt> |
|
253 <dd> |
|
254 current index (integer) |
|
255 </dd> |
|
256 </dl><a NAME="TranslatorWidget.on_pronounceOrigButton_clicked" ID="TranslatorWidget.on_pronounceOrigButton_clicked"></a> |
|
257 <h4>TranslatorWidget.on_pronounceOrigButton_clicked</h4> |
|
258 <b>on_pronounceOrigButton_clicked</b>(<i></i>) |
|
259 <p> |
|
260 Private slot to pronounce the original text. |
|
261 </p><a NAME="TranslatorWidget.on_pronounceTransButton_clicked" ID="TranslatorWidget.on_pronounceTransButton_clicked"></a> |
|
262 <h4>TranslatorWidget.on_pronounceTransButton_clicked</h4> |
|
263 <b>on_pronounceTransButton_clicked</b>(<i></i>) |
|
264 <p> |
|
265 Private slot to pronounce the translated text. |
|
266 </p><a NAME="TranslatorWidget.on_swapButton_clicked" ID="TranslatorWidget.on_swapButton_clicked"></a> |
|
267 <h4>TranslatorWidget.on_swapButton_clicked</h4> |
|
268 <b>on_swapButton_clicked</b>(<i></i>) |
|
269 <p> |
|
270 Private slot to swap the languages. |
|
271 </p><a NAME="TranslatorWidget.on_transEdit_textChanged" ID="TranslatorWidget.on_transEdit_textChanged"></a> |
|
272 <h4>TranslatorWidget.on_transEdit_textChanged</h4> |
|
273 <b>on_transEdit_textChanged</b>(<i></i>) |
|
274 <p> |
|
275 Private slot to handle changes of the translation text. |
|
276 </p><a NAME="TranslatorWidget.on_transLanguageComboBox_currentIndexChanged" ID="TranslatorWidget.on_transLanguageComboBox_currentIndexChanged"></a> |
|
277 <h4>TranslatorWidget.on_transLanguageComboBox_currentIndexChanged</h4> |
|
278 <b>on_transLanguageComboBox_currentIndexChanged</b>(<i>index</i>) |
|
279 <p> |
|
280 Private slot to handle the selection of the translation language. |
|
281 </p><dl> |
|
282 <dt><i>index</i></dt> |
|
283 <dd> |
|
284 current index (integer) |
|
285 </dd> |
|
286 </dl><a NAME="TranslatorWidget.on_translateButton_clicked" ID="TranslatorWidget.on_translateButton_clicked"></a> |
|
287 <h4>TranslatorWidget.on_translateButton_clicked</h4> |
|
288 <b>on_translateButton_clicked</b>(<i></i>) |
|
289 <p> |
|
290 Private slot to translate the entered text. |
|
291 </p> |
|
292 <div align="right"><a href="#top">Up</a></div> |
|
293 <hr /> |
|
294 </body></html> |