diff --git a/tools/keytester.py b/tools/keytester.py deleted file mode 100644 index e14330a..0000000 --- a/tools/keytester.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python3 -# pylint: disable=missing-docstring - -# run with `python3 -m tools.keytester` - -from argparse import ArgumentParser, Namespace - - -def parse_args() -> Namespace: - parser = ArgumentParser() - parser.add_argument("-a", "--acurses", action="store_true") - return parser.parse_args() - - -if parse_args().acurses: - import src.acurses as curses -else: - import curses - - -def main(stdscr: curses.window) -> None: - curses.curs_set(0) - y, x = (i // 2 for i in stdscr.getmaxyx()) - stdscr.addstr(0, 0, "Ctrl+C to exit\n") - while True: - try: - ch = stdscr.getch() - # ch = stdscr.getkey() - # ch = stdscr.get_wch() - except KeyboardInterrupt: - return - if ch == 3: # ^C - return - stdscr.addstr(y, x, str(ch) + " ") - - -if __name__ == "__main__": - curses.wrapper(main) diff --git a/tools/multichar_input.py b/tools/multichar_input.py deleted file mode 100644 index a1d34cd..0000000 --- a/tools/multichar_input.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python3 - -from sys import stdin -import tty -import termios -from time import time as now -from queue import Queue, Empty as queue_empty -import threading - -_SHORT_TIME_SECONDS = 0.01 - - -def _fill_queue(queue: Queue[int]): - while True: - queue.put(ord(stdin.read(1))) - - -def _main() -> None: - chars: list[int] = [] - queue: Queue[int] = Queue() - - threading.Thread(target=_fill_queue, args=(queue,), daemon=True).start() - - while True: - char = queue.get() - if char != 27: - if char == 113: - return - print(f"key: {char}", end="\n\r") - continue - esc = now() - chars.append(27) - while now() - esc < _SHORT_TIME_SECONDS: - try: - char = queue.get(timeout=_SHORT_TIME_SECONDS) - except queue_empty: - break - if char not in chars: - chars.append(char) - print(chars, end="\n\r") - chars.clear() - - -if __name__ == "__main__": - old_settings = termios.tcgetattr(stdin) - try: - tty.setraw(stdin.fileno()) - _main() - finally: - termios.tcsetattr(stdin, termios.TCSADRAIN, old_settings) - print("byeeeee") diff --git a/tools/numbers.txt b/tools/numbers.txt deleted file mode 100644 index e96b9c1..0000000 --- a/tools/numbers.txt +++ /dev/null @@ -1,51 +0,0 @@ --r 0 -- 1 -- 2 -- 3 -- 4 -- 5 -- 6 -- 7 -- 8 -- 9 --r 10 -- 11 -- 12 -- 13 -- 14 -- 15 -- 16 -- 17 -- 18 -- 19 --r 20 -- 21 -- 22 -- 23 -- 24 -- 25 -- 26 -- 27 -- 28 -- 29 --r 30 -- 31 -- 32 -- 33 -- 34 -- 35 -- 36 -- 37 -- 38 -- 39 --r 40 -- 41 -- 42 -- 43 -- 44 -- 45 -- 46 -- 47 -- 48 -- 49 --r 50 \ No newline at end of file diff --git a/tools/test.py b/tools/test.py deleted file mode 100644 index 1d69e80..0000000 --- a/tools/test.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python3 -"""Tester for acurses""" - -# import curses -import src.acurses as curses - -def _main(stdscr: curses.window): - curses.use_default_colors() - for i, color in enumerate( - [ - curses.COLOR_RED, - curses.COLOR_GREEN, - curses.COLOR_YELLOW, - curses.COLOR_BLUE, - curses.COLOR_MAGENTA, - curses.COLOR_CYAN, - curses.COLOR_WHITE, - ], - start=1, - ): - curses.init_pair(i, color, -1) - # stdscr.box() - # stdscr.addstr(1, 1, "Hello, world!", curses.color_pair(6)) - # win = curses.newwin(3, 7, 3, 3) - # win.addstr(1, 1, str(win._height)) - # win.clear() - # stdscr.refresh() - # win.box() - # win.refresh() - # win.addstr(1, 1, "Bold text", color_pair(2)) - # win.clear() - # stdscr.addstr(1, 1, "Bold text", color_pair(5) | A_STANDOUT) - while True: - x = stdscr.getch() - stdscr.addstr(str(x) + "\n") - if x == 113: - break - # stdscr.refresh() - - -if __name__ == "__main__": - curses.wrapper(_main)