def main_menu(user):
    """ Main Menu - Check Balance/ Deposit / Withdraw / Quit """
    while True:
        view.print_main_menu(user)
        choice = view.main_prompt()
        if choice not in ("1", "2", "3", "4"):
            """ Bad Input """
            view.bad_login_input()
            return main_menu(user)
        elif choice == "4":
            """ 4. Log Out """
            # user["balance"] += 1.0 # delete this, just demonstrating model.save()
            # model.save(user)
            return login_menu()
        elif choice == "3":
            """ 3. Deposit """
            amount = round(float(view.enter_deposit_info()), 2)
            model.deposit(user, amount)
            return main_menu(user)
        elif choice == "2":
            """ 2. Withdraw """
            amount = round(float(view.enter_withdraw_info()), 2)
            answer = model.withdraw(user, amount)
            if answer == 0:
                view.insufficient_funds()
            return main_menu(user)
        elif choice == "1":
            """ 1. Check Balance """
            balance = round(model.get_balance(user), 2)
            view.give_balance(balance)
Exemple #2
0
def main_menu():
    school = School.create_from_csv('school.csv')

    user_choice = None
    while user_choice != 0:
        view.print_main_menu()
        user_choice = view.get_user_input()

        if user_choice == 1:
            view.get_list(school.get_all_teachers())

        elif user_choice == 2:
            print(school.get_best_class())

        elif user_choice == 3:
            choose_class(school)

        elif user_choice == 4:
            new_class = add_class(school)
            class_controller.class_menu(new_class)

        elif user_choice == 5:
            school.save_to_file()

    view.print_exit_message()
def main_menu(user):
    while True:
        view.print_main_menu(user)
        choice = view.main_prompt()
        """ TODO: add bad input message """
        if choice not in ("1", "2", "3", "4"):
            view.bad_login_input()
            return main_menu(user)
        if choice == "4":
            # user["balance"] += 1.0 # delete this, just demonstrating model.save()
            # model.save(user)
            return login_menu()
        if choice == "3":
            amount = round(float(view.enter_deposit_info()), 2)
            model.deposit(user, amount)
            return main_menu(user)
        if choice == "2":
            amount = round(float(view.enter_withdraw_info()), 2)
            answer = model.withdraw(user, amount)
            if answer == 0:
                view.insufficient_funds()
            return main_menu(user)
        if choice == "1":
            balance = round(model.get_balance(user), 2)
            view.give_balance(balance)
        """ TODO: implement the various options """
Exemple #4
0
def main_menu(database):
    while True:
        view.print_main_menu()
        choice = input('Input your choice: ')

        while choice == '0':
            return

        # PRINT
        while choice == '1':
            view.print_select_table(database)
            if select_menu(database) == True:
                break
            else:
                print('Wrong table name!')
                time.sleep(1)

        #UPDATE
        while choice == '2':
            if update_menu(database) == True:
                break
            else:
                print('Wrong table or column name!')
                time.sleep(1)

        #INSERT
        while choice == '3':
            if insert_menu(database) == True:
                break
            else:
                print('Wrong table name!')
                time.sleep(1)

        #DELETE
        while choice == '4':
            if delete_menu(database) == True:
                break
            else:
                print('Wrong table name!')
                time.sleep(1)

        #GENERATE
        while choice == '5':
            if generate_customers_menu(database) == True:
                break
            else:
                print('Wrong numbere!')
                time.sleep(1)

        #GET BY
        while choice == '6':
            if get_by_menu(database) == True:
                break

        #TEXT SEARCH
        while choice == '7':
            if text_search_menu(database) == True:
                break
Exemple #5
0
def main_menu():
    user_choice = ''
    while user_choice != 0:
        view.print_main_menu()
        user_choice = view.get_input()

        if user_choice == 1:
            shopping_list = open_shopping_list_from_file()
            if shopping_list:
                shopping_menu(shopping_list)

        elif user_choice == 2:
            create_shopping_list()

        view.print_exit_message()
Exemple #6
0
def main_menu():
    todo_list = ToDoList.create_from_csv('todo_items.csv')

    user_choice = ''
    while user_choice != 0:
        view.print_main_menu()
        user_choice = view.get_user_input()

        if user_choice == 1:
            show_all_items(todo_list)

        elif user_choice == 2:
            add_new_item(todo_list)

        elif user_choice == 3:
            mark_item(todo_list)

        elif user_choice == 4:
            todo_list.archive()

        todo_list.save_data_to_file('todo_items.csv')

    view.print_exit_message()
def main_menu():
    csv_path = 'community.csv'
    community = Community.create_from_csv(csv_path)
    view.welcome_screen(community.name)

    user_choice = ''
    while user_choice != '0':
        view.print_main_menu()
        user_choice = view.get_user_input()

        if user_choice == '1':
            Community.get_all_blocks()

        elif user_choice == '2':
            choose_block()

        elif user_choice == '3':
            add_new_block(community)

        elif user_choice == '4':
            # TODO find address by owner
            pass

    view.print_exit_message()