Browse Source

plugin-barcode: exit delay() when input on stdin

Sebastian Lohff 8 years ago
parent
commit
1972d80d8e
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      client-barcode/freitagskasse.py

+ 4
- 2
client-barcode/freitagskasse.py View File

@@ -93,8 +93,10 @@ def delay(what, seconds):
93 93
 			sys.stdout.write('\r')
94 94
 		sys.stdout.write('%s in %d Sekunden... ' % (what, i))
95 95
 		sys.stdout.flush()
96
-		time.sleep(1)
97
-
96
+		(read_list, _, _) = select([sys.stdin], [], [], 1)
97
+		if len(read_list) > 0:
98
+			# input on stdin, quit delay
99
+			return
98 100
 
99 101
 def warn_balance():
100 102
 	print('Kontostand im Minus, bitte Geld aufladen.')

Loading…
Cancel
Save