annotate feedworm-gui.py @ 118:0e73adb2dec4 backend

branch for extracting backends
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sun, 21 Aug 2011 02:47:25 +0200
parents b8bfd1bd6c55
children 04a730f9d07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
42a225be7e56 first version of the GUI
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
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
42a225be7e56 first version of the GUI
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
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
42a225be7e56 first version of the GUI
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
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
42a225be7e56 first version of the GUI
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
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
42a225be7e56 first version of the GUI
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
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
42a225be7e56 first version of the GUI
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
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
42a225be7e56 first version of the GUI
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
33 sys.exit(app.exec_())