Mercurial > hg > Feedworm
annotate feedworm.py @ 259:304917762618 default tip
implementation of feed updates
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Tue, 12 Mar 2019 02:41:22 +0100 |
parents | 3ce39af93e77 |
children |
rev | line source |
---|---|
217
bb3c851b18b1
add source file endcoding header
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
195
diff
changeset
|
1 # -*- coding: utf-8 -*- |
225 | 2 |
3 # see http://stackoverflow.com/questions/6238193/pyqt-new-api-with-python-2 | |
4 import sip | |
5 sip.setapi('QString', 2) | |
6 sip.setapi('QVariant', 2) | |
7 | |
24
6b5ceffabe49
MainWindowController -> MainWindow
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
14
diff
changeset
|
8 from MainWindow import MainWindow |
251 | 9 from PyQt5 import QtGui |
10 from PyQt5.QtWidgets import QApplication | |
11 from PyQt5.QtNetwork import QNetworkProxy | |
137
5b131f82057d
allow choosing the backend via commandline option
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
12 import BackendFactory |
119
04a730f9d07d
move all sqlalchemy related classes to the respective sub-package. use a backend to abstract from access to the data
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
87
diff
changeset
|
13 import logging |
14 | 14 import sys |
195
66d1efcb8e8a
filter out warnings that we cannot handle
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
194
diff
changeset
|
15 import warnings |
14 | 16 |
225 | 17 def filterWarnings(): |
18 # filter out the warnings about duplicate inclusion of argparse | |
19 warnings.filterwarnings("ignore", category=UserWarning) | |
20 | |
21 def configureLogging(): | |
22 logging.basicConfig(level=logging.DEBUG) | |
233
e34c53a3e407
fixes from eric's style check
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
225
diff
changeset
|
23 |
87
b8bfd1bd6c55
use a proxy if one is configured. TODO: GUI for configuring the proxy server
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
43
diff
changeset
|
24 def setupProxy(preferences): |
194
2c91b5653878
enable/disable using the proxy via a preference setting
dirk
parents:
137
diff
changeset
|
25 if preferences.isProxyConfigured() and preferences.useProxy(): |
87
b8bfd1bd6c55
use a proxy if one is configured. TODO: GUI for configuring the proxy server
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
43
diff
changeset
|
26 proxyHost = preferences.proxyHost() |
b8bfd1bd6c55
use a proxy if one is configured. TODO: GUI for configuring the proxy server
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
43
diff
changeset
|
27 proxyPort = preferences.proxyPort() |
b8bfd1bd6c55
use a proxy if one is configured. TODO: GUI for configuring the proxy server
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
43
diff
changeset
|
28 proxy = QNetworkProxy(QNetworkProxy.HttpProxy, proxyHost, proxyPort) |
b8bfd1bd6c55
use a proxy if one is configured. TODO: GUI for configuring the proxy server
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
43
diff
changeset
|
29 QNetworkProxy.setApplicationProxy(proxy) |
194
2c91b5653878
enable/disable using the proxy via a preference setting
dirk
parents:
137
diff
changeset
|
30 |
14 | 31 if __name__ == '__main__': |
225 | 32 filterWarnings() |
33 configureLogging() | |
246
7c719c4f5655
Fix all remaining code style bugs
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
233
diff
changeset
|
34 |
137
5b131f82057d
allow choosing the backend via commandline option
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
35 backend = BackendFactory.createBackend() |
119
04a730f9d07d
move all sqlalchemy related classes to the respective sub-package. use a backend to abstract from access to the data
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
87
diff
changeset
|
36 preferences = backend.preferences() |
87
b8bfd1bd6c55
use a proxy if one is configured. TODO: GUI for configuring the proxy server
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
43
diff
changeset
|
37 setupProxy(preferences) |
b8bfd1bd6c55
use a proxy if one is configured. TODO: GUI for configuring the proxy server
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
43
diff
changeset
|
38 |
251 | 39 app = QApplication(sys.argv) |
119
04a730f9d07d
move all sqlalchemy related classes to the respective sub-package. use a backend to abstract from access to the data
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
87
diff
changeset
|
40 mainWindow = MainWindow(backend) |
87
b8bfd1bd6c55
use a proxy if one is configured. TODO: GUI for configuring the proxy server
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
43
diff
changeset
|
41 |
b8bfd1bd6c55
use a proxy if one is configured. TODO: GUI for configuring the proxy server
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
43
diff
changeset
|
42 maximized = preferences.startMaximized() |
43
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
43 if maximized: |
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
44 mainWindow.showMaximized() |
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
45 else: |
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
46 mainWindow.show() |
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
47 |
14 | 48 sys.exit(app.exec_()) |