From 1972d80d8e9f8ff56be387a02930ad136079c3c5 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Fri, 15 Jun 2012 02:02:36 +0200 Subject: [PATCH] plugin-barcode: exit delay() when input on stdin --- client-barcode/freitagskasse.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client-barcode/freitagskasse.py b/client-barcode/freitagskasse.py index 8a334ab..aa4308f 100644 --- a/client-barcode/freitagskasse.py +++ b/client-barcode/freitagskasse.py @@ -93,8 +93,10 @@ def delay(what, seconds): sys.stdout.write('\r') sys.stdout.write('%s in %d Sekunden... ' % (what, i)) sys.stdout.flush() - time.sleep(1) - + (read_list, _, _) = select([sys.stdin], [], [], 1) + if len(read_list) > 0: + # input on stdin, quit delay + return def warn_balance(): print('Kontostand im Minus, bitte Geld aufladen.')