|
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()</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 initialize the widget.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#DownloadItem.__open">__open</a></td> |
|
88 <td>Private slot to open the downloaded file.</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.__updateInfoLabel">__updateInfoLabel</a></td> |
|
94 <td>Private method to update the info label.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#DownloadItem.absoluteFilePath">absoluteFilePath</a></td> |
|
97 <td>Public method to get the absolute path of the output file.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#DownloadItem.bytesReceived">bytesReceived</a></td> |
|
100 <td>Public method to get the number of bytes received.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#DownloadItem.bytesTotal">bytesTotal</a></td> |
|
103 <td>Public method to get the total number of bytes of the download.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#DownloadItem.cancelDownload">cancelDownload</a></td> |
|
106 <td>Public slot to stop the download.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#DownloadItem.canceledFileSelect">canceledFileSelect</a></td> |
|
109 <td>Public method to check, if the user canceled the file selection.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#DownloadItem.currentSpeed">currentSpeed</a></td> |
|
112 <td>Public method to get an estimation for the download speed.</td> |
|
113 </tr><tr> |
|
114 <td><a href="#DownloadItem.downloadCanceled">downloadCanceled</a></td> |
|
115 <td>Public method to check, if the download was cancelled.</td> |
|
116 </tr><tr> |
|
117 <td><a href="#DownloadItem.downloadedSuccessfully">downloadedSuccessfully</a></td> |
|
118 <td>Public method to check for a successful download.</td> |
|
119 </tr><tr> |
|
120 <td><a href="#DownloadItem.downloading">downloading</a></td> |
|
121 <td>Public method to determine, if a download is in progress.</td> |
|
122 </tr><tr> |
|
123 <td><a href="#DownloadItem.fileName">fileName</a></td> |
|
124 <td>Public method to get the name of the output file.</td> |
|
125 </tr><tr> |
|
126 <td><a href="#DownloadItem.getData">getData</a></td> |
|
127 <td>Public method to get the relevant download data.</td> |
|
128 </tr><tr> |
|
129 <td><a href="#DownloadItem.getInfoData">getInfoData</a></td> |
|
130 <td>Public method to get the text of the info label.</td> |
|
131 </tr><tr> |
|
132 <td><a href="#DownloadItem.getPageUrl">getPageUrl</a></td> |
|
133 <td>Public method to get the URL of the download page.</td> |
|
134 </tr><tr> |
|
135 <td><a href="#DownloadItem.on_openButton_clicked">on_openButton_clicked</a></td> |
|
136 <td>Private slot to open the downloaded file.</td> |
|
137 </tr><tr> |
|
138 <td><a href="#DownloadItem.on_stopButton_clicked">on_stopButton_clicked</a></td> |
|
139 <td>Private slot to stop the download.</td> |
|
140 </tr><tr> |
|
141 <td><a href="#DownloadItem.openFile">openFile</a></td> |
|
142 <td>Public slot to open the downloaded file.</td> |
|
143 </tr><tr> |
|
144 <td><a href="#DownloadItem.openFolder">openFolder</a></td> |
|
145 <td>Public slot to open the folder containing the downloaded file.</td> |
|
146 </tr><tr> |
|
147 <td><a href="#DownloadItem.remainingTime">remainingTime</a></td> |
|
148 <td>Public method to get an estimation for the remaining time.</td> |
|
149 </tr><tr> |
|
150 <td><a href="#DownloadItem.setData">setData</a></td> |
|
151 <td>Public method to set the relevant download data.</td> |
|
152 </tr><tr> |
|
153 <td><a href="#DownloadItem.setIcon">setIcon</a></td> |
|
154 <td>Public method to set the download icon.</td> |
|
155 </tr> |
|
156 </table> |
|
157 <h3>Static Methods</h3> |
|
158 <table> |
|
159 <tr><td>None</td></tr> |
|
160 </table> |
|
161 <a NAME="DownloadItem.__init__" ID="DownloadItem.__init__"></a> |
|
162 <h4>DownloadItem (Constructor)</h4> |
|
163 <b>DownloadItem</b>(<i>downloadItem=None, parent=None</i>) |
|
164 <p> |
|
165 Constructor |
|
166 </p><dl> |
|
167 <dt><i>downloadItem</i></dt> |
|
168 <dd> |
|
169 reference to the download object containing the |
|
170 download data. |
|
171 </dd><dt><i>parent=</i> (QWebEngineDownloadItem)</dt> |
|
172 <dd> |
|
173 reference to the parent widget (QWidget) |
|
174 </dd> |
|
175 </dl><a NAME="DownloadItem.__downloadProgress" ID="DownloadItem.__downloadProgress"></a> |
|
176 <h4>DownloadItem.__downloadProgress</h4> |
|
177 <b>__downloadProgress</b>(<i>bytesReceived, bytesTotal</i>) |
|
178 <p> |
|
179 Private method to show the download progress. |
|
180 </p><dl> |
|
181 <dt><i>bytesReceived</i></dt> |
|
182 <dd> |
|
183 number of bytes received (integer) |
|
184 </dd><dt><i>bytesTotal</i></dt> |
|
185 <dd> |
|
186 number of total bytes (integer) |
|
187 </dd> |
|
188 </dl><a NAME="DownloadItem.__finished" ID="DownloadItem.__finished"></a> |
|
189 <h4>DownloadItem.__finished</h4> |
|
190 <b>__finished</b>(<i></i>) |
|
191 <p> |
|
192 Private slot to handle the download finished. |
|
193 </p><a NAME="DownloadItem.__getFileName" ID="DownloadItem.__getFileName"></a> |
|
194 <h4>DownloadItem.__getFileName</h4> |
|
195 <b>__getFileName</b>(<i></i>) |
|
196 <p> |
|
197 Private method to get the file name to save to from the user. |
|
198 </p><a NAME="DownloadItem.__initialize" ID="DownloadItem.__initialize"></a> |
|
199 <h4>DownloadItem.__initialize</h4> |
|
200 <b>__initialize</b>(<i></i>) |
|
201 <p> |
|
202 Private method to initialize the widget. |
|
203 </p><a NAME="DownloadItem.__open" ID="DownloadItem.__open"></a> |
|
204 <h4>DownloadItem.__open</h4> |
|
205 <b>__open</b>(<i></i>) |
|
206 <p> |
|
207 Private slot to open the downloaded file. |
|
208 </p><a NAME="DownloadItem.__saveFileName" ID="DownloadItem.__saveFileName"></a> |
|
209 <h4>DownloadItem.__saveFileName</h4> |
|
210 <b>__saveFileName</b>(<i>directory</i>) |
|
211 <p> |
|
212 Private method to calculate a name for the file to download. |
|
213 </p><dl> |
|
214 <dt><i>directory</i></dt> |
|
215 <dd> |
|
216 name of the directory to store the file into (string) |
|
217 </dd> |
|
218 </dl><dl> |
|
219 <dt>Returns:</dt> |
|
220 <dd> |
|
221 proposed filename and original filename (string, string) |
|
222 </dd> |
|
223 </dl><a NAME="DownloadItem.__updateInfoLabel" ID="DownloadItem.__updateInfoLabel"></a> |
|
224 <h4>DownloadItem.__updateInfoLabel</h4> |
|
225 <b>__updateInfoLabel</b>(<i></i>) |
|
226 <p> |
|
227 Private method to update the info label. |
|
228 </p><a NAME="DownloadItem.absoluteFilePath" ID="DownloadItem.absoluteFilePath"></a> |
|
229 <h4>DownloadItem.absoluteFilePath</h4> |
|
230 <b>absoluteFilePath</b>(<i></i>) |
|
231 <p> |
|
232 Public method to get the absolute path of the output file. |
|
233 </p><dl> |
|
234 <dt>Returns:</dt> |
|
235 <dd> |
|
236 absolute path of the output file (string) |
|
237 </dd> |
|
238 </dl><a NAME="DownloadItem.bytesReceived" ID="DownloadItem.bytesReceived"></a> |
|
239 <h4>DownloadItem.bytesReceived</h4> |
|
240 <b>bytesReceived</b>(<i></i>) |
|
241 <p> |
|
242 Public method to get the number of bytes received. |
|
243 </p><dl> |
|
244 <dt>Returns:</dt> |
|
245 <dd> |
|
246 number of bytes received (integer) |
|
247 </dd> |
|
248 </dl><a NAME="DownloadItem.bytesTotal" ID="DownloadItem.bytesTotal"></a> |
|
249 <h4>DownloadItem.bytesTotal</h4> |
|
250 <b>bytesTotal</b>(<i></i>) |
|
251 <p> |
|
252 Public method to get the total number of bytes of the download. |
|
253 </p><dl> |
|
254 <dt>Returns:</dt> |
|
255 <dd> |
|
256 total number of bytes (integer) |
|
257 </dd> |
|
258 </dl><a NAME="DownloadItem.cancelDownload" ID="DownloadItem.cancelDownload"></a> |
|
259 <h4>DownloadItem.cancelDownload</h4> |
|
260 <b>cancelDownload</b>(<i></i>) |
|
261 <p> |
|
262 Public slot to stop the download. |
|
263 </p><a NAME="DownloadItem.canceledFileSelect" ID="DownloadItem.canceledFileSelect"></a> |
|
264 <h4>DownloadItem.canceledFileSelect</h4> |
|
265 <b>canceledFileSelect</b>(<i></i>) |
|
266 <p> |
|
267 Public method to check, if the user canceled the file selection. |
|
268 </p><dl> |
|
269 <dt>Returns:</dt> |
|
270 <dd> |
|
271 flag indicating cancellation (boolean) |
|
272 </dd> |
|
273 </dl><a NAME="DownloadItem.currentSpeed" ID="DownloadItem.currentSpeed"></a> |
|
274 <h4>DownloadItem.currentSpeed</h4> |
|
275 <b>currentSpeed</b>(<i></i>) |
|
276 <p> |
|
277 Public method to get an estimation for the download speed. |
|
278 </p><dl> |
|
279 <dt>Returns:</dt> |
|
280 <dd> |
|
281 estimation for the download speed (float) |
|
282 </dd> |
|
283 </dl><a NAME="DownloadItem.downloadCanceled" ID="DownloadItem.downloadCanceled"></a> |
|
284 <h4>DownloadItem.downloadCanceled</h4> |
|
285 <b>downloadCanceled</b>(<i></i>) |
|
286 <p> |
|
287 Public method to check, if the download was cancelled. |
|
288 </p><dl> |
|
289 <dt>Returns:</dt> |
|
290 <dd> |
|
291 flag indicating a canceled download (boolean) |
|
292 </dd> |
|
293 </dl><a NAME="DownloadItem.downloadedSuccessfully" ID="DownloadItem.downloadedSuccessfully"></a> |
|
294 <h4>DownloadItem.downloadedSuccessfully</h4> |
|
295 <b>downloadedSuccessfully</b>(<i></i>) |
|
296 <p> |
|
297 Public method to check for a successful download. |
|
298 </p><dl> |
|
299 <dt>Returns:</dt> |
|
300 <dd> |
|
301 flag indicating a successful download (boolean) |
|
302 </dd> |
|
303 </dl><a NAME="DownloadItem.downloading" ID="DownloadItem.downloading"></a> |
|
304 <h4>DownloadItem.downloading</h4> |
|
305 <b>downloading</b>(<i></i>) |
|
306 <p> |
|
307 Public method to determine, if a download is in progress. |
|
308 </p><dl> |
|
309 <dt>Returns:</dt> |
|
310 <dd> |
|
311 flag indicating a download is in progress (boolean) |
|
312 </dd> |
|
313 </dl><a NAME="DownloadItem.fileName" ID="DownloadItem.fileName"></a> |
|
314 <h4>DownloadItem.fileName</h4> |
|
315 <b>fileName</b>(<i></i>) |
|
316 <p> |
|
317 Public method to get the name of the output file. |
|
318 </p><dl> |
|
319 <dt>Returns:</dt> |
|
320 <dd> |
|
321 name of the output file (string) |
|
322 </dd> |
|
323 </dl><a NAME="DownloadItem.getData" ID="DownloadItem.getData"></a> |
|
324 <h4>DownloadItem.getData</h4> |
|
325 <b>getData</b>(<i></i>) |
|
326 <p> |
|
327 Public method to get the relevant download data. |
|
328 </p><dl> |
|
329 <dt>Returns:</dt> |
|
330 <dd> |
|
331 tuple of URL, save location, flag and the |
|
332 URL of the related web page (QUrl, string, boolean,QUrl) |
|
333 </dd> |
|
334 </dl><a NAME="DownloadItem.getInfoData" ID="DownloadItem.getInfoData"></a> |
|
335 <h4>DownloadItem.getInfoData</h4> |
|
336 <b>getInfoData</b>(<i></i>) |
|
337 <p> |
|
338 Public method to get the text of the info label. |
|
339 </p><dl> |
|
340 <dt>Returns:</dt> |
|
341 <dd> |
|
342 text of the info label (string) |
|
343 </dd> |
|
344 </dl><a NAME="DownloadItem.getPageUrl" ID="DownloadItem.getPageUrl"></a> |
|
345 <h4>DownloadItem.getPageUrl</h4> |
|
346 <b>getPageUrl</b>(<i></i>) |
|
347 <p> |
|
348 Public method to get the URL of the download page. |
|
349 </p><dl> |
|
350 <dt>Returns:</dt> |
|
351 <dd> |
|
352 URL of the download page (QUrl) |
|
353 </dd> |
|
354 </dl><a NAME="DownloadItem.on_openButton_clicked" ID="DownloadItem.on_openButton_clicked"></a> |
|
355 <h4>DownloadItem.on_openButton_clicked</h4> |
|
356 <b>on_openButton_clicked</b>(<i></i>) |
|
357 <p> |
|
358 Private slot to open the downloaded file. |
|
359 </p><a NAME="DownloadItem.on_stopButton_clicked" ID="DownloadItem.on_stopButton_clicked"></a> |
|
360 <h4>DownloadItem.on_stopButton_clicked</h4> |
|
361 <b>on_stopButton_clicked</b>(<i></i>) |
|
362 <p> |
|
363 Private slot to stop the download. |
|
364 </p><a NAME="DownloadItem.openFile" ID="DownloadItem.openFile"></a> |
|
365 <h4>DownloadItem.openFile</h4> |
|
366 <b>openFile</b>(<i></i>) |
|
367 <p> |
|
368 Public slot to open the downloaded file. |
|
369 </p><a NAME="DownloadItem.openFolder" ID="DownloadItem.openFolder"></a> |
|
370 <h4>DownloadItem.openFolder</h4> |
|
371 <b>openFolder</b>(<i></i>) |
|
372 <p> |
|
373 Public slot to open the folder containing the downloaded file. |
|
374 </p><a NAME="DownloadItem.remainingTime" ID="DownloadItem.remainingTime"></a> |
|
375 <h4>DownloadItem.remainingTime</h4> |
|
376 <b>remainingTime</b>(<i></i>) |
|
377 <p> |
|
378 Public method to get an estimation for the remaining time. |
|
379 </p><dl> |
|
380 <dt>Returns:</dt> |
|
381 <dd> |
|
382 estimation for the remaining time (float) |
|
383 </dd> |
|
384 </dl><a NAME="DownloadItem.setData" ID="DownloadItem.setData"></a> |
|
385 <h4>DownloadItem.setData</h4> |
|
386 <b>setData</b>(<i>data</i>) |
|
387 <p> |
|
388 Public method to set the relevant download data. |
|
389 </p><dl> |
|
390 <dt><i>data</i></dt> |
|
391 <dd> |
|
392 tuple of URL, save location, flag and the |
|
393 URL of the related web page (QUrl, string, boolean, QUrl) |
|
394 </dd> |
|
395 </dl><a NAME="DownloadItem.setIcon" ID="DownloadItem.setIcon"></a> |
|
396 <h4>DownloadItem.setIcon</h4> |
|
397 <b>setIcon</b>(<i>icon</i>) |
|
398 <p> |
|
399 Public method to set the download icon. |
|
400 </p><dl> |
|
401 <dt><i>icon</i></dt> |
|
402 <dd> |
|
403 reference to the icon to be set (QIcon) |
|
404 </dd> |
|
405 </dl> |
|
406 <div align="right"><a href="#top">Up</a></div> |
|
407 <hr /> |
|
408 </body></html> |