コード例 #1
0
def main_menu():
    while True:
        view.show_menu()
        selection = view.get_input()
        if selection == "3":
            return
        elif selection == "1":
            new_user = view.new_account()
            new_account_num = model.create_new_account()
            new_user_full = new_user[0] + " " + new_user[1]
            model.add_name(new_account_num, new_user_full)
            model.add_pin_code(new_account_num, new_user[2])

        elif selection == "2":
            account_num = view.get_account()
            account_details = model.get_account_details(account_num[0])
            if str(account_num[1]) == str(account_details["pin_code"]):
                view.display_user_details(account_details)
                user_menu(account_num[0])
            else:
                view.bad_input
                return

        else:
            view.bad_input()
コード例 #2
0
ファイル: controller.py プロジェクト: jsarraga/week1
def mainmenu(account):
    while True:
        view.show_menu(account)
        selection = view.get_input()
        if selection == '4':
            answer = view.quit_input()
            if answer == "y":
                model.save()
                break
            if answer == "n":
                view.show_menu(account)
        elif selection == '1':
            balance = model.check_balance(account)
            view.show_balance(balance)
        elif selection == '2':
            depbalance = float(view.get_amount_input())
            model.deposit(account, depbalance)
            balance = model.check_balance(account)
            view.show_balance(balance)
        elif selection == '3':
            wdbalance = float(view.get_amount_input())
            model.withdraw(account, wdbalance)
            balance = model.check_balance(account)
            view.show_balance(balance)
        else:
            view.bad_input()
コード例 #3
0
def mainmenu(student):
    while True:
        view.show_menu(student)
        selection = view.get_input()
        if selection == '3':
            model.save()
            return
        elif selection == '1':
            newgrade = view.get_grade()
            model.add_grade(student, newgrade)
        elif selection == '2':
            view.show_gpa(model.get_gpa(student))
        elif selection == '3':
            student = view.get_student()
        elif 
コード例 #4
0
ファイル: controller.py プロジェクト: jsarraga/week1
def mainmenu(student):
    while True:
        view.show_menu(student)
        selection = view.get_input()
        # print(selection)
        if selection == '3':
            model.save()
            return
        elif selection == '1':
            newgrade = view.get_input()
            model.add_grade(student, newgrade)
        elif selection == '2':
            gpa = model.get_gpa(student)
            view.show_gpa(gpa)
        else:
            view.bad_input()
コード例 #5
0
ファイル: controller.py プロジェクト: amudera/Week1
def mainmenu(student):  #basically a while loop
    while True:  #This loop doesnt terminate on its own. The break keyword stops the loop
        view.show_menu(student)  #Print students name @ top of menu
        selection = view.get_input()
        print(selection)
        if selection == '4':
            model.save()  #save before exiting
            return  #exits the function. could also use /br
        elif selection == '1':
            new_grade = view.get_grade()
            model.add_grade(student, new_grade)
        elif selection == '2':
            pass
        elif selection == '3':
            pass
        else:
            view.bad_input()
コード例 #6
0
 def start(self):
     """
     Affiche les vues, récupère les commandes, exécute les commandes et boucle
     tant que l'utilisateur n'a pas quitté.
     :return: None
     """
     while not self.stop:
         os.system('cls')
         view.show_output(self.last_cmd_key, self.last_cmd_name,
                          self.output_function, self.output_params)
         view.show_transition()
         view.show_menu(self.get_menu())
         cmd_key = view.get_input('Choisissez une commande',
                                  check_command_is_valid,
                                  self.get_keys_commands_available(),
                                  view.format_input_command)
         self.last_cmd_key = cmd_key
         self.last_cmd_name = self.get_menu()[cmd_key][0]
         self.apply_command(cmd_key)
コード例 #7
0
import view
view.show_menu()