コード例 #1
0
def run_chosen_function(user_input, user):
    '''
    Runs appropriate functions, based on user choice.

    Paramaters
    ----------
    user_input = int
    canvas = obj of Canvas class
    user = obj of Codecooler class
    '''
    if user_input == 1:
        run_grades_functions(user)
        Assingment.get_coming_assingments()
    elif user_input == 2:
        run_submission_functions(user)
    elif user_input == 3:
        os.system('clear')
        shoutbox_view.show_shoutbox_panel()
        shoutbox_view.enter_message(user.login)
    elif user_input == 4:
        codecooler_controller.edit_profile(user.login)
    elif user_input == 5:
        event_controller.get_calendar(user.login)
    elif user_input == 6:
        os.system('clear')
        codecooler_controller.show_logins()
        receiver = codecooler_controller.get_correct_login()
        os.system('clear')
        PM_view.show_PM_panel(user.login, receiver)
        PM_view.enter_message(user.login, receiver)
    return user_input
コード例 #2
0
def start_controller(user):
    '''
    Welcomes user, shows menu and asks
    to choose a function, then runs specific process

    Paramaters
    ----------
    None
    user = obj of Codecooler class

    Returns
    -------
    None
    '''

    codecooler_view.greet(user)
    choice = '99'

    while choice != '0':
        mentor_view.print_menu()
        choice = mentor_view.get_choice()

        if choice == '1':
            employee_controller.show_students_list_detailed()
        elif choice == '2':
            add_assingment()
        elif choice == '3':
            grade_assingment()
        elif choice == '4':
            check_attendance()
        elif choice == '5':
            remove_student()
        elif choice == '6':
            add_student()
        elif choice == '7':
            os.system('clear')
            shoutbox_view.show_shoutbox_panel()
            shoutbox_view.enter_message(user.login)
        elif choice == '8':
            codecooler_controller.edit_profile(user.login)
        elif choice == '9':
            employee_controller.add_event()
        elif choice == '10':
            event_controller.get_calendar(user.login)
        elif choice == '11':
            employee_controller.remove_event(user.login)
        elif choice == '12':
            os.system('clear')
            codecooler_controller.show_logins()
            receiver = codecooler_controller.get_correct_login()
            os.system('clear')
            PM_view.show_PM_panel(user.login, receiver)
            PM_view.enter_message(user.login, receiver)
        elif choice != '0':
            mentor_view.print_bad_choice()
コード例 #3
0
def choose_option(user_input, user):
    '''
    Runs appropriate functions, based on user choice.

    Paramaters
    ----------
    user_input = int
    canvas = obj of Canvas class
    user = obj of Codecooler class
    '''

    if user_input == "1":
        manager_view.show_mentors(Mentor.mentors)
    elif user_input == "2":
        manager_view.show_mentors_with_details(Mentor.mentors)
    elif user_input == "3":
        add_mentor()
    elif user_input == "4":
        remove_mentor()
    elif user_input == "5":
        employee_view.show_students_list(Student.students)
    elif user_input == "6":
        employee_controller.show_students_list_detailed()
    elif user_input == "8":
        codecooler_controller.edit_profile(user.login)
    elif user_input == "7":
            os.system('clear')
            shoutbox_view.show_shoutbox_panel()
            shoutbox_view.enter_message(user.login)
    elif user_input == "9":
        employee_controller.add_event()
    elif user_input == "10":
        event_controller.get_calendar(user.login)
    elif user_input == "11":
        employee_controller.remove_event(user.login)
    elif user_input == "12":
            os.system('clear')
            codecooler_controller.show_logins()
            receiver = codecooler_controller.get_correct_login()
            os.system('clear')
            PM_view.show_PM_panel(user.login, receiver)
            PM_view.enter_message(user.login, receiver)
    elif user_input == "0":
        return user_input
    else:
        raise KeyError
コード例 #4
0
def start_controller(user):
    '''
    Welcomes user, shows menu and asks
    to choose a function

    Paramaters
    ----------
    canvas = obj of Canvas class
    user = obj of Codecooler class

    Returns
    -------
    None
    '''
    exit = 0
    codecooler_view.greet(user)
    choice = ''

    while choice != exit:
        accountant_view.show_menu()
        choice = accountant_view.choose_function()

        if choice == 1:
            employee_view.show_students_list(Student.students)
        elif choice == 2:
            employee_controller.show_students_list_detailed()
        elif choice == 4:
            codecooler_controller.edit_profile(user.login)
        elif choice == 3:
            os.system('clear')
            shoutbox_view.show_shoutbox_panel()
            shoutbox_view.enter_message(user.login)
        elif choice == 5:
            employee_controller.add_event()
        elif choice == 6:
            event_controller.get_calendar(user.login)
        elif choice == 7:
            employee_controller.remove_event(user.login)
        elif choice == 8:
            os.system('clear')
            codecooler_controller.show_logins()
            receiver = codecooler_controller.get_correct_login()
            os.system('clear')
            PM_view.show_PM_panel(user.login, receiver)
            PM_view.enter_message(user.login, receiver)
コード例 #5
0
def remove_event(login):
    events = event_controller.get_calendar(login)
    event_index = employee_view.get_event(events)
    Event.remove_event(events[1][event_index])