diff options
| author | nasrlol <nsrddyn@gmail.com> | 2024-12-09 21:30:52 +0100 |
|---|---|---|
| committer | nasrlol <nsrddyn@gmail.com> | 2024-12-09 21:30:52 +0100 |
| commit | 2049c11d4f2f1b2bfa48c23b9eba6cb1babfc812 (patch) | |
| tree | 6bdce13d8d2c9aa23e42a3d3ca97e52d547d9d44 | |
| parent | 9a390f7b41e980d05c1c05c669febc16f6826ecd (diff) | |
trying out a fix for the input handling with curses
| -rw-r--r-- | source/features.py | 7 | ||||
| -rw-r--r-- | source/main_cli.py | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/source/features.py b/source/features.py index 7690feb..2d2d80e 100644 --- a/source/features.py +++ b/source/features.py @@ -3,6 +3,7 @@ import os import speech_recognition as sr from gpiozero import CPUTemperature import hardware_driver as lcd # importing the ./hardware_driver.py file +from main_cli import input_handling # some functions need to be put on a different thread but we are keeping that project for another time # import threading @@ -63,7 +64,7 @@ class feat: def custom_greeting(self): self.clear_terminal_lcd() try: - with open("quotes.txt", "r") as file: + with open("../assets/text/quotes.txt", "r") as file: quotes = [quote.strip() for quote in file.readlines()] except FileNotFoundError: L.text("Quotes file missing", 1) @@ -152,11 +153,11 @@ class feat: print("Error:", e) return None - def save_notes(self): + def save_notes(self, input_handling): self.clear_terminal_lcd() print("Type your notes (type 'stop' to exit):") while True: - note = input(": ") + note = input_handling(": ") if note.lower() in ["stop", "exit", "quit"]: break first_line = note[:16] diff --git a/source/main_cli.py b/source/main_cli.py index 53f49aa..b474551 100644 --- a/source/main_cli.py +++ b/source/main_cli.py @@ -98,6 +98,14 @@ def draw_menu(stdscr): break # Exit the while loop and terminate the program +def input_handling(): + while True: + key = stdscr.getkey() + stdcr.addstr(f"key: {key}") + stdcr.refresh() + stdcr.getch() + + def main(): """ The main function wraps the curses functionality and runs the application. |
