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 = ''
e = v.next_event(0.1)
if e == None:
continue
+ time_to_idle = None
(event, params) = e
print e
if event == DOOR:
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 = ''
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)
#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':
v.display('THANK YOU')
sleep(0.5)
cur_selection = ''
- time_to_autologout = time() + 10
+ time_to_autologout = time() + 8