comparison feedworm-gui.py @ 87:b8bfd1bd6c55

use a proxy if one is configured. TODO: GUI for configuring the proxy server
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 17 Nov 2010 21:22:31 +0100
parents 12ed8b5fa08c
children 04a730f9d07d
comparison
equal deleted inserted replaced
86:94118d504d2b 87:b8bfd1bd6c55
1 1
2 import Database 2 import Database
3 from MainWindow import MainWindow 3 from MainWindow import MainWindow
4 from Preferences import Preferences 4 from Preferences import Preferences
5 from PyQt4 import QtGui 5 from PyQt4 import QtGui
6 from PyQt4.QtNetwork import QNetworkProxy
6 import sys 7 import sys
7 import util 8 import util
9
10 def setupProxy(preferences):
11 if preferences.isProxyConfigured():
12 proxyHost = preferences.proxyHost()
13 proxyPort = preferences.proxyPort()
14 proxy = QNetworkProxy(QNetworkProxy.HttpProxy, proxyHost, proxyPort)
15 QNetworkProxy.setApplicationProxy(proxy)
8 16
9 if __name__ == '__main__': 17 if __name__ == '__main__':
10 util.configureLogging() 18 util.configureLogging()
11 session = Database.createSession() 19 session = Database.createSession()
12 20 preferences = Preferences(session)
21
22 setupProxy(preferences)
23
13 app = QtGui.QApplication(sys.argv) 24 app = QtGui.QApplication(sys.argv)
14 mainWindow = MainWindow(session) 25 mainWindow = MainWindow(session)
15 26
16 maximized = Preferences(session).startMaximized() 27 maximized = preferences.startMaximized()
17 if maximized: 28 if maximized:
18 mainWindow.showMaximized() 29 mainWindow.showMaximized()
19 else: 30 else:
20 mainWindow.show() 31 mainWindow.show()
21 32