diff feedworm.py @ 137:5b131f82057d

allow choosing the backend via commandline option
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 23 Aug 2011 14:36:58 +0200
parents feedworm-gui.py@9e1e6b96d8b0
children 2c91b5653878
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/feedworm.py	Tue Aug 23 14:36:58 2011 +0200
@@ -0,0 +1,31 @@
+
+from MainWindow import MainWindow
+from PyQt4 import QtGui
+from PyQt4.QtNetwork import QNetworkProxy
+import BackendFactory
+import logging
+import sys
+
+def setupProxy(preferences):
+    if preferences.isProxyConfigured():
+        proxyHost = preferences.proxyHost()
+        proxyPort = preferences.proxyPort()
+        proxy = QNetworkProxy(QNetworkProxy.HttpProxy, proxyHost, proxyPort)
+        QNetworkProxy.setApplicationProxy(proxy)
+    
+if __name__ == '__main__':
+    logging.basicConfig(level=logging.DEBUG)
+    backend = BackendFactory.createBackend()
+    preferences = backend.preferences()
+    setupProxy(preferences)
+
+    app = QtGui.QApplication(sys.argv)
+    mainWindow = MainWindow(backend)
+
+    maximized = preferences.startMaximized()
+    if maximized:
+        mainWindow.showMaximized()
+    else:
+        mainWindow.show()
+
+    sys.exit(app.exec_())