Пример #1
0
def program_menu(log: Log):
    '''
    The program main menu
    :param log: A log data handler class
    :return: none
    '''
    funcs_num = Log.get_funcs_number(
    )  # num of func. that can be executed via the menu

    print(Log.get_funcs_names() + "\n" + str(funcs_num + 1) +
          ". EXIT")  # print menu options

    while True:
        # get input from user
        opt = user_input_int("Enter option: ")

        # if input value within valid range
        if 0 < opt <= funcs_num:
            log.exec(opt)  # execute func.
        elif opt == funcs_num + 1:
            print("Thank you for using our program. Exiting...")
            break
        else:
            print("Wrong option!")