|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric5.Helpviewer.Download.DownloadItem</title> |
|
6 <style> |
|
7 body { |
|
8 background: #EDECE6; |
|
9 margin: 0em 1em 10em 1em; |
|
10 color: black; |
|
11 } |
|
12 |
|
13 h1 { color: white; background: #85774A; } |
|
14 h2 { color: white; background: #85774A; } |
|
15 h3 { color: white; background: #9D936E; } |
|
16 h4 { color: white; background: #9D936E; } |
|
17 |
|
18 a { color: #BA6D36; } |
|
19 |
|
20 </style> |
|
21 </head> |
|
22 <body><a NAME="top" ID="top"></a> |
|
23 <h1>eric5.Helpviewer.Download.DownloadItem</h1> |
|
24 <p> |
|
25 Module implementing a widget controlling a download. |
|
26 </p> |
|
27 <h3>Global Attributes</h3> |
|
28 <table> |
|
29 <tr><td>None</td></tr> |
|
30 </table> |
|
31 <h3>Classes</h3> |
|
32 <table> |
|
33 <tr> |
|
34 <td><a href="#DownloadItem">DownloadItem</a></td> |
|
35 <td>Class implementing a widget controlling a download.</td> |
|
36 </tr> |
|
37 </table> |
|
38 <h3>Functions</h3> |
|
39 <table> |
|
40 <tr><td>None</td></tr> |
|
41 </table> |
|
42 <hr /><hr /> |
|
43 <a NAME="DownloadItem" ID="DownloadItem"></a> |
|
44 <h2>DownloadItem</h2> |
|
45 <p> |
|
46 Class implementing a widget controlling a download. |
|
47 </p> |
|
48 <h3>Derived from</h3> |
|
49 QWidget, Ui_DownloadItem |
|
50 <h3>Class Attributes</h3> |
|
51 <table> |
|
52 <tr><td>progress</td></tr><tr><td>statusChanged</td></tr> |
|
53 </table> |
|
54 <h3>Methods</h3> |
|
55 <table> |
|
56 <tr> |
|
57 <td><a href="#DownloadItem.__init__">DownloadItem</a></td> |
|
58 <td>Constructor</td> |
|
59 </tr><tr> |
|
60 <td><a href="#DownloadItem.__downloadProgress">__downloadProgress</a></td> |
|
61 <td>Private method to show the download progress.</td> |
|
62 </tr><tr> |
|
63 <td><a href="#DownloadItem.__finished">__finished</a></td> |
|
64 <td>Private slot to handle the download finished.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#DownloadItem.__getFileName">__getFileName</a></td> |
|
67 <td>Private method to get the filename to save to from the user.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#DownloadItem.__initialize">__initialize</a></td> |
|
70 <td>Private method to (re)initialize the widget.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#DownloadItem.__metaDataChanged">__metaDataChanged</a></td> |
|
73 <td>Private slot to handle a change of the meta data.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#DownloadItem.__networkError">__networkError</a></td> |
|
76 <td>Private slot to handle a network error.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#DownloadItem.__readyRead">__readyRead</a></td> |
|
79 <td>Private slot to read the available data.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#DownloadItem.__saveFileName">__saveFileName</a></td> |
|
82 <td>Private method to calculate a name for the file to download.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#DownloadItem.__updateInfoLabel">__updateInfoLabel</a></td> |
|
85 <td>Private method to update the info label.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#DownloadItem.absoluteFilePath">absoluteFilePath</a></td> |
|
88 <td>Public method to get the absolute path of the output file.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#DownloadItem.bytesReceived">bytesReceived</a></td> |
|
91 <td>Public method to get the number of bytes received.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#DownloadItem.bytesTotal">bytesTotal</a></td> |
|
94 <td>Public method to get the total number of bytes of the download.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#DownloadItem.canceledFileSelect">canceledFileSelect</a></td> |
|
97 <td>Public method to check, if the user canceled the file selection.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#DownloadItem.currentSpeed">currentSpeed</a></td> |
|
100 <td>Public method to get an estimation for the download speed.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#DownloadItem.downloadedSuccessfully">downloadedSuccessfully</a></td> |
|
103 <td>Public method to check for a successful download.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#DownloadItem.downloading">downloading</a></td> |
|
106 <td>Public method to determine, if a download is in progress.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#DownloadItem.fileName">fileName</a></td> |
|
109 <td>Public method to get the name of the output file.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#DownloadItem.getData">getData</a></td> |
|
112 <td>Public method to get the relevant download data.</td> |
|
113 </tr><tr> |
|
114 <td><a href="#DownloadItem.getInfoData">getInfoData</a></td> |
|
115 <td>Public method to get the text of the info label.</td> |
|
116 </tr><tr> |
|
117 <td><a href="#DownloadItem.on_openButton_clicked">on_openButton_clicked</a></td> |
|
118 <td>Private slot to open the downloaded file.</td> |
|
119 </tr><tr> |
|
120 <td><a href="#DownloadItem.on_stopButton_clicked">on_stopButton_clicked</a></td> |
|
121 <td>Private slot to stop the download.</td> |
|
122 </tr><tr> |
|
123 <td><a href="#DownloadItem.on_tryAgainButton_clicked">on_tryAgainButton_clicked</a></td> |
|
124 <td>Private slot to retry the download.</td> |
|
125 </tr><tr> |
|
126 <td><a href="#DownloadItem.remainingTime">remainingTime</a></td> |
|
127 <td>Public method to get an estimation for the remaining time.</td> |
|
128 </tr><tr> |
|
129 <td><a href="#DownloadItem.setData">setData</a></td> |
|
130 <td>Public method to set the relevant download data.</td> |
|
131 </tr><tr> |
|
132 <td><a href="#DownloadItem.setIcon">setIcon</a></td> |
|
133 <td>Public method to set the download icon.</td> |
|
134 </tr> |
|
135 </table> |
|
136 <a NAME="DownloadItem.__init__" ID="DownloadItem.__init__"></a> |
|
137 <h4>DownloadItem (Constructor)</h4> |
|
138 <b>DownloadItem</b>(<i>reply = None, requestFilename = False, webPage = None, download = False, parent = None</i>) |
|
139 <p> |
|
140 Constructor |
|
141 </p><dl> |
|
142 <dt><i>reply</i></dt> |
|
143 <dd> |
|
144 reference to the network reply object (QNetworkReply) |
|
145 </dd><dt><i>requestFilename</i></dt> |
|
146 <dd> |
|
147 flag indicating to ask the user for a filename (boolean) |
|
148 </dd><dt><i>webPage</i></dt> |
|
149 <dd> |
|
150 reference to the web page object the download originated |
|
151 from (QWebPage) |
|
152 </dd><dt><i>download</i></dt> |
|
153 <dd> |
|
154 flag indicating a download operation (boolean) |
|
155 </dd><dt><i>parent</i></dt> |
|
156 <dd> |
|
157 reference to the parent widget (QWidget) |
|
158 </dd> |
|
159 </dl><a NAME="DownloadItem.__downloadProgress" ID="DownloadItem.__downloadProgress"></a> |
|
160 <h4>DownloadItem.__downloadProgress</h4> |
|
161 <b>__downloadProgress</b>(<i>bytesReceived, bytesTotal</i>) |
|
162 <p> |
|
163 Private method to show the download progress. |
|
164 </p><dl> |
|
165 <dt><i>bytesReceived</i></dt> |
|
166 <dd> |
|
167 number of bytes received (integer) |
|
168 </dd><dt><i>bytesTotal</i></dt> |
|
169 <dd> |
|
170 number of total bytes (integer) |
|
171 </dd> |
|
172 </dl><a NAME="DownloadItem.__finished" ID="DownloadItem.__finished"></a> |
|
173 <h4>DownloadItem.__finished</h4> |
|
174 <b>__finished</b>(<i></i>) |
|
175 <p> |
|
176 Private slot to handle the download finished. |
|
177 </p><a NAME="DownloadItem.__getFileName" ID="DownloadItem.__getFileName"></a> |
|
178 <h4>DownloadItem.__getFileName</h4> |
|
179 <b>__getFileName</b>(<i></i>) |
|
180 <p> |
|
181 Private method to get the filename to save to from the user. |
|
182 </p><dl> |
|
183 <dt>Returns:</dt> |
|
184 <dd> |
|
185 flag indicating success (boolean) |
|
186 </dd> |
|
187 </dl><a NAME="DownloadItem.__initialize" ID="DownloadItem.__initialize"></a> |
|
188 <h4>DownloadItem.__initialize</h4> |
|
189 <b>__initialize</b>(<i>tryAgain = False</i>) |
|
190 <p> |
|
191 Private method to (re)initialize the widget. |
|
192 </p><dl> |
|
193 <dt><i>tryAgain</i></dt> |
|
194 <dd> |
|
195 flag indicating a retry (boolean) |
|
196 </dd> |
|
197 </dl><a NAME="DownloadItem.__metaDataChanged" ID="DownloadItem.__metaDataChanged"></a> |
|
198 <h4>DownloadItem.__metaDataChanged</h4> |
|
199 <b>__metaDataChanged</b>(<i></i>) |
|
200 <p> |
|
201 Private slot to handle a change of the meta data. |
|
202 </p><a NAME="DownloadItem.__networkError" ID="DownloadItem.__networkError"></a> |
|
203 <h4>DownloadItem.__networkError</h4> |
|
204 <b>__networkError</b>(<i></i>) |
|
205 <p> |
|
206 Private slot to handle a network error. |
|
207 </p><a NAME="DownloadItem.__readyRead" ID="DownloadItem.__readyRead"></a> |
|
208 <h4>DownloadItem.__readyRead</h4> |
|
209 <b>__readyRead</b>(<i></i>) |
|
210 <p> |
|
211 Private slot to read the available data. |
|
212 </p><a NAME="DownloadItem.__saveFileName" ID="DownloadItem.__saveFileName"></a> |
|
213 <h4>DownloadItem.__saveFileName</h4> |
|
214 <b>__saveFileName</b>(<i>directory</i>) |
|
215 <p> |
|
216 Private method to calculate a name for the file to download. |
|
217 </p><dl> |
|
218 <dt><i>directory</i></dt> |
|
219 <dd> |
|
220 name of the directory to store the file into (string) |
|
221 </dd> |
|
222 </dl><dl> |
|
223 <dt>Returns:</dt> |
|
224 <dd> |
|
225 proposed filename (string) |
|
226 </dd> |
|
227 </dl><a NAME="DownloadItem.__updateInfoLabel" ID="DownloadItem.__updateInfoLabel"></a> |
|
228 <h4>DownloadItem.__updateInfoLabel</h4> |
|
229 <b>__updateInfoLabel</b>(<i></i>) |
|
230 <p> |
|
231 Private method to update the info label. |
|
232 </p><a NAME="DownloadItem.absoluteFilePath" ID="DownloadItem.absoluteFilePath"></a> |
|
233 <h4>DownloadItem.absoluteFilePath</h4> |
|
234 <b>absoluteFilePath</b>(<i></i>) |
|
235 <p> |
|
236 Public method to get the absolute path of the output file. |
|
237 </p><dl> |
|
238 <dt>Returns:</dt> |
|
239 <dd> |
|
240 absolute path of the output file (string) |
|
241 </dd> |
|
242 </dl><a NAME="DownloadItem.bytesReceived" ID="DownloadItem.bytesReceived"></a> |
|
243 <h4>DownloadItem.bytesReceived</h4> |
|
244 <b>bytesReceived</b>(<i></i>) |
|
245 <p> |
|
246 Public method to get the number of bytes received. |
|
247 </p><dl> |
|
248 <dt>Returns:</dt> |
|
249 <dd> |
|
250 number of bytes received (integer) |
|
251 </dd> |
|
252 </dl><a NAME="DownloadItem.bytesTotal" ID="DownloadItem.bytesTotal"></a> |
|
253 <h4>DownloadItem.bytesTotal</h4> |
|
254 <b>bytesTotal</b>(<i></i>) |
|
255 <p> |
|
256 Public method to get the total number of bytes of the download. |
|
257 </p><dl> |
|
258 <dt>Returns:</dt> |
|
259 <dd> |
|
260 total number of bytes (integer) |
|
261 </dd> |
|
262 </dl><a NAME="DownloadItem.canceledFileSelect" ID="DownloadItem.canceledFileSelect"></a> |
|
263 <h4>DownloadItem.canceledFileSelect</h4> |
|
264 <b>canceledFileSelect</b>(<i></i>) |
|
265 <p> |
|
266 Public method to check, if the user canceled the file selection. |
|
267 </p><dl> |
|
268 <dt>Returns:</dt> |
|
269 <dd> |
|
270 flag indicating cancellation (boolean) |
|
271 </dd> |
|
272 </dl><a NAME="DownloadItem.currentSpeed" ID="DownloadItem.currentSpeed"></a> |
|
273 <h4>DownloadItem.currentSpeed</h4> |
|
274 <b>currentSpeed</b>(<i></i>) |
|
275 <p> |
|
276 Public method to get an estimation for the download speed. |
|
277 </p><dl> |
|
278 <dt>Returns:</dt> |
|
279 <dd> |
|
280 estimation for the download speed (float) |
|
281 </dd> |
|
282 </dl><a NAME="DownloadItem.downloadedSuccessfully" ID="DownloadItem.downloadedSuccessfully"></a> |
|
283 <h4>DownloadItem.downloadedSuccessfully</h4> |
|
284 <b>downloadedSuccessfully</b>(<i></i>) |
|
285 <p> |
|
286 Public method to check for a successful download. |
|
287 </p><dl> |
|
288 <dt>Returns:</dt> |
|
289 <dd> |
|
290 flag indicating a successful download (boolean) |
|
291 </dd> |
|
292 </dl><a NAME="DownloadItem.downloading" ID="DownloadItem.downloading"></a> |
|
293 <h4>DownloadItem.downloading</h4> |
|
294 <b>downloading</b>(<i></i>) |
|
295 <p> |
|
296 Public method to determine, if a download is in progress. |
|
297 </p><dl> |
|
298 <dt>Returns:</dt> |
|
299 <dd> |
|
300 flag indicating a download is in progress (boolean) |
|
301 </dd> |
|
302 </dl><a NAME="DownloadItem.fileName" ID="DownloadItem.fileName"></a> |
|
303 <h4>DownloadItem.fileName</h4> |
|
304 <b>fileName</b>(<i></i>) |
|
305 <p> |
|
306 Public method to get the name of the output file. |
|
307 </p><dl> |
|
308 <dt>Returns:</dt> |
|
309 <dd> |
|
310 name of the output file (string) |
|
311 </dd> |
|
312 </dl><a NAME="DownloadItem.getData" ID="DownloadItem.getData"></a> |
|
313 <h4>DownloadItem.getData</h4> |
|
314 <b>getData</b>(<i></i>) |
|
315 <p> |
|
316 Public method to get the relevant download data. |
|
317 </p><dl> |
|
318 <dt>Returns:</dt> |
|
319 <dd> |
|
320 tuple of URL, save location and done flag |
|
321 (QUrl, string, boolean) |
|
322 </dd> |
|
323 </dl><a NAME="DownloadItem.getInfoData" ID="DownloadItem.getInfoData"></a> |
|
324 <h4>DownloadItem.getInfoData</h4> |
|
325 <b>getInfoData</b>(<i></i>) |
|
326 <p> |
|
327 Public method to get the text of the info label. |
|
328 </p><dl> |
|
329 <dt>Returns:</dt> |
|
330 <dd> |
|
331 text of the info label (string) |
|
332 </dd> |
|
333 </dl><a NAME="DownloadItem.on_openButton_clicked" ID="DownloadItem.on_openButton_clicked"></a> |
|
334 <h4>DownloadItem.on_openButton_clicked</h4> |
|
335 <b>on_openButton_clicked</b>(<i></i>) |
|
336 <p> |
|
337 Private slot to open the downloaded file. |
|
338 </p><a NAME="DownloadItem.on_stopButton_clicked" ID="DownloadItem.on_stopButton_clicked"></a> |
|
339 <h4>DownloadItem.on_stopButton_clicked</h4> |
|
340 <b>on_stopButton_clicked</b>(<i></i>) |
|
341 <p> |
|
342 Private slot to stop the download. |
|
343 </p><a NAME="DownloadItem.on_tryAgainButton_clicked" ID="DownloadItem.on_tryAgainButton_clicked"></a> |
|
344 <h4>DownloadItem.on_tryAgainButton_clicked</h4> |
|
345 <b>on_tryAgainButton_clicked</b>(<i></i>) |
|
346 <p> |
|
347 Private slot to retry the download. |
|
348 </p><a NAME="DownloadItem.remainingTime" ID="DownloadItem.remainingTime"></a> |
|
349 <h4>DownloadItem.remainingTime</h4> |
|
350 <b>remainingTime</b>(<i></i>) |
|
351 <p> |
|
352 Public method to get an estimation for the remaining time. |
|
353 </p><dl> |
|
354 <dt>Returns:</dt> |
|
355 <dd> |
|
356 estimation for the remaining time (float) |
|
357 </dd> |
|
358 </dl><a NAME="DownloadItem.setData" ID="DownloadItem.setData"></a> |
|
359 <h4>DownloadItem.setData</h4> |
|
360 <b>setData</b>(<i>data</i>) |
|
361 <p> |
|
362 Public method to set the relevant download data. |
|
363 </p><dl> |
|
364 <dt><i>data</i></dt> |
|
365 <dd> |
|
366 tuple of URL, save location and done flag |
|
367 (QUrl, string, boolean) |
|
368 </dd> |
|
369 </dl><a NAME="DownloadItem.setIcon" ID="DownloadItem.setIcon"></a> |
|
370 <h4>DownloadItem.setIcon</h4> |
|
371 <b>setIcon</b>(<i>icon</i>) |
|
372 <p> |
|
373 Public method to set the download icon. |
|
374 </p><dl> |
|
375 <dt><i>icon</i></dt> |
|
376 <dd> |
|
377 reference to the icon to be set (QIcon) |
|
378 </dd> |
|
379 </dl> |
|
380 <div align="right"><a href="#top">Up</a></div> |
|
381 <hr /> |
|
382 </body></html> |