-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysolarsystem.py
58 lines (40 loc) · 1.1 KB
/
mysolarsystem.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import sys
from controller import controller
import math
#sys.path.append("/home/leevi/projektit/MySolarSystem")
def main_gui(controller):
'''
Function executes Qt GUI
'''
from PySide import QtCore, QtGui
from gui.main import Ui_Main
app = QtGui.QApplication(sys.argv)
MainWindow = QtGui.QMainWindow()
ui = Ui_Main(controller)
ui.startMain(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
def main_cli(controller):
'''
Executes CLI
'''
from cli.cli import Cli_Main
ui = Cli_Main(controller)
ui.menu()
if __name__ == "__main__":
'''
Starts application.
If no ui type is given as argv, then starts GUI
'''
controller = controller()
if len(sys.argv) > 1:
ui_type = sys.argv[1]
# testdata here
if ui_type == "cli":
main_cli(controller)
elif ui_type == "gui":
main_gui(controller)
else:
print "unknown ui type: " + ui_type
else:
main_gui(controller)