Working String Idler
authorMark Tearle <mtearle@ucc.gu.uwa.edu.au>
Wed, 22 Sep 2004 12:45:51 +0000 (12:45 +0000)
committerMark Tearle <mtearle@ucc.gu.uwa.edu.au>
Wed, 22 Sep 2004 12:45:51 +0000 (12:45 +0000)
sql-edition/servers/Idler.py
sql-edition/servers/VendServer.py

index d2cbabb..48e819a 100755 (executable)
@@ -183,15 +183,33 @@ class GrayIdler(Idler):
 
 
 class StringIdler(Idler):
-       def __init__(self, v, text="Hello Cruel World!"):
+       def __init__(self, v, text="Hello Cruel World!  "):
                self.v = v
                self.mk = MessageKeeper(v)
-               self.text = text
+               self.text = self.clean_text(text)
+               
+               msg = [("",False, None),(self.text, True, 0.8)]
+               self.mk.set_messages(msg)
+
+       def clean_text(self, text):
+               # nothing like a bit of good clean text :)
+               valid = string.digits \
+                       + string.letters \
+                       + string.punctuation \
+                       + " "
+               # uppercase it
+               text = string.upper(text)
+               clean = ""
+               for char in text:
+                       if char in valid:
+                               clean = clean + char
+                       else:
+                               clean = clean + " "
+               return clean
 
        def next(self):
-               #self.mk.update_display(forced=True)
                self.mk.update_display()
 
        def reset(self):
-               msg = [(self.text, True, 0.8)]
-               self.mk.set_messages(msg)
+               pass
+               #self.mk.update_display(forced=True)
index 8942855..c82dda8 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
@@ -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,14 @@ def center(str):
 
 idlers = []
 idler = None
+
 def setup_idlers(v):
        global idlers, idler
        idlers = [
                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="-"),

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