155 @param directory name of the directory to store the file into (string) |
155 @param directory name of the directory to store the file into (string) |
156 @return proposed filename (string) |
156 @return proposed filename (string) |
157 """ |
157 """ |
158 path = "" |
158 path = "" |
159 if self.__reply.hasRawHeader("Content-Disposition"): |
159 if self.__reply.hasRawHeader("Content-Disposition"): |
160 header = unicode(self.__reply.rawHeader("Content-Disposition")) |
160 header = str(self.__reply.rawHeader("Content-Disposition")) |
161 if header: |
161 if header: |
162 pos = header.find("filename=") |
162 pos = header.find("filename=") |
163 if pos != -1: |
163 if pos != -1: |
164 path = header[pos + 9:] |
164 path = header[pos + 9:] |
165 if path.startswith('"') and path.endswith('"'): |
165 if path.startswith('"') and path.endswith('"'): |
365 """ |
365 """ |
366 unit = "" |
366 unit = "" |
367 if size < 1024: |
367 if size < 1024: |
368 unit = self.trUtf8("bytes") |
368 unit = self.trUtf8("bytes") |
369 elif size < 1024 * 1024: |
369 elif size < 1024 * 1024: |
370 size /= 1024 |
370 size //= 1024 |
371 unit = self.trUtf8("kB") |
371 unit = self.trUtf8("kB") |
372 else: |
372 else: |
373 size /= 1024 * 1024 |
373 size //= 1024 * 1024 |
374 unit = self.trUtf8("MB") |
374 unit = self.trUtf8("MB") |
375 return "{0} {1}".format(size, unit) |
375 return "{0} {1}".format(size, unit) |
376 |
376 |
377 def __downloading(self): |
377 def __downloading(self): |
378 """ |
378 """ |