From 3fadcc80c63166e67ba04f0696c2fc888195636a Mon Sep 17 00:00:00 2001 From: Bernard Blackham Date: Mon, 28 Jun 2004 02:12:35 +0000 Subject: [PATCH] Minor UI tweaks --- sql-edition/servers/VendServer.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index fa16f45..7021622 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -295,7 +295,7 @@ if __name__ == '__main__': if time_to_autologout != None: time_left = time_to_autologout - time() - if time_left < 5 and (last_timeout_refresh is None or last_timeout_refresh > time_left): + if time_left < 6 and (last_timeout_refresh is None or last_timeout_refresh > time_left): mk.set_message('LOGOUT: '+str(int(time_left))) last_timeout_refresh = int(time_left) cur_selection = '' @@ -324,6 +324,7 @@ if __name__ == '__main__': e = v.next_event(0.1) if e == None: continue + time_to_idle = None (event, params) = e print e if event == DOOR: @@ -348,10 +349,13 @@ if __name__ == '__main__': if len(cur_user) == 5: uid = int(cur_user) if not has_good_pin(uid): + #mk.set_messages( + #[(center('INVALID'), False, 0.7), + #(center('PIN'), False, 0.7), + #(center('SETUP'), False, 1.0), + #(GREETING, False, None)]) mk.set_messages( - [(center('INVALID'), False, 0.7), - (center('PIN'), False, 0.7), - (center('SETUP'), False, 1.0), + [(' '*10+'INVALID PIN SETUP'+' '*10, False, 3), (GREETING, False, None)]) cur_user = '' cur_pin = '' @@ -391,9 +395,9 @@ if __name__ == '__main__': cur_pin = '' cur_user = '' cur_selection = '' - v.display('BYE!') - sleep(0.5) - mk.set_message(GREETING) + mk.set_messages( + [(center('BYE!'), False, 1.5), + (GREETING, False, None)]) continue cur_selection += chr(key + ord('0')) mk.set_message('SELECT: '+cur_selection) @@ -409,8 +413,13 @@ if __name__ == '__main__': #make_selection(cur_selection) # XXX this should move somewhere else: if cur_selection == '55': - v.display('GOT DOOR?') - os.system('su - "%s" -c "dispense door"'%username) + mk.set_message('OPENSESAME') + ret = os.system('su - "%s" -c "dispense door"'%username) + if ret == 0: + mk.set_message(center('DOOR OPEN')) + else: + mk.set_message(center('BAD DOOR')) + sleep(1) elif cur_selection == '91': cookie(v) elif cur_selection == '99': @@ -427,4 +436,4 @@ if __name__ == '__main__': v.display('THANK YOU') sleep(0.5) cur_selection = '' - time_to_autologout = time() + 10 + time_to_autologout = time() + 8 -- 2.20.1