src/eric7/Documentation/Source/eric7.WebBrowser.Download.DownloadItem.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8596
d64760b2da50
child 9566
d4986df5d2e4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.WebBrowser.Download.DownloadItem</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.WebBrowser.Download.DownloadItem</h1>
10
11 <p>
12 Module implementing a widget controlling a download.
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="#DownloadItem">DownloadItem</a></td>
25 <td>Class implementing a widget controlling a download.</td>
26 </tr>
27 <tr>
28 <td><a href="#DownloadState">DownloadState</a></td>
29 <td>Class implementing the various download states.</td>
30 </tr>
31 </table>
32 <h3>Functions</h3>
33
34 <table>
35 <tr><td>None</td></tr>
36 </table>
37 <hr />
38 <hr />
39 <a NAME="DownloadItem" ID="DownloadItem"></a>
40 <h2>DownloadItem</h2>
41
42 <p>
43 Class implementing a widget controlling a download.
44 </p>
45 <h3>Signals</h3>
46 <dl>
47
48 <dt>downloadFinished(success)</dt>
49 <dd>
50 emitted when a download finished
51 </dd>
52 <dt>progress(int, int)</dt>
53 <dd>
54 emitted to signal the download progress
55 </dd>
56 <dt>statusChanged()</dt>
57 <dd>
58 emitted upon a status change of a download
59 </dd>
60 </dl>
61 <h3>Derived from</h3>
62 QWidget, Ui_DownloadItem
63 <h3>Class Attributes</h3>
64
65 <table>
66 <tr><td>None</td></tr>
67 </table>
68 <h3>Class Methods</h3>
69
70 <table>
71 <tr><td>None</td></tr>
72 </table>
73 <h3>Methods</h3>
74
75 <table>
76
77 <tr>
78 <td><a href="#DownloadItem.__init__">DownloadItem</a></td>
79 <td>Constructor</td>
80 </tr>
81 <tr>
82 <td><a href="#DownloadItem.__adjustSize">__adjustSize</a></td>
83 <td>Private method to adjust the size of the download item.</td>
84 </tr>
85 <tr>
86 <td><a href="#DownloadItem.__downloadProgress">__downloadProgress</a></td>
87 <td>Private slot to show the download progress.</td>
88 </tr>
89 <tr>
90 <td><a href="#DownloadItem.__finished">__finished</a></td>
91 <td>Private slot to handle the download finished.</td>
92 </tr>
93 <tr>
94 <td><a href="#DownloadItem.__getFileName">__getFileName</a></td>
95 <td>Private method to get the file name to save to from the user.</td>
96 </tr>
97 <tr>
98 <td><a href="#DownloadItem.__initialize">__initialize</a></td>
99 <td>Private method to initialize the widget.</td>
100 </tr>
101 <tr>
102 <td><a href="#DownloadItem.__saveFileName">__saveFileName</a></td>
103 <td>Private method to calculate a name for the file to download.</td>
104 </tr>
105 <tr>
106 <td><a href="#DownloadItem.__setDateTime">__setDateTime</a></td>
107 <td>Private method to set the download date and time.</td>
108 </tr>
109 <tr>
110 <td><a href="#DownloadItem.__setFileName">__setFileName</a></td>
111 <td>Private method to set the file name to save the download into.</td>
112 </tr>
113 <tr>
114 <td><a href="#DownloadItem.__updateInfoLabel">__updateInfoLabel</a></td>
115 <td>Private method to update the info label.</td>
116 </tr>
117 <tr>
118 <td><a href="#DownloadItem.absoluteFilePath">absoluteFilePath</a></td>
119 <td>Public method to get the absolute path of the output file.</td>
120 </tr>
121 <tr>
122 <td><a href="#DownloadItem.bytesReceived">bytesReceived</a></td>
123 <td>Public method to get the number of bytes received.</td>
124 </tr>
125 <tr>
126 <td><a href="#DownloadItem.bytesTotal">bytesTotal</a></td>
127 <td>Public method to get the total number of bytes of the download.</td>
128 </tr>
129 <tr>
130 <td><a href="#DownloadItem.cancelDownload">cancelDownload</a></td>
131 <td>Public slot to stop the download.</td>
132 </tr>
133 <tr>
134 <td><a href="#DownloadItem.canceledFileSelect">canceledFileSelect</a></td>
135 <td>Public method to check, if the user canceled the file selection.</td>
136 </tr>
137 <tr>
138 <td><a href="#DownloadItem.currentSpeed">currentSpeed</a></td>
139 <td>Public method to get an estimation for the download speed.</td>
140 </tr>
141 <tr>
142 <td><a href="#DownloadItem.downloadCanceled">downloadCanceled</a></td>
143 <td>Public method to check, if the download was cancelled.</td>
144 </tr>
145 <tr>
146 <td><a href="#DownloadItem.downloadProgress">downloadProgress</a></td>
147 <td>Public method to get the download progress.</td>
148 </tr>
149 <tr>
150 <td><a href="#DownloadItem.downloadedSuccessfully">downloadedSuccessfully</a></td>
151 <td>Public method to check for a successful download.</td>
152 </tr>
153 <tr>
154 <td><a href="#DownloadItem.downloading">downloading</a></td>
155 <td>Public method to determine, if a download is in progress.</td>
156 </tr>
157 <tr>
158 <td><a href="#DownloadItem.fileName">fileName</a></td>
159 <td>Public method to get the name of the output file.</td>
160 </tr>
161 <tr>
162 <td><a href="#DownloadItem.getData">getData</a></td>
163 <td>Public method to get the relevant download data.</td>
164 </tr>
165 <tr>
166 <td><a href="#DownloadItem.getInfoData">getInfoData</a></td>
167 <td>Public method to get the text of the info label.</td>
168 </tr>
169 <tr>
170 <td><a href="#DownloadItem.getPageUrl">getPageUrl</a></td>
171 <td>Public method to get the URL of the download page.</td>
172 </tr>
173 <tr>
174 <td><a href="#DownloadItem.on_openButton_clicked">on_openButton_clicked</a></td>
175 <td>Private slot to open the downloaded file.</td>
176 </tr>
177 <tr>
178 <td><a href="#DownloadItem.on_pauseButton_clicked">on_pauseButton_clicked</a></td>
179 <td>Private slot to pause the download.</td>
180 </tr>
181 <tr>
182 <td><a href="#DownloadItem.on_stopButton_clicked">on_stopButton_clicked</a></td>
183 <td>Private slot to stop the download.</td>
184 </tr>
185 <tr>
186 <td><a href="#DownloadItem.openFile">openFile</a></td>
187 <td>Public slot to open the downloaded file.</td>
188 </tr>
189 <tr>
190 <td><a href="#DownloadItem.openFolder">openFolder</a></td>
191 <td>Public slot to open the folder containing the downloaded file.</td>
192 </tr>
193 <tr>
194 <td><a href="#DownloadItem.remainingTime">remainingTime</a></td>
195 <td>Public method to get an estimation for the remaining time.</td>
196 </tr>
197 <tr>
198 <td><a href="#DownloadItem.setData">setData</a></td>
199 <td>Public method to set the relevant download data.</td>
200 </tr>
201 <tr>
202 <td><a href="#DownloadItem.setIcon">setIcon</a></td>
203 <td>Public method to set the download icon.</td>
204 </tr>
205 </table>
206 <h3>Static Methods</h3>
207
208 <table>
209 <tr><td>None</td></tr>
210 </table>
211
212 <a NAME="DownloadItem.__init__" ID="DownloadItem.__init__"></a>
213 <h4>DownloadItem (Constructor)</h4>
214 <b>DownloadItem</b>(<i>downloadRequest=None, pageUrl=None, parent=None</i>)
215
216 <p>
217 Constructor
218 </p>
219 <dl>
220
221 <dt><i>downloadRequest</i> (QWebEngineDownloadRequest)</dt>
222 <dd>
223 reference to the download object containing the
224 download data.
225 </dd>
226 <dt><i>pageUrl</i> (QUrl)</dt>
227 <dd>
228 URL of the calling page
229 </dd>
230 <dt><i>parent</i> (QWidget)</dt>
231 <dd>
232 reference to the parent widget
233 </dd>
234 </dl>
235 <a NAME="DownloadItem.__adjustSize" ID="DownloadItem.__adjustSize"></a>
236 <h4>DownloadItem.__adjustSize</h4>
237 <b>__adjustSize</b>(<i></i>)
238
239 <p>
240 Private method to adjust the size of the download item.
241 </p>
242 <a NAME="DownloadItem.__downloadProgress" ID="DownloadItem.__downloadProgress"></a>
243 <h4>DownloadItem.__downloadProgress</h4>
244 <b>__downloadProgress</b>(<i></i>)
245
246 <p>
247 Private slot to show the download progress.
248 </p>
249 <a NAME="DownloadItem.__finished" ID="DownloadItem.__finished"></a>
250 <h4>DownloadItem.__finished</h4>
251 <b>__finished</b>(<i></i>)
252
253 <p>
254 Private slot to handle the download finished.
255 </p>
256 <a NAME="DownloadItem.__getFileName" ID="DownloadItem.__getFileName"></a>
257 <h4>DownloadItem.__getFileName</h4>
258 <b>__getFileName</b>(<i></i>)
259
260 <p>
261 Private method to get the file name to save to from the user.
262 </p>
263 <a NAME="DownloadItem.__initialize" ID="DownloadItem.__initialize"></a>
264 <h4>DownloadItem.__initialize</h4>
265 <b>__initialize</b>(<i></i>)
266
267 <p>
268 Private method to initialize the widget.
269 </p>
270 <a NAME="DownloadItem.__saveFileName" ID="DownloadItem.__saveFileName"></a>
271 <h4>DownloadItem.__saveFileName</h4>
272 <b>__saveFileName</b>(<i>directory</i>)
273
274 <p>
275 Private method to calculate a name for the file to download.
276 </p>
277 <dl>
278
279 <dt><i>directory</i></dt>
280 <dd>
281 name of the directory to store the file into (string)
282 </dd>
283 </dl>
284 <dl>
285 <dt>Return:</dt>
286 <dd>
287 proposed filename and original filename (string, string)
288 </dd>
289 </dl>
290 <a NAME="DownloadItem.__setDateTime" ID="DownloadItem.__setDateTime"></a>
291 <h4>DownloadItem.__setDateTime</h4>
292 <b>__setDateTime</b>(<i>dateTime=None</i>)
293
294 <p>
295 Private method to set the download date and time.
296 </p>
297 <dl>
298
299 <dt><i>dateTime</i> (QDateTime)</dt>
300 <dd>
301 date and time to be set
302 </dd>
303 </dl>
304 <a NAME="DownloadItem.__setFileName" ID="DownloadItem.__setFileName"></a>
305 <h4>DownloadItem.__setFileName</h4>
306 <b>__setFileName</b>(<i>fileName</i>)
307
308 <p>
309 Private method to set the file name to save the download into.
310 </p>
311 <dl>
312
313 <dt><i>fileName</i> (str)</dt>
314 <dd>
315 name of the file to save into
316 </dd>
317 </dl>
318 <a NAME="DownloadItem.__updateInfoLabel" ID="DownloadItem.__updateInfoLabel"></a>
319 <h4>DownloadItem.__updateInfoLabel</h4>
320 <b>__updateInfoLabel</b>(<i></i>)
321
322 <p>
323 Private method to update the info label.
324 </p>
325 <a NAME="DownloadItem.absoluteFilePath" ID="DownloadItem.absoluteFilePath"></a>
326 <h4>DownloadItem.absoluteFilePath</h4>
327 <b>absoluteFilePath</b>(<i></i>)
328
329 <p>
330 Public method to get the absolute path of the output file.
331 </p>
332 <dl>
333 <dt>Return:</dt>
334 <dd>
335 absolute path of the output file (string)
336 </dd>
337 </dl>
338 <a NAME="DownloadItem.bytesReceived" ID="DownloadItem.bytesReceived"></a>
339 <h4>DownloadItem.bytesReceived</h4>
340 <b>bytesReceived</b>(<i></i>)
341
342 <p>
343 Public method to get the number of bytes received.
344 </p>
345 <dl>
346 <dt>Return:</dt>
347 <dd>
348 number of bytes received (integer)
349 </dd>
350 </dl>
351 <a NAME="DownloadItem.bytesTotal" ID="DownloadItem.bytesTotal"></a>
352 <h4>DownloadItem.bytesTotal</h4>
353 <b>bytesTotal</b>(<i></i>)
354
355 <p>
356 Public method to get the total number of bytes of the download.
357 </p>
358 <dl>
359 <dt>Return:</dt>
360 <dd>
361 total number of bytes (integer)
362 </dd>
363 </dl>
364 <a NAME="DownloadItem.cancelDownload" ID="DownloadItem.cancelDownload"></a>
365 <h4>DownloadItem.cancelDownload</h4>
366 <b>cancelDownload</b>(<i></i>)
367
368 <p>
369 Public slot to stop the download.
370 </p>
371 <a NAME="DownloadItem.canceledFileSelect" ID="DownloadItem.canceledFileSelect"></a>
372 <h4>DownloadItem.canceledFileSelect</h4>
373 <b>canceledFileSelect</b>(<i></i>)
374
375 <p>
376 Public method to check, if the user canceled the file selection.
377 </p>
378 <dl>
379 <dt>Return:</dt>
380 <dd>
381 flag indicating cancellation (boolean)
382 </dd>
383 </dl>
384 <a NAME="DownloadItem.currentSpeed" ID="DownloadItem.currentSpeed"></a>
385 <h4>DownloadItem.currentSpeed</h4>
386 <b>currentSpeed</b>(<i></i>)
387
388 <p>
389 Public method to get an estimation for the download speed.
390 </p>
391 <dl>
392 <dt>Return:</dt>
393 <dd>
394 estimation for the download speed (float)
395 </dd>
396 </dl>
397 <a NAME="DownloadItem.downloadCanceled" ID="DownloadItem.downloadCanceled"></a>
398 <h4>DownloadItem.downloadCanceled</h4>
399 <b>downloadCanceled</b>(<i></i>)
400
401 <p>
402 Public method to check, if the download was cancelled.
403 </p>
404 <dl>
405 <dt>Return:</dt>
406 <dd>
407 flag indicating a canceled download (boolean)
408 </dd>
409 </dl>
410 <a NAME="DownloadItem.downloadProgress" ID="DownloadItem.downloadProgress"></a>
411 <h4>DownloadItem.downloadProgress</h4>
412 <b>downloadProgress</b>(<i></i>)
413
414 <p>
415 Public method to get the download progress.
416 </p>
417 <dl>
418 <dt>Return:</dt>
419 <dd>
420 current download progress
421 </dd>
422 </dl>
423 <dl>
424 <dt>Return Type:</dt>
425 <dd>
426 int
427 </dd>
428 </dl>
429 <a NAME="DownloadItem.downloadedSuccessfully" ID="DownloadItem.downloadedSuccessfully"></a>
430 <h4>DownloadItem.downloadedSuccessfully</h4>
431 <b>downloadedSuccessfully</b>(<i></i>)
432
433 <p>
434 Public method to check for a successful download.
435 </p>
436 <dl>
437 <dt>Return:</dt>
438 <dd>
439 flag indicating a successful download (boolean)
440 </dd>
441 </dl>
442 <a NAME="DownloadItem.downloading" ID="DownloadItem.downloading"></a>
443 <h4>DownloadItem.downloading</h4>
444 <b>downloading</b>(<i></i>)
445
446 <p>
447 Public method to determine, if a download is in progress.
448 </p>
449 <dl>
450 <dt>Return:</dt>
451 <dd>
452 flag indicating a download is in progress (boolean)
453 </dd>
454 </dl>
455 <a NAME="DownloadItem.fileName" ID="DownloadItem.fileName"></a>
456 <h4>DownloadItem.fileName</h4>
457 <b>fileName</b>(<i></i>)
458
459 <p>
460 Public method to get the name of the output file.
461 </p>
462 <dl>
463 <dt>Return:</dt>
464 <dd>
465 name of the output file (string)
466 </dd>
467 </dl>
468 <a NAME="DownloadItem.getData" ID="DownloadItem.getData"></a>
469 <h4>DownloadItem.getData</h4>
470 <b>getData</b>(<i></i>)
471
472 <p>
473 Public method to get the relevant download data.
474 </p>
475 <dl>
476 <dt>Return:</dt>
477 <dd>
478 dictionary containing the URL, save location, done flag,
479 the URL of the related web page and the date and time of the
480 download
481 </dd>
482 </dl>
483 <dl>
484 <dt>Return Type:</dt>
485 <dd>
486 dict of {"URL": QUrl, "Location": str, "Done": bool,
487 "PageURL": QUrl, "Downloaded": QDateTime}
488 </dd>
489 </dl>
490 <a NAME="DownloadItem.getInfoData" ID="DownloadItem.getInfoData"></a>
491 <h4>DownloadItem.getInfoData</h4>
492 <b>getInfoData</b>(<i></i>)
493
494 <p>
495 Public method to get the text of the info label.
496 </p>
497 <dl>
498 <dt>Return:</dt>
499 <dd>
500 text of the info label (string)
501 </dd>
502 </dl>
503 <a NAME="DownloadItem.getPageUrl" ID="DownloadItem.getPageUrl"></a>
504 <h4>DownloadItem.getPageUrl</h4>
505 <b>getPageUrl</b>(<i></i>)
506
507 <p>
508 Public method to get the URL of the download page.
509 </p>
510 <dl>
511 <dt>Return:</dt>
512 <dd>
513 URL of the download page (QUrl)
514 </dd>
515 </dl>
516 <a NAME="DownloadItem.on_openButton_clicked" ID="DownloadItem.on_openButton_clicked"></a>
517 <h4>DownloadItem.on_openButton_clicked</h4>
518 <b>on_openButton_clicked</b>(<i></i>)
519
520 <p>
521 Private slot to open the downloaded file.
522 </p>
523 <a NAME="DownloadItem.on_pauseButton_clicked" ID="DownloadItem.on_pauseButton_clicked"></a>
524 <h4>DownloadItem.on_pauseButton_clicked</h4>
525 <b>on_pauseButton_clicked</b>(<i>checked</i>)
526
527 <p>
528 Private slot to pause the download.
529 </p>
530 <dl>
531
532 <dt><i>checked</i> (bool)</dt>
533 <dd>
534 flag indicating the state of the button
535 </dd>
536 </dl>
537 <a NAME="DownloadItem.on_stopButton_clicked" ID="DownloadItem.on_stopButton_clicked"></a>
538 <h4>DownloadItem.on_stopButton_clicked</h4>
539 <b>on_stopButton_clicked</b>(<i></i>)
540
541 <p>
542 Private slot to stop the download.
543 </p>
544 <a NAME="DownloadItem.openFile" ID="DownloadItem.openFile"></a>
545 <h4>DownloadItem.openFile</h4>
546 <b>openFile</b>(<i></i>)
547
548 <p>
549 Public slot to open the downloaded file.
550 </p>
551 <a NAME="DownloadItem.openFolder" ID="DownloadItem.openFolder"></a>
552 <h4>DownloadItem.openFolder</h4>
553 <b>openFolder</b>(<i></i>)
554
555 <p>
556 Public slot to open the folder containing the downloaded file.
557 </p>
558 <a NAME="DownloadItem.remainingTime" ID="DownloadItem.remainingTime"></a>
559 <h4>DownloadItem.remainingTime</h4>
560 <b>remainingTime</b>(<i></i>)
561
562 <p>
563 Public method to get an estimation for the remaining time.
564 </p>
565 <dl>
566 <dt>Return:</dt>
567 <dd>
568 estimation for the remaining time (float)
569 </dd>
570 </dl>
571 <a NAME="DownloadItem.setData" ID="DownloadItem.setData"></a>
572 <h4>DownloadItem.setData</h4>
573 <b>setData</b>(<i>data</i>)
574
575 <p>
576 Public method to set the relevant download data.
577 </p>
578 <dl>
579
580 <dt><i>data</i> (dict of {"URL": QUrl, "Location": str, "Done": bool,)</dt>
581 <dd>
582 dictionary containing the URL, save location, done flag,
583 the URL of the related web page and the date and time of the
584 download
585 "PageURL": QUrl, "Downloaded": QDateTime}
586 </dd>
587 </dl>
588 <a NAME="DownloadItem.setIcon" ID="DownloadItem.setIcon"></a>
589 <h4>DownloadItem.setIcon</h4>
590 <b>setIcon</b>(<i>icon</i>)
591
592 <p>
593 Public method to set the download icon.
594 </p>
595 <dl>
596
597 <dt><i>icon</i></dt>
598 <dd>
599 reference to the icon to be set (QIcon)
600 </dd>
601 </dl>
602 <div align="right"><a href="#top">Up</a></div>
603 <hr />
604 <hr />
605 <a NAME="DownloadState" ID="DownloadState"></a>
606 <h2>DownloadState</h2>
607
608 <p>
609 Class implementing the various download states.
610 </p>
611 <h3>Derived from</h3>
612 enum.Enum
613 <h3>Class Attributes</h3>
614
615 <table>
616 <tr><td>Cancelled</td></tr><tr><td>Downloading</td></tr><tr><td>Successful</td></tr>
617 </table>
618 <h3>Class Methods</h3>
619
620 <table>
621 <tr><td>None</td></tr>
622 </table>
623 <h3>Methods</h3>
624
625 <table>
626 <tr><td>None</td></tr>
627 </table>
628 <h3>Static Methods</h3>
629
630 <table>
631 <tr><td>None</td></tr>
632 </table>
633
634 <div align="right"><a href="#top">Up</a></div>
635 <hr />
636 </body></html>

eric ide

mercurial