Minor UI tweaks
authorBernard Blackham <[email protected]>
Mon, 28 Jun 2004 02:12:35 +0000 (02:12 +0000)
committerBernard Blackham <[email protected]>
Mon, 28 Jun 2004 02:12:35 +0000 (02:12 +0000)
sql-edition/servers/VendServer.py

index fa16f45..7021622 100755 (executable)
@@ -295,7 +295,7 @@ if __name__ == '__main__':
 
                if time_to_autologout != None:
                        time_left = time_to_autologout - time()
 
                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 = ''
                                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
                        e = v.next_event(0.1)
                        if e == None:
                                continue
+               time_to_idle = None
                (event, params) = e
                print e
                if event == DOOR:
                (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):
                                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(
                                                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 = ''
                                                         (GREETING, False, None)])
                                                cur_user = ''
                                                cur_pin = ''
@@ -391,9 +395,9 @@ if __name__ == '__main__':
                                        cur_pin = ''
                                        cur_user = ''
                                        cur_selection = ''
                                        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)
                                        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':
                                        #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':
                                        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 = ''
                                        v.display('THANK YOU')
                                        sleep(0.5)
                                        cur_selection = ''
-                                       time_to_autologout = time() + 10
+                                       time_to_autologout = time() + 8

UCC git Repository :: git.ucc.asn.au