A Greeting Idler
authorBernard Blackham <[email protected]>
Sat, 7 May 2005 12:00:38 +0000 (12:00 +0000)
committerBernard Blackham <[email protected]>
Sat, 7 May 2005 12:00:38 +0000 (12:00 +0000)
sql-edition/servers/Idler.py

index 22285de..07be6ab 100755 (executable)
@@ -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

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