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

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

eric ide

mercurial