|
|
@ -1,16 +1,11 @@ |
|
|
|
import os |
|
|
|
import os |
|
|
|
|
|
|
|
import clipboard |
|
|
|
|
|
|
|
|
|
|
|
from src.order import Order |
|
|
|
from src.order import Order |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main_menu_options = """ |
|
|
|
def return_func(): |
|
|
|
Choose an option: |
|
|
|
return False |
|
|
|
1 - Add item |
|
|
|
|
|
|
|
2 - Print Summary/PDV |
|
|
|
|
|
|
|
3 - Parse Ifood into PDVS |
|
|
|
|
|
|
|
4 - Remove Last item |
|
|
|
|
|
|
|
5 - Clear Order |
|
|
|
|
|
|
|
6 - Exit |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_item(): |
|
|
|
def add_item(): |
|
|
@ -42,7 +37,9 @@ def add_item(): |
|
|
|
|
|
|
|
|
|
|
|
def print_summary(): |
|
|
|
def print_summary(): |
|
|
|
print('Summary:') |
|
|
|
print('Summary:') |
|
|
|
print(Order.get_string()) |
|
|
|
summary = Order.get_string() |
|
|
|
|
|
|
|
clipboard.copy(summary) |
|
|
|
|
|
|
|
print(summary) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def parse_ifood_string(): |
|
|
|
def parse_ifood_string(): |
|
|
@ -57,27 +54,37 @@ def clear_all_items(): |
|
|
|
Order.clear_all_items() |
|
|
|
Order.clear_all_items() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main_menu_options = { |
|
|
|
|
|
|
|
'1': {'func': add_item, 'name': 'Add item'}, |
|
|
|
|
|
|
|
'2': {'func': print_summary, 'name': 'Copy Summary/PDV to Clipboard'}, |
|
|
|
|
|
|
|
'3': {'func': parse_ifood_string, 'name': 'Parse Ifood into PDVS'}, |
|
|
|
|
|
|
|
'4': {'func': remove_latest_item, 'name': 'Remove Last item'}, |
|
|
|
|
|
|
|
'5': {'func': clear_all_items, 'name': 'Clear Order'}, |
|
|
|
|
|
|
|
'6': {'func': return_func, 'name': 'Exit'}, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def print_main_menu_options(): |
|
|
|
|
|
|
|
print("Choose an Option:") |
|
|
|
|
|
|
|
for k, c in main_menu_options.items(): |
|
|
|
|
|
|
|
print(f"{k} - {c['name']}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def menu(): |
|
|
|
def menu(): |
|
|
|
while True: |
|
|
|
should_not_exit = True |
|
|
|
print(main_menu_options) |
|
|
|
while should_not_exit: |
|
|
|
|
|
|
|
print_main_menu_options() |
|
|
|
chosen_option = input() |
|
|
|
chosen_option = input() |
|
|
|
|
|
|
|
|
|
|
|
os.system('clear') |
|
|
|
os.system('clear') |
|
|
|
|
|
|
|
|
|
|
|
if chosen_option == '1': |
|
|
|
chosen_option = main_menu_options.get(chosen_option) |
|
|
|
add_item() |
|
|
|
if chosen_option is None: |
|
|
|
elif chosen_option == '2': |
|
|
|
|
|
|
|
print_summary() |
|
|
|
|
|
|
|
elif chosen_option == '3': |
|
|
|
|
|
|
|
parse_ifood_string() |
|
|
|
|
|
|
|
elif chosen_option == '4': |
|
|
|
|
|
|
|
remove_latest_item() |
|
|
|
|
|
|
|
elif chosen_option == '5': |
|
|
|
|
|
|
|
clear_all_items() |
|
|
|
|
|
|
|
elif chosen_option == '6': |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
print('Choose a valid option.') |
|
|
|
print('Choose a valid option.') |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
option_callable = chosen_option['func'] |
|
|
|
|
|
|
|
should_not_exit = option_callable() |
|
|
|
|
|
|
|
should_not_exit = True if should_not_exit is None else should_not_exit |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
if __name__ == '__main__': |
|
|
|