Helpviewer/Download/DownloadManager.py

changeset 2954
bf0215fe12d1
parent 2403
e3d7a861547c
child 3002
6ffc581f00f1
equal deleted inserted replaced
2953:703452a2876f 2954:bf0215fe12d1
22 import Preferences 22 import Preferences
23 23
24 24
25 class DownloadManager(QDialog, Ui_DownloadManager): 25 class DownloadManager(QDialog, Ui_DownloadManager):
26 """ 26 """
27 Class implementing the download manager 27 Class implementing the download manager.
28 """ 28 """
29 RemoveNever = 0 29 RemoveNever = 0
30 RemoveExit = 1 30 RemoveExit = 1
31 RemoveSuccessFullDownload = 2 31 RemoveSuccessFullDownload = 2
32 32
163 requestFileName=requestFileName, 163 requestFileName=requestFileName,
164 download=True, 164 download=True,
165 mainWindow=mainWindow) 165 mainWindow=mainWindow)
166 166
167 def handleUnsupportedContent(self, reply, requestFileName=False, 167 def handleUnsupportedContent(self, reply, requestFileName=False,
168 webPage=None, download=False, mainWindow=None): 168 webPage=None, download=False,
169 mainWindow=None):
169 """ 170 """
170 Public method to handle unsupported content by downloading the 171 Public method to handle unsupported content by downloading the
171 referenced resource. 172 referenced resource.
172 173
173 @param reply reference to the reply object (QNetworkReply) 174 @param reply reference to the reply object (QNetworkReply)
174 @keyparam requestFilename indicating to ask for a filename 175 @keyparam requestFileName indicating to ask for a filename
175 (boolean) 176 (boolean)
176 @keyparam webPage reference to the web page (HelpWebPage) 177 @keyparam webPage reference to the web page (HelpWebPage)
177 @keyparam download flag indicating a download request (boolean) 178 @keyparam download flag indicating a download request (boolean)
178 @keyparam mainWindow reference to the main window (HelpWindow) 179 @keyparam mainWindow reference to the main window (HelpWindow)
179 """ 180 """
183 size = reply.header(QNetworkRequest.ContentLengthHeader) 184 size = reply.header(QNetworkRequest.ContentLengthHeader)
184 if size == 0: 185 if size == 0:
185 return 186 return
186 187
187 from .DownloadItem import DownloadItem 188 from .DownloadItem import DownloadItem
188 itm = DownloadItem(reply=reply, requestFilename=requestFileName, 189 itm = DownloadItem(
189 webPage=webPage, download=download, parent=self, mainWindow=mainWindow) 190 reply=reply, requestFilename=requestFileName,
191 webPage=webPage, download=download, parent=self,
192 mainWindow=mainWindow)
190 self.__addItem(itm) 193 self.__addItem(itm)
191 194
192 if itm.canceledFileSelect(): 195 if itm.canceledFileSelect():
193 return 196 return
194 197

eric ide

mercurial