<RootLayout>:
    orientation: 'vertical'

    ActionBar:
        pos_hint: {'top':1}

        ActionView:
            use_separator: True

            ActionPrevious:
                title: 'Tachograph Card Authorizer'
                with_previous: False

            ActionButton:
                text: 'File'

            ActionButton:
                text: 'Server settings'
                on_press: root.popup_server_settings()

            ActionGroup:
                text: 'Unit tools'
                mode: 'spinner'
                ActionButton:
                    text: 'Unit 1'
                ActionButton:
                    text: 'Unit 2'
                ActionButton:
                    text: 'Unit 3'
                ActionButton:
                    text: 'Unit 4'

    Button:
        id: btn
        pos_hint: {'center_x': 0.5, 'center_y': 0.3}
        size_hint: 0.5, 0.2
        text: 'Start authorization'
        on_release: app.start_event_loop_thread()

    TextInput:
        multiline: False
        size_hint: 0.8, 0.5
        pos_hint: {'center_x': 0.5, 'center_y': 0.1}
        on_text: app.submit_pulse_text(args[1])

    BoxLayout:
        size_hint: 1, 0.2

        Label:
            id: pulse_listener
        Label:
            id: status

<ServerSettings>:
    rows: 4
    padding: 50
    orientation: 'vertical'

    TextInput:
        id: ip_input
        size_hint: 0.8, 0.1
        pos_hint: {'x': 0.1, 'y': 0.7}
        text: 'IP'

    TextInput:
        id: port_input
        size_hint: 0.8, 0.1
        pos_hint: {'x': 0.1, 'y': 0.6}
        text: 'Port'

    TextInput:
        id: token_input
        size_hint: 0.8, 0.1
        pos_hint: {'x': 0.1, 'y': 0.4}
        text: 'Token'

    Button:
        text: 'Save settings'
        size_hint: 0.8, 0.2
        pos_hint: {'x': 0.1, 'y': 0.1}
        on_press: self.text='Settings are saved'
