-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.py
82 lines (67 loc) · 2.37 KB
/
console.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from controllers.DataController import DataController
class Console:
db = DataController()
@classmethod
def start(cls):
print("\n\n")
print(" ----- Bem vindo ao Space X Journal -----")
print(" Confira os dados dos lançamentos da SpaceX ")
while True:
print("\n")
print("O que deseja consultar?")
print("(1) Próximo lançamento")
print("(2) Último lançamento")
print("(3) Próximos lançamentos")
print("(4) Últimos lançamentos")
print("(5) Sair")
print("\n")
option = input("Selecione uma opção ")
if(option == '1'):
cls.show_next_launch()
continue
elif(option == '2'):
cls.show_latest_launch()
continue
elif(option == '3'):
cls.show_upcoming_launch()
continue
elif(option == '4'):
cls.show_past_launch()
continue
elif(option == '5'):
break
else:
print("\n\n")
print("Por favor, escolha uma opção válida")
print("\n\n")
print("Obrigado por usar o Space X Journal!")
print("---------------- =D --------------------")
print("Source Code: https://github.com/BRZangado/SpaceXJournal")
print("Desenvolvido por Bruno Rodrigues Santos")
print("E-mail: bruesmanbruesman@hotmail.com")
print("Github: https://github.com/BRZangado")
@classmethod
def print_launch(cls, launch):
print("\n")
print('---------------------------------')
print(launch.get_info())
print(launch.rocket.get_info())
print(launch.launch_site.get_info())
@classmethod
def show_upcoming_launch(cls):
launches = cls.db.get_upcoming_launches()
for launch in launches:
cls.print_launch(launch)
@classmethod
def show_past_launch(cls):
launches = cls.db.get_past_launches()
for launch in launches:
cls.print_launch(launch)
@classmethod
def show_next_launch(cls):
launch = cls.db.get_next_launch()
cls.print_launch(launch)
@classmethod
def show_latest_launch(cls):
launch = cls.db.get_latest_launch()
cls.print_launch(launch)