Ejemplo n.º 1
0
    def handle_key(self, key):

        if is_enter_key(key):
            self.application.select_page_by_index(0)
            return True

        return super(MapInfoPage, self).handle_key(key)
Ejemplo n.º 2
0
    def handle_key(self, key):
        """
        Handles a keypress
        :type key: int
        :param key: The key pressed
        :return: True if handled; otherwise False
        """

        # Allow the user to click it via enter / space / right
        if self.is_enabled:
            if is_enter_key(key) or key == Keycodes.KEY_SPACE or is_right_key(key):

                process = True

                # Ensure we're not clicking too closely to a prior click event
                now = datetime.now()
                if self.last_click:
                    delta = now - self.last_click
                    if delta.microseconds < 300000:
                        process = False

                # Okay, it's not a sticky key - go for it
                if process:
                    self.last_click = now
                    self.play_button_sound()
                    self.state_changed()
                    return True

        return super(MenuItem, self).handle_key(key)
Ejemplo n.º 3
0
    def handle_key(self, key):

        if is_plus_key(key) or is_right_key(key) or is_enter_key(key):
            self.move_next()
            return True

        if is_minus_key(key) or is_left_key(key):
            self.move_previous()
            return True

        return super(SpinnerBox, self).handle_key(key)
Ejemplo n.º 4
0
    def handle_key(self, key):
        """
        Handles a keypress
        :param key: The keycode
        :returns: True if the event was handled; otherwise False
        """

        if is_enter_key(key) or key == Keycodes.KEY_SPACE:

            if self.checked:
                self.checked = False
            else:
                self.checked = True

            self.state_changed()

            return True

        else:
            return super(CheckBox, self).handle_key(key)
Ejemplo n.º 5
0
    def handle_key(self, key):

        if key == Keycodes.KEY_KP_PLUS or key == Keycodes.KEY_PLUS or key == Keycodes.KEY_PAGEUP:
            self.context.zoom_in()
            return True

        elif key == Keycodes.KEY_KP_MINUS or key == Keycodes.KEY_MINUS or key == Keycodes.KEY_PAGEDOWN:
            self.context.zoom_out()
            return True

        elif is_up_key(key):
            self.context.move_up()
            return True

        elif is_right_key(key):
            self.context.move_right()
            return True

        elif is_down_key(key):
            self.context.move_down()
            return True

        elif is_left_key(key):
            self.context.move_left()
            return True

        elif is_enter_key(key):
            if self.application.btn_info.enabled:
                self.application.select_page_by_index(2)
                return True

        elif key in (Keycodes.KEY_KP0, Keycodes.KEY_KP_MULTIPLY,
                     Keycodes.KEY_KP_DIVIDE):
            self.application.select_page_by_index(1)

        elif key == Keycodes.KEY_KP5:
            self.application.get_map_data_on_current_cursor_pos()

        return super(MapPage, self).handle_key(key)