-
Notifications
You must be signed in to change notification settings - Fork 0
/
classes.py
55 lines (44 loc) · 1.31 KB
/
classes.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
from constants import *
from dataclasses import dataclass
# ---------------------------------------------------------------------------- #
# CLASS DEFINITION #
# ---------------------------------------------------------------------------- #
class MENU():
# options_list = []
def __init__(self, name: str, greeting: str):
self.name = name
self.greeting = greeting
self.options_list = []
def __str__(self):
return self.name
def add_option(self, name: 'Menu'):
self.options_list.append(name)
def enter(self):
print(self.greeting)
print(DIVIDER)
self.list_options()
def list_options(self):
for i, option in enumerate(self.options_list):
i += 1
print(f"{int(i)}: {option}")
print(DIVIDER)
self.wait_for_input()
def wait_for_input(self):
user_input = input()
if user_input == "":
pass
else:
user_input = int(user_input) - 1
self.options_list[user_input].enter()
# ---------------------------------------------------------------------------- #
# CLASS: APPLICATION #
# ---------------------------------------------------------------------------- #
@dataclass
class APPLICATION:
display: str
name: str
link: str
@dataclass
class BLOATWARE:
display: str
name: list