Esempio n. 1
0
File: main.py Progetto: adrisons/ATF
import sys
from menu import print_menu
from menu import the_end
from matrixmult import matrixmult


print_menu()
matrixmult()
the_end()
    print_header("List of Catagories")
    for item in catalog:
        if item.category not in result:
            result.append(item.category)
    for item in result:
        num += 1
        print(" Category "+ str(num) + item.rjust(30)) 


deserialize_catalog()
input("Press Enter to continue")

opc = ''
while(opc != 'x'):
    clear()
    print_menu()

    opc = input("Please choose an option: ")

    # if comparisons
    if(opc == 'x'):
        break
    if(opc == '1'):
        register_item()
        serialize_catalog()
    elif(opc == '2'):
        display_catalog()

    # elif(opc == '3'): 
       
    # elif(opc == '4'):
Esempio n. 3
0
import tasks
import menu as m
import psycopg2

if __name__ == '__main__':

    # input
    n = None

    while n != '0':
        m.print_menu()
        n = input("Enter a number[0-4] : ")
        #user based operations
        if n == '1':
            m.print_user_operation()
            user_input = input("Enter a number : ")
            while user_input != '5':
                if user_input == '1':
                    tasks.add_user()
                    break
                elif user_input == '2':
                    name = str(input("Enter user name : "))
                    contact_number = str(input("Enter contact number : "))
                    # get user id
                    user_id = tasks.get_userid(name, contact_number)
                    # delete operation
                    tasks.remove_users(user_id)
                    break
                elif user_input == '3':
                    name = str(input("Enter user name : "))
                    contact_number = str(input("Enter contact number : "))
# 1. If they choose to look up an entry, you will ask them for the person's name, and then look up the person's phone number by the given name and print it to the screen.
# 2. If they choose to set an entry, you will prompt them for the person's name and the person's phone number,
# 3. If they choose to delete an entry, you will prompt them for the person's name and delete the given person's entry.
# 4. If they choose to list all entries, you will go through all entries in the dictionary and print each out to the terminal.
# 5. If they choose to quit, end the program.

import book
import menu
import lookups
import adds
import deletes
import display_list
import options

menu.print_menu()
menu_choice = 0

while menu_choice != 5:
    menu_choice = int(options.select_option())

    if menu_choice == 1:
        option = input(options.print_prompt(menu_choice))
        if option == "N":
            name = input(options.print_subprompt(menu_choice, option))
            print(name)
            lookups.get_phone_by_name(name)
        elif option == "P":
            phone = input(options.print_subprompt(menu_choice, option))
            lookups.get_name_by_phone(phone)
    elif menu_choice == 2:
Esempio n. 5
0
def main(stdscr):
    # Menu com as opcoes de login
    menu_login = ('Login', 'Registrar', 'Scoreboard', 'Sair')

    # Esconde o cursor
    curses.curs_set(0)

    # tela inicial do jogo

    screen.show_title_screen(stdscr)

    # Opcao atual do menu
    current_row_idx = 0

    # Esquemas de cores
    curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)
    curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_GREEN)

    # Imprime o menu de login na tela
    menu.print_menu(stdscr, current_row_idx, menu_login)

    textPrint.print_title(stdscr)

    selected_row_idx = 0

    while True:
        # Recebe a entrada do teclado
        key = stdscr.getch()
        stdscr.clear()

        # Mover para cima no menu
        if actions.keyboard(key) == 'up' and current_row_idx > 0:
            current_row_idx -= 1

        # Mover para baixo no menu
        elif actions.keyboard(
                key) == 'down' and current_row_idx < len(menu_login) - 1:
            current_row_idx += 1

        # Seleciona uma opcao do menu
        elif actions.keyboard(key) == 'enter':
            stdscr.clear()

            # Caso selecione a opcao de sair
            if current_row_idx == len(menu_login) - 1:

                # Confirmar se deseja mesmo sair
                saiu = screen.show_deseja_sair(stdscr)

                stdscr.clear()
                textPrint.print_title(stdscr)

                if saiu == True:
                    # Mensagem de agradecimento por ter entrado no jogo
                    message = "Obrigado por jogar. Aperte qualquer coisa para sair"
                    textPrint.print_center(stdscr, message)
                    textPrint.print_title(stdscr)
                    stdscr.refresh()
                    stdscr.getch()
                    break

            # Caso selecione a opcao de login
            elif current_row_idx == 0:
                curses.curs_set(True)
                login.start_login(stdscr)
                curses.curs_set(False)

            # Caso selecione a opcao de registrar
            elif current_row_idx == 1:
                curses.curs_set(True)
                registrar.start_registrar(stdscr)
                curses.curs_set(False)

            # Caso selecione a opcao de scoreboard
            elif current_row_idx == 2:
                screen.show_scoreboard(stdscr)

            # Mensagem quando user escolhe alguma opcao
            else:
                stdscr.addstr(
                    0, 0,
                    "Voce escolheu: {}".format(menu_login[current_row_idx]))
                stdscr.getch()

            stdscr.refresh()

        # Atualiza o menu
        menu.print_menu(stdscr, current_row_idx, menu_login)
        stdscr.refresh()
        textPrint.print_title(stdscr)
Esempio n. 6
0
def show_game_menu(stdscr, current_user):
    # Menu com as opcoes para o jogo 
    menu_jogo = ('Jogar', 'Perguntas', 'Scoreboard', 'Logout')

    # Esconde o cursor
    curses.curs_set(0)

    # Opcao atual do menu
    current_row_idx = 0

    # Esquemas de cores
    curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)
    curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_GREEN)

    # Mensagem de carregamento
    textPrint.print_center(stdscr, "Carregando...")
    stdscr.refresh()

    # Pega os dados do usuario que esta logado
    current_user_data = getData.get_user_data(current_user)
    current_user_name = current_user_data["Name"] 
    current_user_high_score = current_user_data["Highscore"]

    data_list = [current_user_name, current_user_high_score]

    # Imprime o menu do Jogo
    menu.print_menu(stdscr, current_row_idx, menu_jogo)

    # Imprime o usuario atual
    textPrint.print_user_data(stdscr, data_list)
    
    # Imprime o titulo do jogo
    textPrint.print_title(stdscr)

    stdscr.refresh()

    while True:
        key = stdscr.getch()

        stdscr.clear()

        if actions.keyboard(key) == 'up' and current_row_idx > 0:
            textPrint.print_center(stdscr, 'up')
            current_row_idx -= 1

        elif actions.keyboard(key) == 'down' and current_row_idx < len(menu_jogo) - 1:
            textPrint.print_center(stdscr, 'down')
            current_row_idx += 1

        elif actions.keyboard(key) == 'enter':
            stdscr.clear()
            textPrint.print_center(stdscr, 'enter')

            if current_row_idx == len(menu_jogo) - 1:
                # Confirmar se deseja mesmo sair     
                saiu = screen.show_deseja_sair(stdscr)      
                
                if saiu == True:
                    # Voltar para primeiro menu
                    stdscr.clear()
                    menu.print_menu
                    stdscr.refresh()
                    break

            elif current_row_idx == 0:
                stdscr.clear()
                current_user_high_score = play.final_game(stdscr, current_user_name, current_user, current_user_high_score)
                data_list[1] = current_user_high_score

            elif current_row_idx == 1:
                 menuPerguntas.show_perguntas_menu(stdscr, current_user_data, current_user)

            elif current_row_idx == 2:
                screen.show_scoreboard(stdscr)

            stdscr.refresh()

        # Imprime o titulo do jogo
        menu.print_menu(stdscr, current_row_idx, menu_jogo)

        # Imprime o usuario atual
        textPrint.print_user_data(stdscr, data_list)        
        
        stdscr.refresh()

        textPrint.print_title(stdscr)