From: Bernard Blackham Date: Sat, 7 May 2005 12:00:38 +0000 (+0000) Subject: A Greeting Idler X-Git-Tag: IMPORT-FROM-UCCCVS~32 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=0641ff03b772c74ccb868c536514e5be9420953b;p=uccvend-vendserver.git A Greeting Idler --- diff --git a/sql-edition/servers/Idler.py b/sql-edition/servers/Idler.py index 22285de..07be6ab 100755 --- a/sql-edition/servers/Idler.py +++ b/sql-edition/servers/Idler.py @@ -13,8 +13,8 @@ class Idler: self.v = v def next(self): - """Displays next stage of the idler""" - pass + """Displays next stage of the idler. Returns time to the next step""" + return 1 def reset(self): """Resets the idler to a known intial state""" @@ -28,6 +28,29 @@ class Idler: """How much we want this idler to be the next one chosen""" return 1 +class GreetingIdler(Idler): + def __init__(self, v, secs_to_greeting = None): + self.v = v + self.secs_to_greeting = secs_to_greeting + + def next(self): + if not self.secs_to_greeting is None: + x = self.secs_to_greeting + self.secs_to_greeting = None + return x + + self.v.display('UCC SNACKS') + return 2 + + def reset(self): + pass + + def finished(self): + return self.secs_to_greeting == None + + def affinity(self): + return 0 + class TrainIdler(Idler): def __init__(self, v): self.idle_state = 0