add support for one shot Idlers
[zanchey/dispense2.git] / sql-edition / servers / VendServer.py
index 7c4a278..eda4dc9 100755 (executable)
@@ -4,7 +4,7 @@
 USE_DB = 0
 
 import ConfigParser
-import sys, os, string, re, pwd, signal
+import sys, os, string, re, pwd, signal, math
 import logging, logging.handlers
 from traceback import format_tb
 if USE_DB: import pg
@@ -15,7 +15,7 @@ from VendingMachine import VendingMachine, VendingException
 from MessageKeeper import MessageKeeper
 from HorizScroll import HorizScroll
 from random import random, seed
-from Idler import TrainIdler,GrayIdler,StringIdler
+from Idler import TrainIdler,GrayIdler,StringIdler,ClockIdler
 import socket
 from posix import geteuid
 
@@ -26,6 +26,13 @@ Mark Tearle
 Nick Bannon
 Cameron Patrick
 and a collective of hungry alpacas.
+
+
+
+For a good time call +61 8 6488 3901
+
+
+
 """
 
 GREETING = 'UCC SNACKS'
@@ -178,11 +185,17 @@ def center(str):
 
 idlers = []
 idler = None
+
 def setup_idlers(v):
        global idlers, idler
        idlers = [
-               TrainIdler(v),
+               ClockIdler(v),
+               StringIdler(v),
+               StringIdler(v, text=CREDITS),
+               StringIdler(v, text=str(math.pi) + "            "),
+               StringIdler(v, text=str(math.e) + "            "),
                GrayIdler(v),
+               TrainIdler(v),
                GrayIdler(v,one="*",zero="-"),
                GrayIdler(v,one="/",zero="\\"),
                GrayIdler(v,one="X",zero="O"),
@@ -190,8 +203,6 @@ def setup_idlers(v):
                GrayIdler(v,one="/",zero="\\",reorder=1),
                GrayIdler(v,one="X",zero="O",reorder=1),
                ]
-               #StringIdler(v),
-               #StringIdler(v, text=CREDITS),
        idler = choose_idler()
 
 def choose_idler():
@@ -201,6 +212,8 @@ def choose_idler():
 
 def idle_step():
        global idler
+       if idler.finished():
+               choose_idler()
        idler.next()
 
 def run_forever(rfh, wfh, options, cf):

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