Mercurial > hg > Feedworm
annotate feedworm-gui.py @ 110:43c234c8fe87
store the number of days to keep feed entries as preference setting in the database. The feed update process reads and uses that value.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Wed, 30 Mar 2011 02:59:22 +0200 |
parents | b8bfd1bd6c55 |
children | 04a730f9d07d |
rev | line source |
---|---|
14 | 1 |
36
74b8c9a9d5de
adjust the gui starter to the new database initialization
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
24
diff
changeset
|
2 import Database |
24
6b5ceffabe49
MainWindowController -> MainWindow
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
14
diff
changeset
|
3 from MainWindow import MainWindow |
43
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
4 from Preferences import Preferences |
14 | 5 from PyQt4 import QtGui |
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
|
6 from PyQt4.QtNetwork import QNetworkProxy |
14 | 7 import sys |
36
74b8c9a9d5de
adjust the gui starter to the new database initialization
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
24
diff
changeset
|
8 import util |
14 | 9 |
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
|
10 def 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
|
11 if preferences.isProxyConfigured(): |
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
|
12 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
|
13 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
|
14 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
|
15 QNetworkProxy.setApplicationProxy(proxy) |
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
|
16 |
14 | 17 if __name__ == '__main__': |
36
74b8c9a9d5de
adjust the gui starter to the new database initialization
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
24
diff
changeset
|
18 util.configureLogging() |
74b8c9a9d5de
adjust the gui starter to the new database initialization
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
24
diff
changeset
|
19 session = Database.createSession() |
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
|
20 preferences = Preferences(session) |
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
|
21 |
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
|
22 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
|
23 |
14 | 24 app = QtGui.QApplication(sys.argv) |
24
6b5ceffabe49
MainWindowController -> MainWindow
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
14
diff
changeset
|
25 mainWindow = MainWindow(session) |
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 |
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 maximized = preferences.startMaximized() |
43
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
28 if maximized: |
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
29 mainWindow.showMaximized() |
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
30 else: |
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
31 mainWindow.show() |
12ed8b5fa08c
first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
38
diff
changeset
|
32 |
14 | 33 sys.exit(app.exec_()) |