From ce75000d4e6f38c8143c1eb0cafe2756d903c6ed Mon Sep 17 00:00:00 2001 From: Mark Tearle Date: Wed, 22 Sep 2004 12:45:51 +0000 Subject: [PATCH] Working String Idler --- sql-edition/servers/Idler.py | 28 +++++++++++++++++++++++----- sql-edition/servers/VendServer.py | 12 +++++++++++- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/sql-edition/servers/Idler.py b/sql-edition/servers/Idler.py index d2cbabb..48e819a 100755 --- a/sql-edition/servers/Idler.py +++ b/sql-edition/servers/Idler.py @@ -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) diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index 8942855..c82dda8 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -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="-"), -- 2.20.1