E5Network/E5NetworkProxyFactory.py

changeset 882
34b86be88bf0
parent 791
9ec2ac20e54e
child 945
8cd4d08fa9f6
child 1060
e56185898d97
equal deleted inserted replaced
881:ff23d907f87b 882:34b86be88bf0
5 5
6 """ 6 """
7 Module implementing a network proxy factory. 7 Module implementing a network proxy factory.
8 """ 8 """
9 9
10 import sys
11 import os 10 import os
12 11
13 from PyQt4.QtCore import QUrl, Qt, QCoreApplication 12 from PyQt4.QtCore import QUrl, Qt, QCoreApplication
14 from PyQt4.QtGui import QDialog 13 from PyQt4.QtGui import QDialog
15 from PyQt4.QtNetwork import QNetworkProxyFactory, QNetworkProxy, QNetworkProxyQuery 14 from PyQt4.QtNetwork import QNetworkProxyFactory, QNetworkProxy, QNetworkProxyQuery
17 from E5Gui import E5MessageBox 16 from E5Gui import E5MessageBox
18 17
19 from UI.AuthenticationDialog import AuthenticationDialog 18 from UI.AuthenticationDialog import AuthenticationDialog
20 19
21 import Preferences 20 import Preferences
21 import Globals
22 22
23 def schemeFromProxyType(proxyType): 23 def schemeFromProxyType(proxyType):
24 """ 24 """
25 Module function to determine the scheme name from the proxy type. 25 Module function to determine the scheme name from the proxy type.
26 26
82 if query.queryType() == QNetworkProxyQuery.UrlRequest and \ 82 if query.queryType() == QNetworkProxyQuery.UrlRequest and \
83 query.protocolTag() in ["http", "https", "ftp"] and \ 83 query.protocolTag() in ["http", "https", "ftp"] and \
84 Preferences.getUI("UseProxy"): 84 Preferences.getUI("UseProxy"):
85 if Preferences.getUI("UseSystemProxy"): 85 if Preferences.getUI("UseSystemProxy"):
86 proxyList = QNetworkProxyFactory.systemProxyForQuery(query) 86 proxyList = QNetworkProxyFactory.systemProxyForQuery(query)
87 if sys.platform not in ["darwin", "nt"] and \ 87 if (not Globals.isWindowsPlatform() and \
88 not Globals.isMacPlatform()) and \
88 len(proxyList) == 1 and \ 89 len(proxyList) == 1 and \
89 proxyList[0].type() == QNetworkProxy.NoProxy: 90 proxyList[0].type() == QNetworkProxy.NoProxy:
90 # try it the Python way 91 # try it the Python way
91 # scan the environment for variables named <scheme>_proxy 92 # scan the environment for variables named <scheme>_proxy
92 # scan over whole environment to make this case insensitive 93 # scan over whole environment to make this case insensitive

eric ide

mercurial