-
Notifications
You must be signed in to change notification settings - Fork 0
/
command_line.py
69 lines (46 loc) · 2.23 KB
/
command_line.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
"""The purpose of this program is to communicate with the command line.
Input: A dictionary of lists. The key is the manufacturer and the list is all the available devices from said manufacturer
Interum: Allows user to select from these choices in the command line & input model number
Output: Returns a list of 3 elements. model_number, manufacturer, and device"""
import pyfiglet
from manufac_and_devices import manuf_and_devices_dict
def get_users_instrument_options(manuf_devices_dict):
# manuf_devices_dict is a dictionary of key manufacturers and lists of their devices. All strings are in CAPS
available_manuf = []
available_devices = []
for key, values in manuf_devices_dict.items():
available_manuf.append(key)
string = f'-AVAILABLE MANUFACTURERS-\n{available_manuf}\n'
print(string)
loop = True
while loop:
inputed_manufacturer = input("What is the manufacturer of your instrument? ")
inputed_manufacturer = inputed_manufacturer.upper()
inputed_manufacturer = inputed_manufacturer.strip()
for manufacturer in available_manuf:
if inputed_manufacturer == manufacturer:
loop = False
for key, values in manuf_devices_dict.items():
if key == inputed_manufacturer:
available_devices = values
string = f'\n\n-AVAILABLE MANUFACTURERS-\n{available_devices}\n'
print(string)
loop = True
while loop:
inputed_device = input("What is the device of your instrument? ")
inputed_device = inputed_device.upper()
inputed_device = inputed_device.strip()
for device in available_devices:
if inputed_device == device:
loop = False
model_number = input(f"\nWhat is the model number? ")
return model_number.upper(), inputed_manufacturer.upper(), inputed_device.upper()
def print_program_title():
result = pyfiglet.figlet_format("EASTMAN", font = "big")
print(result)
result = pyfiglet.figlet_format("INSTRUMENT MODEL NUMBER", font = 'small')
print(result)
if __name__ == "__main__":
manuf_and_devices = manuf_and_devices_dict()
print_program_title()
get_users_instrument_options(manuf_and_devices)