#!/usr/bin/env python
-import string, time
+import string, time, popen2, os
from random import random
from MessageKeeper import MessageKeeper
def finished(self):
return False
+ def affinity(self):
+ return 1
+
class TrainIdler(Idler):
def __init__(self, v):
self.idle_state = 0
if output != self.last:
self.v.display(" %8.8s " % (output))
self.last = output
+
+class FortuneIdler(StringIdler):
+ def __init__(self, v):
+ fortune = "/usr/games/fortune"
+ text = "I broke my wookie...."
+ if os.access(fortune,os.F_OK|os.X_OK):
+ (stdout, stdin) = popen2.popen2(fortune)
+ text = string.join(stdout.readlines())
+ stdout.close()
+ stdin.close()
+ StringIdler.__init__(self, v, text,repeat=False)
+
+ def affinity(self):
+ return 15
from MessageKeeper import MessageKeeper
from HorizScroll import HorizScroll
from random import random, seed
-from Idler import TrainIdler,GrayIdler,StringIdler,ClockIdler
+from Idler import TrainIdler,GrayIdler,StringIdler,ClockIdler,FortuneIdler
import socket
from posix import geteuid
def setup_idlers(v):
global idlers, idler
idlers = [
- ClockIdler(v),
StringIdler(v, text="Kill 'em all", repeat=False),
StringIdler(v, text=CREDITS),
StringIdler(v, text=str(math.pi) + " "),
StringIdler(v, text=str(math.e) + " "),
StringIdler(v),
+ FortuneIdler(v),
+ ClockIdler(v),
GrayIdler(v),
TrainIdler(v),
GrayIdler(v,one="*",zero="-"),