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 /source/features.py | |
| parent | 9a390f7b41e980d05c1c05c669febc16f6826ecd (diff) | |
trying out a fix for the input handling with curses
Diffstat (limited to 'source/features.py')
| -rw-r--r-- | source/features.py | 7 |
1 files changed, 4 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 | |||
| 3 | import speech_recognition as sr | 3 | import speech_recognition as sr |
| 4 | from gpiozero import CPUTemperature | 4 | from gpiozero import CPUTemperature |
| 5 | import hardware_driver as lcd # importing the ./hardware_driver.py file | 5 | import hardware_driver as lcd # importing the ./hardware_driver.py file |
| 6 | from main_cli import input_handling | ||
| 6 | 7 | ||
| 7 | # some functions need to be put on a different thread but we are keeping that project for another time | 8 | # some functions need to be put on a different thread but we are keeping that project for another time |
| 8 | # import threading | 9 | # import threading |
| @@ -63,7 +64,7 @@ class feat: | |||
| 63 | def custom_greeting(self): | 64 | def custom_greeting(self): |
| 64 | self.clear_terminal_lcd() | 65 | self.clear_terminal_lcd() |
| 65 | try: | 66 | try: |
| 66 | with open("quotes.txt", "r") as file: | 67 | with open("../assets/text/quotes.txt", "r") as file: |
| 67 | quotes = [quote.strip() for quote in file.readlines()] | 68 | quotes = [quote.strip() for quote in file.readlines()] |
| 68 | except FileNotFoundError: | 69 | except FileNotFoundError: |
| 69 | L.text("Quotes file missing", 1) | 70 | L.text("Quotes file missing", 1) |
| @@ -152,11 +153,11 @@ class feat: | |||
| 152 | print("Error:", e) | 153 | print("Error:", e) |
| 153 | return None | 154 | return None |
| 154 | 155 | ||
| 155 | def save_notes(self): | 156 | def save_notes(self, input_handling): |
| 156 | self.clear_terminal_lcd() | 157 | self.clear_terminal_lcd() |
| 157 | print("Type your notes (type 'stop' to exit):") | 158 | print("Type your notes (type 'stop' to exit):") |
| 158 | while True: | 159 | while True: |
| 159 | note = input(": ") | 160 | note = input_handling(": ") |
| 160 | if note.lower() in ["stop", "exit", "quit"]: | 161 | if note.lower() in ["stop", "exit", "quit"]: |
| 161 | break | 162 | break |
| 162 | first_line = note[:16] | 163 | first_line = note[:16] |
