-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_controller.py
39 lines (33 loc) · 1.01 KB
/
main_controller.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
from view import terminal as view
from controller import crm_controller, sales_controller, hr_controller
def load_module(option):
if option == 1:
crm_controller.menu()
elif option == 2:
sales_controller.menu()
elif option == 3:
hr_controller.menu()
elif option == 0:
return 0
else:
raise KeyError()
def display_menu():
options = ["Exit program",
"Customer Relationship Management (CRM)",
"Sales",
"Human Resources"]
view.print_message("")
view.print_menu("Main menu", options)
def menu():
option = None
while option != '0':
display_menu()
try:
view.print_message("")
option = view.get_input("Select module: ")
load_module(int(option))
except KeyError:
view.print_error_message("There is no such option!")
except ValueError:
view.print_error_message("Please enter a number!")
view.print_message("Good-bye!")