|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.Helpviewer.Download.DownloadManager</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.DownloadManager</h1> |
|
23 <p> |
|
24 Module implementing the download manager class. |
|
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="#DownloadManager">DownloadManager</a></td> |
|
34 <td>Class implementing the download manager.</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="DownloadManager" ID="DownloadManager"></a> |
|
43 <h2>DownloadManager</h2> |
|
44 <p> |
|
45 Class implementing the download manager. |
|
46 </p> |
|
47 <h3>Derived from</h3> |
|
48 QDialog, Ui_DownloadManager |
|
49 <h3>Class Attributes</h3> |
|
50 <table> |
|
51 <tr><td>RemoveExit</td></tr><tr><td>RemoveNever</td></tr><tr><td>RemoveSuccessFullDownload</td></tr> |
|
52 </table> |
|
53 <h3>Class Methods</h3> |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 <table> |
|
59 <tr> |
|
60 <td><a href="#DownloadManager.__init__">DownloadManager</a></td> |
|
61 <td>Constructor</td> |
|
62 </tr><tr> |
|
63 <td><a href="#DownloadManager.__addItem">__addItem</a></td> |
|
64 <td>Private method to add a download to the list of downloads.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#DownloadManager.__contextMenuCancel">__contextMenuCancel</a></td> |
|
67 <td>Private method to cancel the current download.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#DownloadManager.__contextMenuCopyLink">__contextMenuCopyLink</a></td> |
|
70 <td>Private method to copy the download link to the clipboard.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#DownloadManager.__contextMenuGotoPage">__contextMenuGotoPage</a></td> |
|
73 <td>Private method to open the download page.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#DownloadManager.__contextMenuOpen">__contextMenuOpen</a></td> |
|
76 <td>Private method to open the downloaded file.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#DownloadManager.__contextMenuOpenFolder">__contextMenuOpenFolder</a></td> |
|
79 <td>Private method to open the folder containing the downloaded file.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#DownloadManager.__contextMenuRemoveSelected">__contextMenuRemoveSelected</a></td> |
|
82 <td>Private method to remove the selected downloads from the list.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#DownloadManager.__contextMenuRetry">__contextMenuRetry</a></td> |
|
85 <td>Private method to retry of the download.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#DownloadManager.__contextMenuSelectAll">__contextMenuSelectAll</a></td> |
|
88 <td>Private method to select all downloads.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#DownloadManager.__currentItem">__currentItem</a></td> |
|
91 <td>Private method to get a reference to the current item.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#DownloadManager.__customContextMenuRequested">__customContextMenuRequested</a></td> |
|
94 <td>Private slot to handle the context menu request for the bookmarks tree.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#DownloadManager.__finished">__finished</a></td> |
|
97 <td>Private slot to handle a finished download.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#DownloadManager.__load">__load</a></td> |
|
100 <td>Private method to load the download settings.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#DownloadManager.__updateActiveItemCount">__updateActiveItemCount</a></td> |
|
103 <td>Private method to update the window title.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#DownloadManager.__updateItemCount">__updateItemCount</a></td> |
|
106 <td>Private method to update the count label.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#DownloadManager.__updateRow">__updateRow</a></td> |
|
109 <td>Private slot to update a download item.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#DownloadManager.activeDownloads">activeDownloads</a></td> |
|
112 <td>Public method to get the number of active downloads.</td> |
|
113 </tr><tr> |
|
114 <td><a href="#DownloadManager.allowQuit">allowQuit</a></td> |
|
115 <td>Public method to check, if it is ok to quit.</td> |
|
116 </tr><tr> |
|
117 <td><a href="#DownloadManager.changeOccurred">changeOccurred</a></td> |
|
118 <td>Public method to signal a change.</td> |
|
119 </tr><tr> |
|
120 <td><a href="#DownloadManager.cleanup">cleanup</a></td> |
|
121 <td>Public slot to cleanup the downloads.</td> |
|
122 </tr><tr> |
|
123 <td><a href="#DownloadManager.count">count</a></td> |
|
124 <td>Public method to get the number of downloads.</td> |
|
125 </tr><tr> |
|
126 <td><a href="#DownloadManager.download">download</a></td> |
|
127 <td>Public method to download a file.</td> |
|
128 </tr><tr> |
|
129 <td><a href="#DownloadManager.downloadDirectory">downloadDirectory</a></td> |
|
130 <td>Public method to get the current download directory.</td> |
|
131 </tr><tr> |
|
132 <td><a href="#DownloadManager.downloads">downloads</a></td> |
|
133 <td>Public method to get a reference to the downloads.</td> |
|
134 </tr><tr> |
|
135 <td><a href="#DownloadManager.handleUnsupportedContent">handleUnsupportedContent</a></td> |
|
136 <td>Public method to handle unsupported content by downloading the referenced resource.</td> |
|
137 </tr><tr> |
|
138 <td><a href="#DownloadManager.on_cleanupButton_clicked">on_cleanupButton_clicked</a></td> |
|
139 <td>Private slot cleanup the downloads.</td> |
|
140 </tr><tr> |
|
141 <td><a href="#DownloadManager.removePolicy">removePolicy</a></td> |
|
142 <td>Public method to get the remove policy.</td> |
|
143 </tr><tr> |
|
144 <td><a href="#DownloadManager.save">save</a></td> |
|
145 <td>Public method to save the download settings.</td> |
|
146 </tr><tr> |
|
147 <td><a href="#DownloadManager.setDownloadDirectory">setDownloadDirectory</a></td> |
|
148 <td>Public method to set the current download directory.</td> |
|
149 </tr><tr> |
|
150 <td><a href="#DownloadManager.setRemovePolicy">setRemovePolicy</a></td> |
|
151 <td>Public method to set the remove policy.</td> |
|
152 </tr><tr> |
|
153 <td><a href="#DownloadManager.shutdown">shutdown</a></td> |
|
154 <td>Public method to stop the download manager.</td> |
|
155 </tr> |
|
156 </table> |
|
157 <h3>Static Methods</h3> |
|
158 <table> |
|
159 <tr><td>None</td></tr> |
|
160 </table> |
|
161 <a NAME="DownloadManager.__init__" ID="DownloadManager.__init__"></a> |
|
162 <h4>DownloadManager (Constructor)</h4> |
|
163 <b>DownloadManager</b>(<i>parent=None</i>) |
|
164 <p> |
|
165 Constructor |
|
166 </p><dl> |
|
167 <dt><i>parent</i></dt> |
|
168 <dd> |
|
169 reference to the parent widget (QWidget) |
|
170 </dd> |
|
171 </dl><a NAME="DownloadManager.__addItem" ID="DownloadManager.__addItem"></a> |
|
172 <h4>DownloadManager.__addItem</h4> |
|
173 <b>__addItem</b>(<i>itm</i>) |
|
174 <p> |
|
175 Private method to add a download to the list of downloads. |
|
176 </p><dl> |
|
177 <dt><i>itm</i></dt> |
|
178 <dd> |
|
179 reference to the download item (DownloadItem) |
|
180 </dd> |
|
181 </dl><a NAME="DownloadManager.__contextMenuCancel" ID="DownloadManager.__contextMenuCancel"></a> |
|
182 <h4>DownloadManager.__contextMenuCancel</h4> |
|
183 <b>__contextMenuCancel</b>(<i></i>) |
|
184 <p> |
|
185 Private method to cancel the current download. |
|
186 </p><a NAME="DownloadManager.__contextMenuCopyLink" ID="DownloadManager.__contextMenuCopyLink"></a> |
|
187 <h4>DownloadManager.__contextMenuCopyLink</h4> |
|
188 <b>__contextMenuCopyLink</b>(<i></i>) |
|
189 <p> |
|
190 Private method to copy the download link to the clipboard. |
|
191 </p><a NAME="DownloadManager.__contextMenuGotoPage" ID="DownloadManager.__contextMenuGotoPage"></a> |
|
192 <h4>DownloadManager.__contextMenuGotoPage</h4> |
|
193 <b>__contextMenuGotoPage</b>(<i></i>) |
|
194 <p> |
|
195 Private method to open the download page. |
|
196 </p><a NAME="DownloadManager.__contextMenuOpen" ID="DownloadManager.__contextMenuOpen"></a> |
|
197 <h4>DownloadManager.__contextMenuOpen</h4> |
|
198 <b>__contextMenuOpen</b>(<i></i>) |
|
199 <p> |
|
200 Private method to open the downloaded file. |
|
201 </p><a NAME="DownloadManager.__contextMenuOpenFolder" ID="DownloadManager.__contextMenuOpenFolder"></a> |
|
202 <h4>DownloadManager.__contextMenuOpenFolder</h4> |
|
203 <b>__contextMenuOpenFolder</b>(<i></i>) |
|
204 <p> |
|
205 Private method to open the folder containing the downloaded file. |
|
206 </p><a NAME="DownloadManager.__contextMenuRemoveSelected" ID="DownloadManager.__contextMenuRemoveSelected"></a> |
|
207 <h4>DownloadManager.__contextMenuRemoveSelected</h4> |
|
208 <b>__contextMenuRemoveSelected</b>(<i></i>) |
|
209 <p> |
|
210 Private method to remove the selected downloads from the list. |
|
211 </p><a NAME="DownloadManager.__contextMenuRetry" ID="DownloadManager.__contextMenuRetry"></a> |
|
212 <h4>DownloadManager.__contextMenuRetry</h4> |
|
213 <b>__contextMenuRetry</b>(<i></i>) |
|
214 <p> |
|
215 Private method to retry of the download. |
|
216 </p><a NAME="DownloadManager.__contextMenuSelectAll" ID="DownloadManager.__contextMenuSelectAll"></a> |
|
217 <h4>DownloadManager.__contextMenuSelectAll</h4> |
|
218 <b>__contextMenuSelectAll</b>(<i></i>) |
|
219 <p> |
|
220 Private method to select all downloads. |
|
221 </p><a NAME="DownloadManager.__currentItem" ID="DownloadManager.__currentItem"></a> |
|
222 <h4>DownloadManager.__currentItem</h4> |
|
223 <b>__currentItem</b>(<i></i>) |
|
224 <p> |
|
225 Private method to get a reference to the current item. |
|
226 </p><dl> |
|
227 <dt>Returns:</dt> |
|
228 <dd> |
|
229 reference to the current item (DownloadItem) |
|
230 </dd> |
|
231 </dl><a NAME="DownloadManager.__customContextMenuRequested" ID="DownloadManager.__customContextMenuRequested"></a> |
|
232 <h4>DownloadManager.__customContextMenuRequested</h4> |
|
233 <b>__customContextMenuRequested</b>(<i>pos</i>) |
|
234 <p> |
|
235 Private slot to handle the context menu request for the bookmarks tree. |
|
236 </p><dl> |
|
237 <dt><i>pos</i></dt> |
|
238 <dd> |
|
239 position the context menu was requested (QPoint) |
|
240 </dd> |
|
241 </dl><a NAME="DownloadManager.__finished" ID="DownloadManager.__finished"></a> |
|
242 <h4>DownloadManager.__finished</h4> |
|
243 <b>__finished</b>(<i></i>) |
|
244 <p> |
|
245 Private slot to handle a finished download. |
|
246 </p><a NAME="DownloadManager.__load" ID="DownloadManager.__load"></a> |
|
247 <h4>DownloadManager.__load</h4> |
|
248 <b>__load</b>(<i></i>) |
|
249 <p> |
|
250 Private method to load the download settings. |
|
251 </p><a NAME="DownloadManager.__updateActiveItemCount" ID="DownloadManager.__updateActiveItemCount"></a> |
|
252 <h4>DownloadManager.__updateActiveItemCount</h4> |
|
253 <b>__updateActiveItemCount</b>(<i></i>) |
|
254 <p> |
|
255 Private method to update the window title. |
|
256 </p><a NAME="DownloadManager.__updateItemCount" ID="DownloadManager.__updateItemCount"></a> |
|
257 <h4>DownloadManager.__updateItemCount</h4> |
|
258 <b>__updateItemCount</b>(<i></i>) |
|
259 <p> |
|
260 Private method to update the count label. |
|
261 </p><a NAME="DownloadManager.__updateRow" ID="DownloadManager.__updateRow"></a> |
|
262 <h4>DownloadManager.__updateRow</h4> |
|
263 <b>__updateRow</b>(<i>itm=None</i>) |
|
264 <p> |
|
265 Private slot to update a download item. |
|
266 </p><dl> |
|
267 <dt><i>itm</i></dt> |
|
268 <dd> |
|
269 reference to the download item (DownloadItem) |
|
270 </dd> |
|
271 </dl><a NAME="DownloadManager.activeDownloads" ID="DownloadManager.activeDownloads"></a> |
|
272 <h4>DownloadManager.activeDownloads</h4> |
|
273 <b>activeDownloads</b>(<i></i>) |
|
274 <p> |
|
275 Public method to get the number of active downloads. |
|
276 </p><dl> |
|
277 <dt>Returns:</dt> |
|
278 <dd> |
|
279 number of active downloads (integer) |
|
280 </dd> |
|
281 </dl><a NAME="DownloadManager.allowQuit" ID="DownloadManager.allowQuit"></a> |
|
282 <h4>DownloadManager.allowQuit</h4> |
|
283 <b>allowQuit</b>(<i></i>) |
|
284 <p> |
|
285 Public method to check, if it is ok to quit. |
|
286 </p><dl> |
|
287 <dt>Returns:</dt> |
|
288 <dd> |
|
289 flag indicating allowance to quit (boolean) |
|
290 </dd> |
|
291 </dl><a NAME="DownloadManager.changeOccurred" ID="DownloadManager.changeOccurred"></a> |
|
292 <h4>DownloadManager.changeOccurred</h4> |
|
293 <b>changeOccurred</b>(<i></i>) |
|
294 <p> |
|
295 Public method to signal a change. |
|
296 </p><a NAME="DownloadManager.cleanup" ID="DownloadManager.cleanup"></a> |
|
297 <h4>DownloadManager.cleanup</h4> |
|
298 <b>cleanup</b>(<i></i>) |
|
299 <p> |
|
300 Public slot to cleanup the downloads. |
|
301 </p><a NAME="DownloadManager.count" ID="DownloadManager.count"></a> |
|
302 <h4>DownloadManager.count</h4> |
|
303 <b>count</b>(<i></i>) |
|
304 <p> |
|
305 Public method to get the number of downloads. |
|
306 </p><dl> |
|
307 <dt>Returns:</dt> |
|
308 <dd> |
|
309 number of downloads (integer) |
|
310 </dd> |
|
311 </dl><a NAME="DownloadManager.download" ID="DownloadManager.download"></a> |
|
312 <h4>DownloadManager.download</h4> |
|
313 <b>download</b>(<i>requestOrUrl, requestFileName=False, mainWindow=None</i>) |
|
314 <p> |
|
315 Public method to download a file. |
|
316 </p><dl> |
|
317 <dt><i>requestOrUrl</i></dt> |
|
318 <dd> |
|
319 reference to a request object (QNetworkRequest) |
|
320 or a URL to be downloaded (QUrl) |
|
321 </dd><dt><i>requestFileName=</i></dt> |
|
322 <dd> |
|
323 flag indicating to ask for the |
|
324 download file name (boolean) |
|
325 </dd><dt><i>mainWindow=</i></dt> |
|
326 <dd> |
|
327 reference to the main window (HelpWindow) |
|
328 </dd> |
|
329 </dl><a NAME="DownloadManager.downloadDirectory" ID="DownloadManager.downloadDirectory"></a> |
|
330 <h4>DownloadManager.downloadDirectory</h4> |
|
331 <b>downloadDirectory</b>(<i></i>) |
|
332 <p> |
|
333 Public method to get the current download directory. |
|
334 </p><dl> |
|
335 <dt>Returns:</dt> |
|
336 <dd> |
|
337 current download directory (string) |
|
338 </dd> |
|
339 </dl><a NAME="DownloadManager.downloads" ID="DownloadManager.downloads"></a> |
|
340 <h4>DownloadManager.downloads</h4> |
|
341 <b>downloads</b>(<i></i>) |
|
342 <p> |
|
343 Public method to get a reference to the downloads. |
|
344 </p><dl> |
|
345 <dt>Returns:</dt> |
|
346 <dd> |
|
347 reference to the downloads (list of DownloadItem) |
|
348 </dd> |
|
349 </dl><a NAME="DownloadManager.handleUnsupportedContent" ID="DownloadManager.handleUnsupportedContent"></a> |
|
350 <h4>DownloadManager.handleUnsupportedContent</h4> |
|
351 <b>handleUnsupportedContent</b>(<i>reply, requestFileName=False, webPage=None, download=False, mainWindow=None</i>) |
|
352 <p> |
|
353 Public method to handle unsupported content by downloading the |
|
354 referenced resource. |
|
355 </p><dl> |
|
356 <dt><i>reply</i></dt> |
|
357 <dd> |
|
358 reference to the reply object (QNetworkReply) |
|
359 </dd><dt><i>requestFileName=</i></dt> |
|
360 <dd> |
|
361 indicating to ask for a filename |
|
362 (boolean) |
|
363 </dd><dt><i>webPage=</i></dt> |
|
364 <dd> |
|
365 reference to the web page (HelpWebPage) |
|
366 </dd><dt><i>download=</i></dt> |
|
367 <dd> |
|
368 flag indicating a download request (boolean) |
|
369 </dd><dt><i>mainWindow=</i></dt> |
|
370 <dd> |
|
371 reference to the main window (HelpWindow) |
|
372 </dd> |
|
373 </dl><a NAME="DownloadManager.on_cleanupButton_clicked" ID="DownloadManager.on_cleanupButton_clicked"></a> |
|
374 <h4>DownloadManager.on_cleanupButton_clicked</h4> |
|
375 <b>on_cleanupButton_clicked</b>(<i></i>) |
|
376 <p> |
|
377 Private slot cleanup the downloads. |
|
378 </p><a NAME="DownloadManager.removePolicy" ID="DownloadManager.removePolicy"></a> |
|
379 <h4>DownloadManager.removePolicy</h4> |
|
380 <b>removePolicy</b>(<i></i>) |
|
381 <p> |
|
382 Public method to get the remove policy. |
|
383 </p><dl> |
|
384 <dt>Returns:</dt> |
|
385 <dd> |
|
386 remove policy (integer) |
|
387 </dd> |
|
388 </dl><a NAME="DownloadManager.save" ID="DownloadManager.save"></a> |
|
389 <h4>DownloadManager.save</h4> |
|
390 <b>save</b>(<i></i>) |
|
391 <p> |
|
392 Public method to save the download settings. |
|
393 </p><a NAME="DownloadManager.setDownloadDirectory" ID="DownloadManager.setDownloadDirectory"></a> |
|
394 <h4>DownloadManager.setDownloadDirectory</h4> |
|
395 <b>setDownloadDirectory</b>(<i>directory</i>) |
|
396 <p> |
|
397 Public method to set the current download directory. |
|
398 </p><dl> |
|
399 <dt><i>directory</i></dt> |
|
400 <dd> |
|
401 current download directory (string) |
|
402 </dd> |
|
403 </dl><a NAME="DownloadManager.setRemovePolicy" ID="DownloadManager.setRemovePolicy"></a> |
|
404 <h4>DownloadManager.setRemovePolicy</h4> |
|
405 <b>setRemovePolicy</b>(<i>policy</i>) |
|
406 <p> |
|
407 Public method to set the remove policy. |
|
408 </p><dl> |
|
409 <dt><i>policy</i></dt> |
|
410 <dd> |
|
411 policy to be set |
|
412 (DownloadManager.RemoveExit, DownloadManager.RemoveNever, |
|
413 DownloadManager.RemoveSuccessFullDownload) |
|
414 </dd> |
|
415 </dl><a NAME="DownloadManager.shutdown" ID="DownloadManager.shutdown"></a> |
|
416 <h4>DownloadManager.shutdown</h4> |
|
417 <b>shutdown</b>(<i></i>) |
|
418 <p> |
|
419 Public method to stop the download manager. |
|
420 </p> |
|
421 <div align="right"><a href="#top">Up</a></div> |
|
422 <hr /> |
|
423 </body></html> |