view feedworm.py @ 256:f79be01821c4

Arangodb backend, first version which barely works for reading
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 30 Jan 2019 07:11:10 +0100
parents 3ce39af93e77
children
line wrap: on
line source

# -*- coding: utf-8 -*-

# see http://stackoverflow.com/questions/6238193/pyqt-new-api-with-python-2
import sip
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)

from MainWindow import MainWindow
from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication
from PyQt5.QtNetwork import QNetworkProxy
import BackendFactory
import logging
import sys
import warnings

def filterWarnings():
    # filter out the warnings about duplicate inclusion of argparse
    warnings.filterwarnings("ignore", category=UserWarning)

def configureLogging():
    logging.basicConfig(level=logging.DEBUG)

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__':
    filterWarnings()
    configureLogging()

    backend = BackendFactory.createBackend()
    preferences = backend.preferences()
    setupProxy(preferences)

    app = QApplication(sys.argv)
    mainWindow = MainWindow(backend)

    maximized = preferences.startMaximized()
    if maximized:
        mainWindow.showMaximized()
    else:
        mainWindow.show()

    sys.exit(app.exec_())