eric6/Documentation/Source/eric6.WebBrowser.Download.DownloadItem.html

branch
maintenance
changeset 6989
8b8cadf8d7e9
parent 6942
2602857055c5
child 7273
391d6b7b1eff
equal deleted inserted replaced
6938:7926553b7509 6989:8b8cadf8d7e9
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.WebBrowser.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.WebBrowser.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(success)</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.__adjustSize">__adjustSize</a></td>
76 <td>Private method to adjust the size of the download item.</td>
77 </tr><tr>
78 <td><a href="#DownloadItem.__downloadProgress">__downloadProgress</a></td>
79 <td>Private method to show the download progress.</td>
80 </tr><tr>
81 <td><a href="#DownloadItem.__finished">__finished</a></td>
82 <td>Private slot to handle the download finished.</td>
83 </tr><tr>
84 <td><a href="#DownloadItem.__getFileName">__getFileName</a></td>
85 <td>Private method to get the file name to save to from the user.</td>
86 </tr><tr>
87 <td><a href="#DownloadItem.__initialize">__initialize</a></td>
88 <td>Private method to initialize the widget.</td>
89 </tr><tr>
90 <td><a href="#DownloadItem.__saveFileName">__saveFileName</a></td>
91 <td>Private method to calculate a name for the file to download.</td>
92 </tr><tr>
93 <td><a href="#DownloadItem.__setDateTime">__setDateTime</a></td>
94 <td>Private method to set the download date and time.</td>
95 </tr><tr>
96 <td><a href="#DownloadItem.__setFileName">__setFileName</a></td>
97 <td>Private method to set the file name to save the download into.</td>
98 </tr><tr>
99 <td><a href="#DownloadItem.__updateInfoLabel">__updateInfoLabel</a></td>
100 <td>Private method to update the info label.</td>
101 </tr><tr>
102 <td><a href="#DownloadItem.absoluteFilePath">absoluteFilePath</a></td>
103 <td>Public method to get the absolute path of the output file.</td>
104 </tr><tr>
105 <td><a href="#DownloadItem.bytesReceived">bytesReceived</a></td>
106 <td>Public method to get the number of bytes received.</td>
107 </tr><tr>
108 <td><a href="#DownloadItem.bytesTotal">bytesTotal</a></td>
109 <td>Public method to get the total number of bytes of the download.</td>
110 </tr><tr>
111 <td><a href="#DownloadItem.cancelDownload">cancelDownload</a></td>
112 <td>Public slot to stop the download.</td>
113 </tr><tr>
114 <td><a href="#DownloadItem.canceledFileSelect">canceledFileSelect</a></td>
115 <td>Public method to check, if the user canceled the file selection.</td>
116 </tr><tr>
117 <td><a href="#DownloadItem.currentSpeed">currentSpeed</a></td>
118 <td>Public method to get an estimation for the download speed.</td>
119 </tr><tr>
120 <td><a href="#DownloadItem.downloadCanceled">downloadCanceled</a></td>
121 <td>Public method to check, if the download was cancelled.</td>
122 </tr><tr>
123 <td><a href="#DownloadItem.downloadProgress">downloadProgress</a></td>
124 <td>Public method to get the download progress.</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.openFile">openFile</a></td>
154 <td>Public slot to open the downloaded file.</td>
155 </tr><tr>
156 <td><a href="#DownloadItem.openFolder">openFolder</a></td>
157 <td>Public slot to open the folder containing the downloaded file.</td>
158 </tr><tr>
159 <td><a href="#DownloadItem.remainingTime">remainingTime</a></td>
160 <td>Public method to get an estimation for the remaining time.</td>
161 </tr><tr>
162 <td><a href="#DownloadItem.setData">setData</a></td>
163 <td>Public method to set the relevant download data.</td>
164 </tr><tr>
165 <td><a href="#DownloadItem.setIcon">setIcon</a></td>
166 <td>Public method to set the download icon.</td>
167 </tr>
168 </table>
169 <h3>Static Methods</h3>
170 <table>
171 <tr><td>None</td></tr>
172 </table>
173 <a NAME="DownloadItem.__init__" ID="DownloadItem.__init__"></a>
174 <h4>DownloadItem (Constructor)</h4>
175 <b>DownloadItem</b>(<i>downloadItem=None, pageUrl=None, parent=None</i>)
176 <p>
177 Constructor
178 </p><dl>
179 <dt><i>downloadItem</i> (QWebEngineDownloadItem)</dt>
180 <dd>
181 reference to the download object containing the
182 download data.
183 </dd><dt><i>pageUrl</i> (QUrl)</dt>
184 <dd>
185 URL of the calling page
186 </dd><dt><i>parent</i> (QWidget)</dt>
187 <dd>
188 reference to the parent widget
189 </dd>
190 </dl><a NAME="DownloadItem.__adjustSize" ID="DownloadItem.__adjustSize"></a>
191 <h4>DownloadItem.__adjustSize</h4>
192 <b>__adjustSize</b>(<i></i>)
193 <p>
194 Private method to adjust the size of the download item.
195 </p><a NAME="DownloadItem.__downloadProgress" ID="DownloadItem.__downloadProgress"></a>
196 <h4>DownloadItem.__downloadProgress</h4>
197 <b>__downloadProgress</b>(<i>bytesReceived, bytesTotal</i>)
198 <p>
199 Private method to show the download progress.
200 </p><dl>
201 <dt><i>bytesReceived</i></dt>
202 <dd>
203 number of bytes received (integer)
204 </dd><dt><i>bytesTotal</i></dt>
205 <dd>
206 number of total bytes (integer)
207 </dd>
208 </dl><a NAME="DownloadItem.__finished" ID="DownloadItem.__finished"></a>
209 <h4>DownloadItem.__finished</h4>
210 <b>__finished</b>(<i></i>)
211 <p>
212 Private slot to handle the download finished.
213 </p><a NAME="DownloadItem.__getFileName" ID="DownloadItem.__getFileName"></a>
214 <h4>DownloadItem.__getFileName</h4>
215 <b>__getFileName</b>(<i></i>)
216 <p>
217 Private method to get the file name to save to from the user.
218 </p><a NAME="DownloadItem.__initialize" ID="DownloadItem.__initialize"></a>
219 <h4>DownloadItem.__initialize</h4>
220 <b>__initialize</b>(<i></i>)
221 <p>
222 Private method to initialize the widget.
223 </p><a NAME="DownloadItem.__saveFileName" ID="DownloadItem.__saveFileName"></a>
224 <h4>DownloadItem.__saveFileName</h4>
225 <b>__saveFileName</b>(<i>directory</i>)
226 <p>
227 Private method to calculate a name for the file to download.
228 </p><dl>
229 <dt><i>directory</i></dt>
230 <dd>
231 name of the directory to store the file into (string)
232 </dd>
233 </dl><dl>
234 <dt>Returns:</dt>
235 <dd>
236 proposed filename and original filename (string, string)
237 </dd>
238 </dl><a NAME="DownloadItem.__setDateTime" ID="DownloadItem.__setDateTime"></a>
239 <h4>DownloadItem.__setDateTime</h4>
240 <b>__setDateTime</b>(<i>dateTime=None</i>)
241 <p>
242 Private method to set the download date and time.
243 </p><dl>
244 <dt><i>dateTime</i> (QDateTime)</dt>
245 <dd>
246 date and time to be set
247 </dd>
248 </dl><a NAME="DownloadItem.__setFileName" ID="DownloadItem.__setFileName"></a>
249 <h4>DownloadItem.__setFileName</h4>
250 <b>__setFileName</b>(<i>fileName</i>)
251 <p>
252 Private method to set the file name to save the download into.
253 </p><dl>
254 <dt><i>fileName</i> (str)</dt>
255 <dd>
256 name of the file to save into
257 </dd>
258 </dl><a NAME="DownloadItem.__updateInfoLabel" ID="DownloadItem.__updateInfoLabel"></a>
259 <h4>DownloadItem.__updateInfoLabel</h4>
260 <b>__updateInfoLabel</b>(<i></i>)
261 <p>
262 Private method to update the info label.
263 </p><a NAME="DownloadItem.absoluteFilePath" ID="DownloadItem.absoluteFilePath"></a>
264 <h4>DownloadItem.absoluteFilePath</h4>
265 <b>absoluteFilePath</b>(<i></i>)
266 <p>
267 Public method to get the absolute path of the output file.
268 </p><dl>
269 <dt>Returns:</dt>
270 <dd>
271 absolute path of the output file (string)
272 </dd>
273 </dl><a NAME="DownloadItem.bytesReceived" ID="DownloadItem.bytesReceived"></a>
274 <h4>DownloadItem.bytesReceived</h4>
275 <b>bytesReceived</b>(<i></i>)
276 <p>
277 Public method to get the number of bytes received.
278 </p><dl>
279 <dt>Returns:</dt>
280 <dd>
281 number of bytes received (integer)
282 </dd>
283 </dl><a NAME="DownloadItem.bytesTotal" ID="DownloadItem.bytesTotal"></a>
284 <h4>DownloadItem.bytesTotal</h4>
285 <b>bytesTotal</b>(<i></i>)
286 <p>
287 Public method to get the total number of bytes of the download.
288 </p><dl>
289 <dt>Returns:</dt>
290 <dd>
291 total number of bytes (integer)
292 </dd>
293 </dl><a NAME="DownloadItem.cancelDownload" ID="DownloadItem.cancelDownload"></a>
294 <h4>DownloadItem.cancelDownload</h4>
295 <b>cancelDownload</b>(<i></i>)
296 <p>
297 Public slot to stop the download.
298 </p><a NAME="DownloadItem.canceledFileSelect" ID="DownloadItem.canceledFileSelect"></a>
299 <h4>DownloadItem.canceledFileSelect</h4>
300 <b>canceledFileSelect</b>(<i></i>)
301 <p>
302 Public method to check, if the user canceled the file selection.
303 </p><dl>
304 <dt>Returns:</dt>
305 <dd>
306 flag indicating cancellation (boolean)
307 </dd>
308 </dl><a NAME="DownloadItem.currentSpeed" ID="DownloadItem.currentSpeed"></a>
309 <h4>DownloadItem.currentSpeed</h4>
310 <b>currentSpeed</b>(<i></i>)
311 <p>
312 Public method to get an estimation for the download speed.
313 </p><dl>
314 <dt>Returns:</dt>
315 <dd>
316 estimation for the download speed (float)
317 </dd>
318 </dl><a NAME="DownloadItem.downloadCanceled" ID="DownloadItem.downloadCanceled"></a>
319 <h4>DownloadItem.downloadCanceled</h4>
320 <b>downloadCanceled</b>(<i></i>)
321 <p>
322 Public method to check, if the download was cancelled.
323 </p><dl>
324 <dt>Returns:</dt>
325 <dd>
326 flag indicating a canceled download (boolean)
327 </dd>
328 </dl><a NAME="DownloadItem.downloadProgress" ID="DownloadItem.downloadProgress"></a>
329 <h4>DownloadItem.downloadProgress</h4>
330 <b>downloadProgress</b>(<i></i>)
331 <p>
332 Public method to get the download progress.
333 </p><dl>
334 <dt>Returns:</dt>
335 <dd>
336 current download progress
337 </dd>
338 </dl><dl>
339 <dt>Return Type:</dt>
340 <dd>
341 int
342 </dd>
343 </dl><a NAME="DownloadItem.downloadedSuccessfully" ID="DownloadItem.downloadedSuccessfully"></a>
344 <h4>DownloadItem.downloadedSuccessfully</h4>
345 <b>downloadedSuccessfully</b>(<i></i>)
346 <p>
347 Public method to check for a successful download.
348 </p><dl>
349 <dt>Returns:</dt>
350 <dd>
351 flag indicating a successful download (boolean)
352 </dd>
353 </dl><a NAME="DownloadItem.downloading" ID="DownloadItem.downloading"></a>
354 <h4>DownloadItem.downloading</h4>
355 <b>downloading</b>(<i></i>)
356 <p>
357 Public method to determine, if a download is in progress.
358 </p><dl>
359 <dt>Returns:</dt>
360 <dd>
361 flag indicating a download is in progress (boolean)
362 </dd>
363 </dl><a NAME="DownloadItem.fileName" ID="DownloadItem.fileName"></a>
364 <h4>DownloadItem.fileName</h4>
365 <b>fileName</b>(<i></i>)
366 <p>
367 Public method to get the name of the output file.
368 </p><dl>
369 <dt>Returns:</dt>
370 <dd>
371 name of the output file (string)
372 </dd>
373 </dl><a NAME="DownloadItem.getData" ID="DownloadItem.getData"></a>
374 <h4>DownloadItem.getData</h4>
375 <b>getData</b>(<i></i>)
376 <p>
377 Public method to get the relevant download data.
378 </p><dl>
379 <dt>Returns:</dt>
380 <dd>
381 dictionary containing the URL, save location, done flag,
382 the URL of the related web page and the date and time of the
383 download
384 </dd>
385 </dl><dl>
386 <dt>Return Type:</dt>
387 <dd>
388 dict of {"URL": QUrl, "Location": str, "Done": bool,
389 "PageURL": QUrl, "Downloaded": QDateTime}
390 </dd>
391 </dl><a NAME="DownloadItem.getInfoData" ID="DownloadItem.getInfoData"></a>
392 <h4>DownloadItem.getInfoData</h4>
393 <b>getInfoData</b>(<i></i>)
394 <p>
395 Public method to get the text of the info label.
396 </p><dl>
397 <dt>Returns:</dt>
398 <dd>
399 text of the info label (string)
400 </dd>
401 </dl><a NAME="DownloadItem.getPageUrl" ID="DownloadItem.getPageUrl"></a>
402 <h4>DownloadItem.getPageUrl</h4>
403 <b>getPageUrl</b>(<i></i>)
404 <p>
405 Public method to get the URL of the download page.
406 </p><dl>
407 <dt>Returns:</dt>
408 <dd>
409 URL of the download page (QUrl)
410 </dd>
411 </dl><a NAME="DownloadItem.on_openButton_clicked" ID="DownloadItem.on_openButton_clicked"></a>
412 <h4>DownloadItem.on_openButton_clicked</h4>
413 <b>on_openButton_clicked</b>(<i></i>)
414 <p>
415 Private slot to open the downloaded file.
416 </p><a NAME="DownloadItem.on_pauseButton_clicked" ID="DownloadItem.on_pauseButton_clicked"></a>
417 <h4>DownloadItem.on_pauseButton_clicked</h4>
418 <b>on_pauseButton_clicked</b>(<i>checked</i>)
419 <p>
420 Private slot to pause the download.
421 </p><dl>
422 <dt><i>checked</i> (bool)</dt>
423 <dd>
424 flag indicating the state of the button
425 </dd>
426 </dl><a NAME="DownloadItem.on_stopButton_clicked" ID="DownloadItem.on_stopButton_clicked"></a>
427 <h4>DownloadItem.on_stopButton_clicked</h4>
428 <b>on_stopButton_clicked</b>(<i></i>)
429 <p>
430 Private slot to stop the download.
431 </p><a NAME="DownloadItem.openFile" ID="DownloadItem.openFile"></a>
432 <h4>DownloadItem.openFile</h4>
433 <b>openFile</b>(<i></i>)
434 <p>
435 Public slot to open the downloaded file.
436 </p><a NAME="DownloadItem.openFolder" ID="DownloadItem.openFolder"></a>
437 <h4>DownloadItem.openFolder</h4>
438 <b>openFolder</b>(<i></i>)
439 <p>
440 Public slot to open the folder containing the downloaded file.
441 </p><a NAME="DownloadItem.remainingTime" ID="DownloadItem.remainingTime"></a>
442 <h4>DownloadItem.remainingTime</h4>
443 <b>remainingTime</b>(<i></i>)
444 <p>
445 Public method to get an estimation for the remaining time.
446 </p><dl>
447 <dt>Returns:</dt>
448 <dd>
449 estimation for the remaining time (float)
450 </dd>
451 </dl><a NAME="DownloadItem.setData" ID="DownloadItem.setData"></a>
452 <h4>DownloadItem.setData</h4>
453 <b>setData</b>(<i>data</i>)
454 <p>
455 Public method to set the relevant download data.
456 </p><dl>
457 <dt><i>data</i> (dict of {"URL": QUrl, "Location": str, "Done": bool,)</dt>
458 <dd>
459 dictionary containing the URL, save location, done flag,
460 the URL of the related web page and the date and time of the
461 download
462 "PageURL": QUrl, "Downloaded": QDateTime}
463 </dd>
464 </dl><a NAME="DownloadItem.setIcon" ID="DownloadItem.setIcon"></a>
465 <h4>DownloadItem.setIcon</h4>
466 <b>setIcon</b>(<i>icon</i>)
467 <p>
468 Public method to set the download icon.
469 </p><dl>
470 <dt><i>icon</i></dt>
471 <dd>
472 reference to the icon to be set (QIcon)
473 </dd>
474 </dl>
475 <div align="right"><a href="#top">Up</a></div>
476 <hr />
477 </body></html>

eric ide

mercurial