view feedworm.py @ 222:fe6a2dad6e29

ignore hg reverted files
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 22 May 2014 05:11:35 +0200
parents bb3c851b18b1
children f6dcc85cd8ca
line wrap: on
line source

# -*- coding: utf-8 -*-
from MainWindow import MainWindow
from PyQt4 import QtGui
from PyQt4.QtNetwork import QNetworkProxy
import BackendFactory
import logging
import sys
import warnings

def setupProxy(preferences):
    if preferences.isProxyConfigured() and preferences.useProxy():
        proxyHost = preferences.proxyHost()
        proxyPort = preferences.proxyPort()
        proxy = QNetworkProxy(QNetworkProxy.HttpProxy, proxyHost, proxyPort)
        QNetworkProxy.setApplicationProxy(proxy)

if __name__ == '__main__':
    # filter out the warnings about duplicate inclusion of argparse
    warnings.filterwarnings("ignore", category=UserWarning)

    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_())