X-Git-Url: https://git.ucc.asn.au/?p=zanchey%2Fdispense2.git;a=blobdiff_plain;f=sql-edition%2Fservers%2FIdler.py;h=e56f8d755d0bab59c251c2a05231f3fd72a1920b;hp=2670b51e036c2963b0ee148c86d390406f1a038e;hb=1532e6ecbe484e7d181b12d200f4819d160accde;hpb=8c91f790250d69e2787329f54182d8d56fe2e67d diff --git a/sql-edition/servers/Idler.py b/sql-edition/servers/Idler.py index 2670b51..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): @@ -248,10 +254,10 @@ class FortuneIdler(StringIdler): return 20 class PipeIdler(StringIdler): - def __init__(self, v, command): + def __init__(self, v, command, args): text = "I ate my cookie...." if os.access(command,os.F_OK|os.X_OK): - (stdout, stdin) = popen2.popen2(command) + (stdout, stdin) = popen2.popen2(command+' '+args) text = string.join(stdout.readlines()) stdout.close() stdin.close()