|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.Helpviewer.Download.DownloadItem</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.Helpviewer.Download.DownloadItem</h1> |
|
23 <p> |
|
24 Module implementing a widget controlling a download. |
|
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="#DownloadItem">DownloadItem</a></td> |
|
34 <td>Class implementing a widget controlling a download.</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="DownloadItem" ID="DownloadItem"></a> |
|
43 <h2>DownloadItem</h2> |
|
44 <p> |
|
45 Class implementing a widget controlling a download. |
|
46 </p><h3>Signals</h3> |
|
47 <dl> |
|
48 <dt>downloadFinished()</dt> |
|
49 <dd> |
|
50 emitted when a download finished |
|
51 </dd><dt>progress(int, int)</dt> |
|
52 <dd> |
|
53 emitted to signal the download progress |
|
54 </dd><dt>statusChanged()</dt> |
|
55 <dd> |
|
56 emitted upon a status change of a download |
|
57 </dd> |
|
58 </dl> |
|
59 <h3>Derived from</h3> |
|
60 QWidget, Ui_DownloadItem |
|
61 <h3>Class Attributes</h3> |
|
62 <table> |
|
63 <tr><td>DownloadCancelled</td></tr><tr><td>DownloadSuccessful</td></tr><tr><td>Downloading</td></tr> |
|
64 </table> |
|
65 <h3>Class Methods</h3> |
|
66 <table> |
|
67 <tr><td>None</td></tr> |
|
68 </table> |
|
69 <h3>Methods</h3> |
|
70 <table> |
|
71 <tr> |
|
72 <td><a href="#DownloadItem.__init__">DownloadItem</a></td> |
|
73 <td>Constructor</td> |
|
74 </tr><tr> |
|
75 <td><a href="#DownloadItem.__downloadProgress">__downloadProgress</a></td> |
|
76 <td>Private method to show the download progress.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#DownloadItem.__finished">__finished</a></td> |
|
79 <td>Private slot to handle the download finished.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#DownloadItem.__getFileName">__getFileName</a></td> |
|
82 <td>Private method to get the file name to save to from the user.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#DownloadItem.__initialize">__initialize</a></td> |
|
85 <td>Private method to (re)initialize the widget.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#DownloadItem.__metaDataChanged">__metaDataChanged</a></td> |
|
88 <td>Private slot to handle a change of the meta data.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#DownloadItem.__networkError">__networkError</a></td> |
|
91 <td>Private slot to handle a network error.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#DownloadItem.__open">__open</a></td> |
|
94 <td>Private slot to open the downloaded file.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#DownloadItem.__readyRead">__readyRead</a></td> |
|
97 <td>Private slot to read the available data.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#DownloadItem.__saveFileName">__saveFileName</a></td> |
|
100 <td>Private method to calculate a name for the file to download.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#DownloadItem.__updateInfoLabel">__updateInfoLabel</a></td> |
|
103 <td>Private method to update the info label.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#DownloadItem.absoluteFilePath">absoluteFilePath</a></td> |
|
106 <td>Public method to get the absolute path of the output file.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#DownloadItem.bytesReceived">bytesReceived</a></td> |
|
109 <td>Public method to get the number of bytes received.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#DownloadItem.bytesTotal">bytesTotal</a></td> |
|
112 <td>Public method to get the total number of bytes of the download.</td> |
|
113 </tr><tr> |
|
114 <td><a href="#DownloadItem.cancelDownload">cancelDownload</a></td> |
|
115 <td>Public slot to stop the download.</td> |
|
116 </tr><tr> |
|
117 <td><a href="#DownloadItem.canceledFileSelect">canceledFileSelect</a></td> |
|
118 <td>Public method to check, if the user canceled the file selection.</td> |
|
119 </tr><tr> |
|
120 <td><a href="#DownloadItem.currentSpeed">currentSpeed</a></td> |
|
121 <td>Public method to get an estimation for the download speed.</td> |
|
122 </tr><tr> |
|
123 <td><a href="#DownloadItem.downloadCanceled">downloadCanceled</a></td> |
|
124 <td>Public method to check, if the download was cancelled.</td> |
|
125 </tr><tr> |
|
126 <td><a href="#DownloadItem.downloadedSuccessfully">downloadedSuccessfully</a></td> |
|
127 <td>Public method to check for a successful download.</td> |
|
128 </tr><tr> |
|
129 <td><a href="#DownloadItem.downloading">downloading</a></td> |
|
130 <td>Public method to determine, if a download is in progress.</td> |
|
131 </tr><tr> |
|
132 <td><a href="#DownloadItem.fileName">fileName</a></td> |
|
133 <td>Public method to get the name of the output file.</td> |
|
134 </tr><tr> |
|
135 <td><a href="#DownloadItem.getData">getData</a></td> |
|
136 <td>Public method to get the relevant download data.</td> |
|
137 </tr><tr> |
|
138 <td><a href="#DownloadItem.getInfoData">getInfoData</a></td> |
|
139 <td>Public method to get the text of the info label.</td> |
|
140 </tr><tr> |
|
141 <td><a href="#DownloadItem.getPageUrl">getPageUrl</a></td> |
|
142 <td>Public method to get the URL of the download page.</td> |
|
143 </tr><tr> |
|
144 <td><a href="#DownloadItem.on_openButton_clicked">on_openButton_clicked</a></td> |
|
145 <td>Private slot to open the downloaded file.</td> |
|
146 </tr><tr> |
|
147 <td><a href="#DownloadItem.on_pauseButton_clicked">on_pauseButton_clicked</a></td> |
|
148 <td>Private slot to pause the download.</td> |
|
149 </tr><tr> |
|
150 <td><a href="#DownloadItem.on_stopButton_clicked">on_stopButton_clicked</a></td> |
|
151 <td>Private slot to stop the download.</td> |
|
152 </tr><tr> |
|
153 <td><a href="#DownloadItem.on_tryAgainButton_clicked">on_tryAgainButton_clicked</a></td> |
|
154 <td>Private slot to retry the download.</td> |
|
155 </tr><tr> |
|
156 <td><a href="#DownloadItem.openFile">openFile</a></td> |
|
157 <td>Public slot to open the downloaded file.</td> |
|
158 </tr><tr> |
|
159 <td><a href="#DownloadItem.openFolder">openFolder</a></td> |
|
160 <td>Public slot to open the folder containing the downloaded file.</td> |
|
161 </tr><tr> |
|
162 <td><a href="#DownloadItem.remainingTime">remainingTime</a></td> |
|
163 <td>Public method to get an estimation for the remaining time.</td> |
|
164 </tr><tr> |
|
165 <td><a href="#DownloadItem.retry">retry</a></td> |
|
166 <td>Public slot to retry the download.</td> |
|
167 </tr><tr> |
|
168 <td><a href="#DownloadItem.setData">setData</a></td> |
|
169 <td>Public method to set the relevant download data.</td> |
|
170 </tr><tr> |
|
171 <td><a href="#DownloadItem.setIcon">setIcon</a></td> |
|
172 <td>Public method to set the download icon.</td> |
|
173 </tr> |
|
174 </table> |
|
175 <h3>Static Methods</h3> |
|
176 <table> |
|
177 <tr><td>None</td></tr> |
|
178 </table> |
|
179 <a NAME="DownloadItem.__init__" ID="DownloadItem.__init__"></a> |
|
180 <h4>DownloadItem (Constructor)</h4> |
|
181 <b>DownloadItem</b>(<i>reply=None, requestFilename=False, webPage=None, download=False, parent=None, mainWindow=None</i>) |
|
182 <p> |
|
183 Constructor |
|
184 </p><dl> |
|
185 <dt><i>reply=</i></dt> |
|
186 <dd> |
|
187 reference to the network reply object (QNetworkReply) |
|
188 </dd><dt><i>requestFilename=</i></dt> |
|
189 <dd> |
|
190 flag indicating to ask the user for a |
|
191 filename (boolean) |
|
192 </dd><dt><i>webPage=</i></dt> |
|
193 <dd> |
|
194 reference to the web page object the download |
|
195 originated from (QWebPage) |
|
196 </dd><dt><i>download=</i></dt> |
|
197 <dd> |
|
198 flag indicating a download operation (boolean) |
|
199 </dd><dt><i>parent=</i></dt> |
|
200 <dd> |
|
201 reference to the parent widget (QWidget) |
|
202 </dd><dt><i>mainWindow=</i></dt> |
|
203 <dd> |
|
204 reference to the main window (HelpWindow) |
|
205 </dd> |
|
206 </dl><a NAME="DownloadItem.__downloadProgress" ID="DownloadItem.__downloadProgress"></a> |
|
207 <h4>DownloadItem.__downloadProgress</h4> |
|
208 <b>__downloadProgress</b>(<i>bytesReceived, bytesTotal</i>) |
|
209 <p> |
|
210 Private method to show the download progress. |
|
211 </p><dl> |
|
212 <dt><i>bytesReceived</i></dt> |
|
213 <dd> |
|
214 number of bytes received (integer) |
|
215 </dd><dt><i>bytesTotal</i></dt> |
|
216 <dd> |
|
217 number of total bytes (integer) |
|
218 </dd> |
|
219 </dl><a NAME="DownloadItem.__finished" ID="DownloadItem.__finished"></a> |
|
220 <h4>DownloadItem.__finished</h4> |
|
221 <b>__finished</b>(<i></i>) |
|
222 <p> |
|
223 Private slot to handle the download finished. |
|
224 </p><a NAME="DownloadItem.__getFileName" ID="DownloadItem.__getFileName"></a> |
|
225 <h4>DownloadItem.__getFileName</h4> |
|
226 <b>__getFileName</b>(<i></i>) |
|
227 <p> |
|
228 Private method to get the file name to save to from the user. |
|
229 </p><a NAME="DownloadItem.__initialize" ID="DownloadItem.__initialize"></a> |
|
230 <h4>DownloadItem.__initialize</h4> |
|
231 <b>__initialize</b>(<i>tryAgain=False</i>) |
|
232 <p> |
|
233 Private method to (re)initialize the widget. |
|
234 </p><dl> |
|
235 <dt><i>tryAgain</i></dt> |
|
236 <dd> |
|
237 flag indicating a retry (boolean) |
|
238 </dd> |
|
239 </dl><a NAME="DownloadItem.__metaDataChanged" ID="DownloadItem.__metaDataChanged"></a> |
|
240 <h4>DownloadItem.__metaDataChanged</h4> |
|
241 <b>__metaDataChanged</b>(<i></i>) |
|
242 <p> |
|
243 Private slot to handle a change of the meta data. |
|
244 </p><a NAME="DownloadItem.__networkError" ID="DownloadItem.__networkError"></a> |
|
245 <h4>DownloadItem.__networkError</h4> |
|
246 <b>__networkError</b>(<i></i>) |
|
247 <p> |
|
248 Private slot to handle a network error. |
|
249 </p><a NAME="DownloadItem.__open" ID="DownloadItem.__open"></a> |
|
250 <h4>DownloadItem.__open</h4> |
|
251 <b>__open</b>(<i></i>) |
|
252 <p> |
|
253 Private slot to open the downloaded file. |
|
254 </p><a NAME="DownloadItem.__readyRead" ID="DownloadItem.__readyRead"></a> |
|
255 <h4>DownloadItem.__readyRead</h4> |
|
256 <b>__readyRead</b>(<i></i>) |
|
257 <p> |
|
258 Private slot to read the available data. |
|
259 </p><a NAME="DownloadItem.__saveFileName" ID="DownloadItem.__saveFileName"></a> |
|
260 <h4>DownloadItem.__saveFileName</h4> |
|
261 <b>__saveFileName</b>(<i>directory</i>) |
|
262 <p> |
|
263 Private method to calculate a name for the file to download. |
|
264 </p><dl> |
|
265 <dt><i>directory</i></dt> |
|
266 <dd> |
|
267 name of the directory to store the file into (string) |
|
268 </dd> |
|
269 </dl><dl> |
|
270 <dt>Returns:</dt> |
|
271 <dd> |
|
272 proposed filename and original filename (string, string) |
|
273 </dd> |
|
274 </dl><a NAME="DownloadItem.__updateInfoLabel" ID="DownloadItem.__updateInfoLabel"></a> |
|
275 <h4>DownloadItem.__updateInfoLabel</h4> |
|
276 <b>__updateInfoLabel</b>(<i></i>) |
|
277 <p> |
|
278 Private method to update the info label. |
|
279 </p><a NAME="DownloadItem.absoluteFilePath" ID="DownloadItem.absoluteFilePath"></a> |
|
280 <h4>DownloadItem.absoluteFilePath</h4> |
|
281 <b>absoluteFilePath</b>(<i></i>) |
|
282 <p> |
|
283 Public method to get the absolute path of the output file. |
|
284 </p><dl> |
|
285 <dt>Returns:</dt> |
|
286 <dd> |
|
287 absolute path of the output file (string) |
|
288 </dd> |
|
289 </dl><a NAME="DownloadItem.bytesReceived" ID="DownloadItem.bytesReceived"></a> |
|
290 <h4>DownloadItem.bytesReceived</h4> |
|
291 <b>bytesReceived</b>(<i></i>) |
|
292 <p> |
|
293 Public method to get the number of bytes received. |
|
294 </p><dl> |
|
295 <dt>Returns:</dt> |
|
296 <dd> |
|
297 number of bytes received (integer) |
|
298 </dd> |
|
299 </dl><a NAME="DownloadItem.bytesTotal" ID="DownloadItem.bytesTotal"></a> |
|
300 <h4>DownloadItem.bytesTotal</h4> |
|
301 <b>bytesTotal</b>(<i></i>) |
|
302 <p> |
|
303 Public method to get the total number of bytes of the download. |
|
304 </p><dl> |
|
305 <dt>Returns:</dt> |
|
306 <dd> |
|
307 total number of bytes (integer) |
|
308 </dd> |
|
309 </dl><a NAME="DownloadItem.cancelDownload" ID="DownloadItem.cancelDownload"></a> |
|
310 <h4>DownloadItem.cancelDownload</h4> |
|
311 <b>cancelDownload</b>(<i></i>) |
|
312 <p> |
|
313 Public slot to stop the download. |
|
314 </p><a NAME="DownloadItem.canceledFileSelect" ID="DownloadItem.canceledFileSelect"></a> |
|
315 <h4>DownloadItem.canceledFileSelect</h4> |
|
316 <b>canceledFileSelect</b>(<i></i>) |
|
317 <p> |
|
318 Public method to check, if the user canceled the file selection. |
|
319 </p><dl> |
|
320 <dt>Returns:</dt> |
|
321 <dd> |
|
322 flag indicating cancellation (boolean) |
|
323 </dd> |
|
324 </dl><a NAME="DownloadItem.currentSpeed" ID="DownloadItem.currentSpeed"></a> |
|
325 <h4>DownloadItem.currentSpeed</h4> |
|
326 <b>currentSpeed</b>(<i></i>) |
|
327 <p> |
|
328 Public method to get an estimation for the download speed. |
|
329 </p><dl> |
|
330 <dt>Returns:</dt> |
|
331 <dd> |
|
332 estimation for the download speed (float) |
|
333 </dd> |
|
334 </dl><a NAME="DownloadItem.downloadCanceled" ID="DownloadItem.downloadCanceled"></a> |
|
335 <h4>DownloadItem.downloadCanceled</h4> |
|
336 <b>downloadCanceled</b>(<i></i>) |
|
337 <p> |
|
338 Public method to check, if the download was cancelled. |
|
339 </p><dl> |
|
340 <dt>Returns:</dt> |
|
341 <dd> |
|
342 flag indicating a canceled download (boolean) |
|
343 </dd> |
|
344 </dl><a NAME="DownloadItem.downloadedSuccessfully" ID="DownloadItem.downloadedSuccessfully"></a> |
|
345 <h4>DownloadItem.downloadedSuccessfully</h4> |
|
346 <b>downloadedSuccessfully</b>(<i></i>) |
|
347 <p> |
|
348 Public method to check for a successful download. |
|
349 </p><dl> |
|
350 <dt>Returns:</dt> |
|
351 <dd> |
|
352 flag indicating a successful download (boolean) |
|
353 </dd> |
|
354 </dl><a NAME="DownloadItem.downloading" ID="DownloadItem.downloading"></a> |
|
355 <h4>DownloadItem.downloading</h4> |
|
356 <b>downloading</b>(<i></i>) |
|
357 <p> |
|
358 Public method to determine, if a download is in progress. |
|
359 </p><dl> |
|
360 <dt>Returns:</dt> |
|
361 <dd> |
|
362 flag indicating a download is in progress (boolean) |
|
363 </dd> |
|
364 </dl><a NAME="DownloadItem.fileName" ID="DownloadItem.fileName"></a> |
|
365 <h4>DownloadItem.fileName</h4> |
|
366 <b>fileName</b>(<i></i>) |
|
367 <p> |
|
368 Public method to get the name of the output file. |
|
369 </p><dl> |
|
370 <dt>Returns:</dt> |
|
371 <dd> |
|
372 name of the output file (string) |
|
373 </dd> |
|
374 </dl><a NAME="DownloadItem.getData" ID="DownloadItem.getData"></a> |
|
375 <h4>DownloadItem.getData</h4> |
|
376 <b>getData</b>(<i></i>) |
|
377 <p> |
|
378 Public method to get the relevant download data. |
|
379 </p><dl> |
|
380 <dt>Returns:</dt> |
|
381 <dd> |
|
382 tuple of URL, save location, flag and the |
|
383 URL of the related web page (QUrl, string, boolean,QUrl) |
|
384 </dd> |
|
385 </dl><a NAME="DownloadItem.getInfoData" ID="DownloadItem.getInfoData"></a> |
|
386 <h4>DownloadItem.getInfoData</h4> |
|
387 <b>getInfoData</b>(<i></i>) |
|
388 <p> |
|
389 Public method to get the text of the info label. |
|
390 </p><dl> |
|
391 <dt>Returns:</dt> |
|
392 <dd> |
|
393 text of the info label (string) |
|
394 </dd> |
|
395 </dl><a NAME="DownloadItem.getPageUrl" ID="DownloadItem.getPageUrl"></a> |
|
396 <h4>DownloadItem.getPageUrl</h4> |
|
397 <b>getPageUrl</b>(<i></i>) |
|
398 <p> |
|
399 Public method to get the URL of the download page. |
|
400 </p><dl> |
|
401 <dt>Returns:</dt> |
|
402 <dd> |
|
403 URL of the download page (QUrl) |
|
404 </dd> |
|
405 </dl><a NAME="DownloadItem.on_openButton_clicked" ID="DownloadItem.on_openButton_clicked"></a> |
|
406 <h4>DownloadItem.on_openButton_clicked</h4> |
|
407 <b>on_openButton_clicked</b>(<i></i>) |
|
408 <p> |
|
409 Private slot to open the downloaded file. |
|
410 </p><a NAME="DownloadItem.on_pauseButton_clicked" ID="DownloadItem.on_pauseButton_clicked"></a> |
|
411 <h4>DownloadItem.on_pauseButton_clicked</h4> |
|
412 <b>on_pauseButton_clicked</b>(<i>checked</i>) |
|
413 <p> |
|
414 Private slot to pause the download. |
|
415 </p><dl> |
|
416 <dt><i>checked</i></dt> |
|
417 <dd> |
|
418 flag indicating the state of the button (boolean) |
|
419 </dd> |
|
420 </dl><a NAME="DownloadItem.on_stopButton_clicked" ID="DownloadItem.on_stopButton_clicked"></a> |
|
421 <h4>DownloadItem.on_stopButton_clicked</h4> |
|
422 <b>on_stopButton_clicked</b>(<i></i>) |
|
423 <p> |
|
424 Private slot to stop the download. |
|
425 </p><a NAME="DownloadItem.on_tryAgainButton_clicked" ID="DownloadItem.on_tryAgainButton_clicked"></a> |
|
426 <h4>DownloadItem.on_tryAgainButton_clicked</h4> |
|
427 <b>on_tryAgainButton_clicked</b>(<i></i>) |
|
428 <p> |
|
429 Private slot to retry the download. |
|
430 </p><a NAME="DownloadItem.openFile" ID="DownloadItem.openFile"></a> |
|
431 <h4>DownloadItem.openFile</h4> |
|
432 <b>openFile</b>(<i></i>) |
|
433 <p> |
|
434 Public slot to open the downloaded file. |
|
435 </p><a NAME="DownloadItem.openFolder" ID="DownloadItem.openFolder"></a> |
|
436 <h4>DownloadItem.openFolder</h4> |
|
437 <b>openFolder</b>(<i></i>) |
|
438 <p> |
|
439 Public slot to open the folder containing the downloaded file. |
|
440 </p><a NAME="DownloadItem.remainingTime" ID="DownloadItem.remainingTime"></a> |
|
441 <h4>DownloadItem.remainingTime</h4> |
|
442 <b>remainingTime</b>(<i></i>) |
|
443 <p> |
|
444 Public method to get an estimation for the remaining time. |
|
445 </p><dl> |
|
446 <dt>Returns:</dt> |
|
447 <dd> |
|
448 estimation for the remaining time (float) |
|
449 </dd> |
|
450 </dl><a NAME="DownloadItem.retry" ID="DownloadItem.retry"></a> |
|
451 <h4>DownloadItem.retry</h4> |
|
452 <b>retry</b>(<i></i>) |
|
453 <p> |
|
454 Public slot to retry the download. |
|
455 </p><a NAME="DownloadItem.setData" ID="DownloadItem.setData"></a> |
|
456 <h4>DownloadItem.setData</h4> |
|
457 <b>setData</b>(<i>data</i>) |
|
458 <p> |
|
459 Public method to set the relevant download data. |
|
460 </p><dl> |
|
461 <dt><i>data</i></dt> |
|
462 <dd> |
|
463 tuple of URL, save location, flag and the |
|
464 URL of the related web page (QUrl, string, boolean, QUrl) |
|
465 </dd> |
|
466 </dl><a NAME="DownloadItem.setIcon" ID="DownloadItem.setIcon"></a> |
|
467 <h4>DownloadItem.setIcon</h4> |
|
468 <b>setIcon</b>(<i>icon</i>) |
|
469 <p> |
|
470 Public method to set the download icon. |
|
471 </p><dl> |
|
472 <dt><i>icon</i></dt> |
|
473 <dd> |
|
474 reference to the icon to be set (QIcon) |
|
475 </dd> |
|
476 </dl> |
|
477 <div align="right"><a href="#top">Up</a></div> |
|
478 <hr /> |
|
479 </body></html> |