Helpviewer/Network/FtpReply.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3484
645c12de6b0c
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
266 if lines[1][:3] == "530": 266 if lines[1][:3] == "530":
267 if "usage" in "\n".join(lines[1:].lower()): 267 if "usage" in "\n".join(lines[1:].lower()):
268 # found a not supported proxy 268 # found a not supported proxy
269 self.setError( 269 self.setError(
270 QNetworkReply.ProxyConnectionRefusedError, 270 QNetworkReply.ProxyConnectionRefusedError,
271 self.trUtf8("The proxy type seems to be wrong." 271 self.tr("The proxy type seems to be wrong."
272 " If it is not in the list of" 272 " If it is not in the list of"
273 " supported proxy types please report" 273 " supported proxy types please report"
274 " it with the instructions given by" 274 " it with the instructions given by"
275 " the proxy.\n{0}").format( 275 " the proxy.\n{0}").format(
276 "\n".join(lines[1:]))) 276 "\n".join(lines[1:])))
277 self.error.emit( 277 self.error.emit(
278 QNetworkReply.ProxyConnectionRefusedError) 278 QNetworkReply.ProxyConnectionRefusedError)
279 return False, False 279 return False, False
280 else: 280 else:
281 from UI.AuthenticationDialog import \ 281 from UI.AuthenticationDialog import \
282 AuthenticationDialog 282 AuthenticationDialog
283 info = self.trUtf8( 283 info = self.tr(
284 "<b>Connect to proxy '{0}' using:</b>")\ 284 "<b>Connect to proxy '{0}' using:</b>")\
285 .format(Utilities.html_encode( 285 .format(Utilities.html_encode(
286 Preferences.getUI("ProxyHost/Ftp"))) 286 Preferences.getUI("ProxyHost/Ftp")))
287 dlg = AuthenticationDialog( 287 dlg = AuthenticationDialog(
288 info, Preferences.getUI("ProxyUser/Ftp"), True) 288 info, Preferences.getUI("ProxyUser/Ftp"), True)
413 parent = u.resolved(QUrl("..")) 413 parent = u.resolved(QUrl(".."))
414 if parent.isParentOf(u): 414 if parent.isParentOf(u):
415 icon = UI.PixmapCache.getIcon("up.png") 415 icon = UI.PixmapCache.getIcon("up.png")
416 linkClasses["link_parent"] = \ 416 linkClasses["link_parent"] = \
417 self.__cssLinkClass(icon, iconSize).format("link_parent") 417 self.__cssLinkClass(icon, iconSize).format("link_parent")
418 parentStr = self.trUtf8( 418 parentStr = self.tr(
419 """ <p><a class="link_parent" href="{0}">""" 419 """ <p><a class="link_parent" href="{0}">"""
420 """Change to parent directory</a></p>""" 420 """Change to parent directory</a></p>"""
421 ).format(parent.toString()) 421 ).format(parent.toString())
422 else: 422 else:
423 parentStr = "" 423 parentStr = ""
426 """ <tr class="{0}">"""\ 426 """ <tr class="{0}">"""\
427 """<td class="name"><a class="{1}" href="{2}">{3}</a></td>"""\ 427 """<td class="name"><a class="{1}" href="{2}">{3}</a></td>"""\
428 """<td class="size">{4}</td>"""\ 428 """<td class="size">{4}</td>"""\
429 """<td class="modified">{5}</td>"""\ 429 """<td class="modified">{5}</td>"""\
430 """</tr>\n""" 430 """</tr>\n"""
431 table = self.trUtf8( 431 table = self.tr(
432 """ <tr>""" 432 """ <tr>"""
433 """<th align="left">Name</th>""" 433 """<th align="left">Name</th>"""
434 """<th>Size</th>""" 434 """<th>Size</th>"""
435 """<th align="left">Last modified</th>""" 435 """<th align="left">Last modified</th>"""
436 """</tr>\n""" 436 """</tr>\n"""
452 size = newSize 452 size = newSize
453 unit += 1 453 unit += 1
454 else: 454 else:
455 break 455 break
456 456
457 sizeStr = self.trUtf8("{0} {1}", "size unit")\ 457 sizeStr = self.tr("{0} {1}", "size unit")\
458 .format(size, self.__units[unit]) 458 .format(size, self.__units[unit])
459 linkClass = "link_file" 459 linkClass = "link_file"
460 if linkClass not in linkClasses: 460 if linkClass not in linkClasses:
461 icon = UI.PixmapCache.getIcon("fileMisc.png") 461 icon = UI.PixmapCache.getIcon("fileMisc.png")
462 linkClasses[linkClass] = \ 462 linkClasses[linkClass] = \
479 i = 1 - i 479 i = 1 - i
480 480
481 content = ftpListPage_html.format( 481 content = ftpListPage_html.format(
482 Utilities.html_encode(baseUrl), 482 Utilities.html_encode(baseUrl),
483 "".join(linkClasses.values()), 483 "".join(linkClasses.values()),
484 self.trUtf8("Listing of {0}").format(basePath), 484 self.tr("Listing of {0}").format(basePath),
485 parentStr, 485 parentStr,
486 table 486 table
487 ) 487 )
488 self.__content = QByteArray(content.encode("utf8")) 488 self.__content = QByteArray(content.encode("utf8"))
489 self.__content.append(512 * b' ') 489 self.__content.append(512 * b' ')

eric ide

mercurial