Example #1
0
    def cursorLeft(self, pressed: bool) -> None:

        if not pressed or self.cursor == 0:
            return

        self.cursor -= 1
        output(self.text[self.cursor])
Example #2
0
    def deleteCurrent(self, pressed: bool) -> None:

        if not pressed:
            return

        self.text = self.text[: self.cursor] + self.text[(self.cursor + 1) :]
        output(self.text[self.cursor])
Example #3
0
    def announce(self) -> None:
        """
        This method is responsible for speaking the announcement when
        selecting this item. It will only speak the label of the item by
        default, but it can be overridden to modify this behaviour.
        """

        output(self.label)
Example #4
0
    def deleteBack(self, pressed: bool) -> None:

        if not pressed or self.cursor == 0:
            return

        output(self.text[self.cursor])
        self.text = self.text[: (self.cursor - 1)] + self.text[self.cursor :]
        self.cursor -= 1
Example #5
0
    def cursorRight(self, pressed: bool) -> None:

        if not pressed or self.cursor == len(self.text):
            return

        self.cursor += 1

        if self.cursor < len(self.text):
            output(self.text[self.cursor])
        else:
            output("empty")
Example #6
0
    def receiveText(self, text: str, *args: Any, **kwargs: Any) -> None:

        self.text = self.text[: self.cursor] + text + self.text[self.cursor :]
        self.cursor += len(text)
        output(text)
Example #7
0
    def announce(self) -> None:

        output(f"{self.label} {self.text}")