Matrices-Practice-Tool / src / Team16.kv
Team16.kv
Raw
#:kivy 1.11.1

ScreenManager:
    id: screen_manager
    MenuScreen:
        id: menu_screen
        name: 'MenuScreen'
        manager: screen_manager
    LoginScreen:
        id: login_screen
        name: 'LoginScreen'
        manager: screen_manager
    RegistrationScreen:
        id: registration_screen
        name: 'RegistrationScreen'
        manager: screen_manager
    PracticeScreen:
        id: practice_screen
        name: 'PracticeScreen'
        manager: screen_manager
    QuestionSelectionScreen:
        id: question_selection_screen
        name: 'QuestionSelectionScreen'
        manager: screen_manager
    ReportScreen:
        id: Report_Screen
        name: 'ReportScreen'
        manager: screen_manager
    QuestionScreen:
        id: question_screen
        name: 'QuestionScreen'
        manager: screen_manager
    ResetScreen:
        id: reset_screen
        name: 'ResetScreen'
        manager: screen_manager
    ResultsScreen:
        id: results_screen
        name: 'ResultsScreen'
        manager: screen_manager

<ResetScreen>:
    BoxLayout:
        orientation: "vertical"
        MDTextField:
            size_hint: (1,1)
            mode: "fill"
            hint_text: "Enter username here"
            id: resetUsernameText
            max_text_length: 20
            helper_text_mode: "on_error"
            helper_text: "Username not found, try registering"
        MDTextField:
            size_hint: (1,1)
            mode: "fill"
            hint_text: "Enter old password here"
            id: resetPasswordText
            password: True
            helper_text_mode: "on_error"
            helper_text: "Incorrect password, try again"
        MDTextField:
            size_hint: (1,1)
            mode: "fill"
            hint_text: "Enter new password here"
            id: resetRePasswordText
            password: True
        Button:
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Reset Password'
            on_press: root.reset_password()
        Button:
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Back to login'
            on_press: 
                root.manager.transition.direction = 'left'
                root.manager.current = 'LoginScreen'

<MenuScreen>:
    BoxLayout:
        id: menuscreen_layout
        orientation: "vertical"
        Button:
            id: log_in_button
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Log into your account'
            on_press : 
                root.manager.transition.direction = 'down'
                root.manager.current = 'LoginScreen'
        Button:
            id: practice_button
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Start practice'
            disabled: True
            on_press:
                root.manager.transition.direction = "left"
                root.manager.current = "PracticeScreen"
        Button:
            id: report_button
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'See results'
            disabled: True
            on_press:
                root.manager.transition.direction = "left"
                root.manager.current = "ReportScreen"    
        Button:
            id: register_button
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Register for an account'
            on_press: 
                root.manager.transition.direction = 'up'
                root.manager.current = 'RegistrationScreen'

<LoginScreen>:
    BoxLayout:
        orientation: "vertical"
        adaptive_size: True
        Button:
            text: 'Log in'
            id: log_in_label
            on_press: 
                root.get_login_input()
                root.clear_login_input()
        MDTextField:
            size_hint: (1,1)
            mode: "fill"
            hint_text: "Enter username here"
            id: loginUsernameText
            max_text_length: 20
            helper_text_mode: "on_error"
            helper_text: "Username not found, try registering"
        MDTextField:
            size_hint: (1,1)
            mode: "fill"
            hint_text: "Enter password here"
            id: loginPasswordText
            password: True
            helper_text_mode: "on_error"
            helper_text: "Incorrect password, try again"
        Button:
            size_hint: (1,1)
            id: resetPasswordButton
            text: 'Reset Password'
            on_press: 
                root.manager.current = 'ResetScreen'
                root.manager.transition.direction = 'right'
        Button:
            text: 'Back to menu'
            on_press: 
                root.manager.current = 'MenuScreen'
                root.manager.transition.direction = 'up'

<RegistrationScreen>:
    BoxLayout:
        orientation: "vertical"
        Button:
            text: 'Back to menu'
            on_press: 
                root.manager.current = 'MenuScreen'
                root.manager.transition.direction = 'down'
        MDTextField:
            size_hint: (1,1)
            mode: "fill"
            hint_text: "Enter username here"
            id: registrationUsernameText
            helper_text: "Must be unique and alphanumeric, at least 8 characters."
            helper_text_mode: "on_error"
            max_text_length: 20
        MDTextField:
            size_hint: (1,1)
            mode: "fill"
            hint_text: "Enter email here"
            id: registrationEmailText
            helper_text: "Must be a valid email address, used to reset your password"
            helper_text_mode: "on_error"
        MDTextField:
            size_hint: (1,1)
            mode: "fill"
            hint_text: "Enter password here"
            id: registrationPasswordText
            helper_text: "At least 8 Characters, 1 uppercase, 1 lowercase, 1 number, and one special character"
            helper_text_mode: "on_error"
            password: True
        MDTextField:
            size_hint: (1,1)
            mode: "fill"
            hint_text: "Re-enter password here"
            id: registrationRePasswordText
            helper_text: "Passwords must match"
            helper_text_mode: "on_error"
            password: True
        Button:
            text: 'Save details'
            on_press:
                root.get_registration_input()
                root.clear_registration_input()

<PracticeScreen>:
    BoxLayout:
        orientation: "vertical"
        Button:
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Practice Freely'
            on_press: 
                root.manager.transition.direction = 'left'
                root.manager.current = 'QuestionSelectionScreen'
                root.set_timer_false()
        Button:
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Practice with a timer'
            on_press: 
                root.manager.transition.direction = 'left'
                root.manager.current = 'QuestionSelectionScreen'
                root.set_timer_true()
        Button:
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Back to the Menu'
            on_press: 
                root.manager.transition.direction = 'right'
                root.manager.current = 'MenuScreen'

<QuestionSelectionScreen>:
    BoxLayout:
        orientation: "vertical"
        Button: 
            id: selected_types
            text: 'Selected types:'
            halign: 'center'
        GridLayout:
            cols: 2
            Label: 
                text: 'Matrix Addition Questions'
                halign: 'center'
            CheckBox:
                id: type_1
                pos_hint: {"center_x": .5, "center_y": .5}
                color: (255,255,255)
        GridLayout:
            cols: 2
            Label: 
                text: 'Matrix Subtraction Questions'
                halign: 'center'
            CheckBox:
                id: type_2
                pos_hint: {"center_x": .5, "center_y": .5}
                color: (255,255,255)
        GridLayout:
            cols: 2
            Label: 
                text: 'Matrix Multiplication Questions'
                halign: 'center'
            CheckBox:
                id: type_3
                pos_hint: {"center_x": .5, "center_y": .5}
                color: (255,255,255)
        GridLayout:
            cols: 2
            Label: 
                text: 'Finding Inverse Matrices'
                halign: 'center'
            CheckBox:
                id: type_4
                pos_hint: {"center_x": .5, "center_y": .5}
                color: (255,255,255)
        GridLayout:
            cols: 2
            Label: 
                text: 'Finding Determinants'
                halign: 'center'
            CheckBox:
                id: type_5
                pos_hint: {"center_x": .5, "center_y": .5}
                color: (255,255,255)
        GridLayout:
            cols: 2
            Label: 
                text: 'Mark All'
                halign: 'center'
            CheckBox:
                pos_hint: {"center_x": .5, "center_y": .5}
                id: mark_all
                color: (255,255,255)
                on_press: 
                    root.mark_all()
        Button:
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Start the quiz'
            on_press: 
                root.set_types()
                root.make_test()
                root.start_timer()
        Button:
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Back to practice'
            on_press: 
                root.manager.transition.direction = 'right'
                root.manager.current = 'PracticeScreen'
                root.set_timer_false()
<QuestionScreen>:
    on_enter: 
        root.set_questions()
        root.draw_questions()
        root.increment_question()
    BoxLayout:
        orientation: "vertical"
        BoxLayout:
            size_hint: (1,0.2)
            orientation: 'horizontal'
            MDLabel:
                size_hint: (0.5,0.2)
                id: question_label
                halign: 'center'
                text: 'Question 1'
                theme_text_color: "Custom"
                text_color: 1, 1, 1, 1
            MDLabel:
                size_hint: (0.5,0.2)
                id: time_label
                halign: 'center'
                text: 'Time: '
                theme_text_color: "Custom"
                text_color: 1, 1, 1, 1
        BoxLayout:
            orientation: 'horizontal'
            BoxLayout:
                orientation: 'vertical'
                MDLabel:
                    id: question_contents
                    halign: 'center'
                    text: 'Question 1 Contents'
                    size_hint: (1,0.2)
                    theme_text_color: "Custom"
                    text_color: 1, 1, 1, 1
                Image:
                    id: matrix_a
                    source: 'empty.png'
                    size_hint: (1,1)
                Image:
                    id: matrix_b
                    source: 'empty.png'
                    size_hint: (1,1)
            BoxLayout:
                orientation: 'vertical'
                BoxLayout:
                    orientation: 'horizontal'
                    MDTextField:
                        size_hint: (1,1)
                        mode: "fill"
                        hint_text: "Rows"
                        id: rows_text
                    MDTextField:
                        size_hint: (1,1)
                        mode: "fill"
                        hint_text: "Columns"
                        id: columns_text
                MDTextField:
                    size_hint: (1,1)
                    mode: "fill"
                    hint_text: "Enter your matrix as a list of values here"
                    id: matrix_text
        BoxLayout:
            size_hint: (1,0.2)
            orientation: "horizontal"
            Button:
                id: question_back_button
                pos_hint: {"center_x": .5, "center_y": .5}
                text: 'Back'
                disabled: True
                on_press:
                    root.save_current_answer()
                    root.clear_current_answer()
                    root.decrement_question()
            Button:
                pos_hint: {"center_x": .5, "center_y": .5}
                text: 'Menu'
                on_press: 
                    root.cancel_quiz()
            Button:
                id: question_next_button
                pos_hint: {"center_x": .5, "center_y": .5}
                text: 'Next'
                on_press:
                    root.save_current_answer()
                    root.clear_current_answer()
                    root.increment_question()

<ResultsScreen>:
    on_enter:
        root.set_score()
    BoxLayout:
        orientation: "vertical"
        BoxLayout:
            size_hint: (1,1)
            orientation: 'horizontal'
            MDLabel:
                size_hint: (1,1)
                id: score_label
                halign: 'center'
                text: 'Your score was:'
                theme_text_color: "Custom"
                text_color: 1, 1, 1, 1
        Button:
            size_hint: (1,0.25)
            pos_hint: {"center_x": .5, "center_y": .5}
            text: 'Menu'
            on_press: 
                root.cancel_quiz()

<Team16App>:
    FloatLayout:
        UI: 
            center: 0.5,0.5