E5Network/E5NetworkProxyFactory.py

changeset 2080
4b33165dd55b
parent 1936
536b88d73d53
child 2302
f29e9405c851
equal deleted inserted replaced
2079:febae63bb821 2080:4b33165dd55b
7 Module implementing a network proxy factory. 7 Module implementing a network proxy factory.
8 """ 8 """
9 9
10 import os 10 import os
11 11
12 from PyQt4.QtCore import QUrl, Qt, QCoreApplication 12 from PyQt4.QtCore import QUrl, QCoreApplication
13 from PyQt4.QtGui import QDialog 13 from PyQt4.QtGui import QDialog
14 from PyQt4.QtNetwork import QNetworkProxyFactory, QNetworkProxy, QNetworkProxyQuery 14 from PyQt4.QtNetwork import QNetworkProxyFactory, QNetworkProxy, QNetworkProxyQuery
15 15
16 from E5Gui import E5MessageBox 16 from E5Gui import E5MessageBox
17 17
18 from UI.AuthenticationDialog import AuthenticationDialog 18 from UI.AuthenticationDialog import AuthenticationDialog
19 19
20 import Preferences 20 import Preferences
21 import Globals 21 import Globals
22 import Utilities
22 23
23 24
24 def schemeFromProxyType(proxyType): 25 def schemeFromProxyType(proxyType):
25 """ 26 """
26 Module function to determine the scheme name from the proxy type. 27 Module function to determine the scheme name from the proxy type.
47 @param proxy reference to the proxy object (QNetworkProxy) 48 @param proxy reference to the proxy object (QNetworkProxy)
48 @param auth reference to the authenticator object (QAuthenticator) 49 @param auth reference to the authenticator object (QAuthenticator)
49 """ 50 """
50 info = QCoreApplication.translate("E5NetworkProxyFactory", 51 info = QCoreApplication.translate("E5NetworkProxyFactory",
51 "<b>Connect to proxy '{0}' using:</b>")\ 52 "<b>Connect to proxy '{0}' using:</b>")\
52 .format(Qt.escape(proxy.hostName())) 53 .format(Utilities.html_encode(proxy.hostName()))
53 54
54 dlg = AuthenticationDialog(info, proxy.user(), True) 55 dlg = AuthenticationDialog(info, proxy.user(), True)
55 dlg.setData(proxy.user(), proxy.password()) 56 dlg.setData(proxy.user(), proxy.password())
56 if dlg.exec_() == QDialog.Accepted: 57 if dlg.exec_() == QDialog.Accepted:
57 username, password = dlg.getData() 58 username, password = dlg.getData()

eric ide

mercurial