-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·64 lines (45 loc) · 1.53 KB
/
main.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
59
60
61
62
63
64
'''
Created on Aug 11, 2014
This file is the starting point of the application.
Run this file to to start Pushup-app.
On most linux distros, you can do it by opening the terminal in the Pushup-app
folder and typing :
"python ./main.py"
@author: davide
'''
from os import sys
from PySide.QtGui import QApplication
from Control.MainWindow import MainWindow
from Control.ProfileSelector import ProfileSelector
from Control.ProfileCreation import ProfileCreation
from Foundation.Athlete import Athlete as Athlete_Database
def getAthleteProfile():
database = Athlete_Database()
athletes = database.getAthletes()
if len(athletes) == 0:
profileCreation = ProfileCreation()
profileCreation.run()
athlete = database.getAthletes()[0]
if athlete is not False:
database.store(athlete)
else :
athlete = False
print "No athlete created. Pushup-app quitting"
elif len(athletes) == 1:
athlete = athletes[0]
elif len(athletes) > 1:
profileSelection = ProfileSelector(athletes)
profileSelection.runSelectionDialog()
athlete = profileSelection.getSelectedAthlete()
return athlete
#
# Application starts here !
#
qtApplication = QApplication(sys.argv)
athlete = getAthleteProfile()
if athlete is not False:
mainController = MainWindow(athlete)
mainController.showMainWindow()
sys.exit(qtApplication.exec_())
else:
sys.exit(qtApplication.quit())