Exemplo n.º 1
0
    def test_display_menu_get_choice(self, mock_print, mock_input):
        menu = Menu()
        menu.add_option('a', 'aaa', lambda: None)
        menu.add_option('b', 'bbb', lambda: None)

        self.assertEqual('a', ui.display_menu_get_choice(menu))

        mock_print.assert_any_call(menu)
Exemplo n.º 2
0
def main():
    menu = create_menu()
    while True:
        choice = ui.display_menu_get_choice(menu)
        action = menu.get_action(choice)
        action()
        if choice == 'Q':
            break
Exemplo n.º 3
0
def main():

    quit = 'q'
    choice = None

    while choice != quit:
        choice = ui.display_menu_get_choice()
        handle_choice(choice)
Exemplo n.º 4
0
def main():

    quit = 'q'
    operation = None

    while operation != quit:
        operation = ui.display_menu_get_choice()
        handle_operations(operation)
Exemplo n.º 5
0
def main():

    datastore.setup()

    quit = 'q'
    choice = None

    while choice != quit:
        choice = ui.display_menu_get_choice()
        handle_choice(choice)
Exemplo n.º 6
0
def main():

    menu = create_menu()

    while True:
        choice = ui.display_menu_get_choice(menu)
        action = menu.get_action(choice)
        action()
        if choice == 'Q' or choice == 'q': # Updated code to accept either Q or q as valid quit responses
            break
Exemplo n.º 7
0
def main():

    start()

    quit_command = 'q'
    user_choice = None

    while user_choice != quit_command:
        user_choice = ui.display_menu_get_choice()
        handle_choice(user_choice)
Exemplo n.º 8
0
def main():
    global counter

    counter = fileio.setup()

    quit = 'q'
    choice = None

    while choice != quit:
        choice = ui.display_menu_get_choice()
        handle_choice(choice)
Exemplo n.º 9
0
def main():

    #setup DB
    merch_orm.setup()

    quit = 'q'
    choice = None

    while choice != quit:
        choice = ui.display_menu_get_choice()
        handle_choice(choice)
Exemplo n.º 10
0
def main():
    quit = 'q'
    choice = None

    while choice != quit:
        #Display Banner to let user know what game they are playing
        ui.display_banner()
        #Display Menu for user
        choice = ui.display_menu_get_choice()
        #Handle user's choice
        handle_choice(choice)
Exemplo n.º 11
0
def main():

    menu = create_menu()

    while True:
        try:
            choice = ui.display_menu_get_choice(menu)
            action = menu.get_action(choice)
            action()
            if choice == 'Q':
                break
        except:
            print("\nYou have this book already.\n")
Exemplo n.º 12
0
def handle_sort_choice(sort_choice):

    if sort_choice == '1':
        ui.message("Sorted by author: ")

    elif sort_choice == '2':
        ui.message("Sorted by title: ")

    elif sort_choice == '3':
        choice = ui.display_menu_get_choice()
        handle_choice(choice)

    else:
        ui.message('Please enter a valid selection')
Exemplo n.º 13
0
def main():

    menu = create_menu()

    while True:
        choice = ui.display_menu_get_choice(menu)
        #needed for case insensitivity
        choice = choice.upper()

        action = menu.get_action(choice)

        action()
        if choice == 'Q':

            break
Exemplo n.º 14
0
def main():

    # calling setup function from datastore
    fileio.setup()

    # making quit and choice variables
    quit = 'q'
    choice = None

    # while loop to call display menu if the system isn't quiting
    while choice != quit:
        # getting displaymenu function from ui
        choice = ui.display_menu_get_choice()
        # calling the handleChoive function
        handle_choice(choice)