commit 053ad43f36135603487e00e6256f200b598b4cf2
parent 1565979b6f85d14a76ba6acde59898fdb2653e57
Author: rbckman <rob@tarina.org>
Date: Sat, 23 Nov 2024 21:41:39 +0200
keyppare support
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/ugnen.py b/ugnen.py
@@ -124,7 +124,7 @@ def successbeep():
#load from last session
set_temp = load_temp()
-
+temp_input=''
with term.fullscreen(), term.cbreak(), term.hidden_cursor():
while 1:
run_time = time.time() - start_time
@@ -142,6 +142,17 @@ with term.fullscreen(), term.cbreak(), term.hidden_cursor():
if temp != '':
new_temp = str(temp)
time.sleep(1)
+ val = term.inkey(timeout=1)
+ if val.is_sequence:
+ event=val.name
+ elif val:
+ event=val
+ else:
+ event=''
+ if event.isdigit():
+ temp_input+=event
+ elif event=='KEY_ENTER' or event==10 or event==13:
+ new_temp=temp_input
print(term.clear)
print(term.bold_yellow('Temperature is now ' + new_temp + ' ℃'))
print(term.bold_yellow('Temperature is set for ' + str(set_temp) + ' ℃'))