From: Mark Tearle Date: Fri, 6 May 2005 11:21:55 +0000 (+0000) Subject: document idlers and slow them down! X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=1532e6ecbe484e7d181b12d200f4819d160accde;p=zanchey%2Fdispense2.git document idlers and slow them down! typo fix --- diff --git a/sql-edition/servers/Idler.py b/sql-edition/servers/Idler.py index 89783e3..e56f8d7 100755 --- a/sql-edition/servers/Idler.py +++ b/sql-edition/servers/Idler.py @@ -6,20 +6,26 @@ from MessageKeeper import MessageKeeper orderings = None +IDLER_TEXT_SPEED=1.8 + class Idler: def __init__(self, v): self.v = v def next(self): + """Displays next stage of the idler""" pass def reset(self): + """Resets the idler to a known intial state""" pass def finished(self): + """Returns True if the idler is considered finished""" return False def affinity(self): + """How much we want this idler to be the next one chosen""" return 1 class TrainIdler(Idler): @@ -194,7 +200,7 @@ class StringIdler(Idler): self.mk = MessageKeeper(v) self.text = self.clean_text(text) + " " - msg = [("",False, None),(self.text, repeat, 0.8)] + msg = [("",False, None),(self.text, repeat, IDLER_TEXT_SPEED)] self.mk.set_messages(msg) def clean_text(self, text): diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index 19d3a30..12ebe5b 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -54,6 +54,7 @@ STATE_GET_SELECTION = 6 STATE_GRANDFATHER_CLOCK = 7 TEXT_SPEED = 0.8 +IDLE_SPEED = 0.02 class DispenseDatabaseException(Exception): pass @@ -89,7 +90,7 @@ class DispenseDatabase: def scroll_options(username, mk, welcome = False): if welcome: msg = [(center('WELCOME'), False, TEXT_SPEED), - (center(username), False, TEXT_SPEEd)] + (center(username), False, TEXT_SPEED)] else: msg = [] choices = ' '*10+'CHOICES: ' @@ -235,6 +236,7 @@ def idle_step(): global idler if idler.finished(): choose_idler() + sleep(IDLE_SPEED) idler.next() class VendState: