+
+class PipeIdler(StringIdler):
+ def __init__(self, v, command, args):
+ text = "I ate my cookie...."
+ if os.access(command,os.F_OK|os.X_OK):
+ (lines, unused) = Popen([command,] + args.split(), close_fds=True, stdout=PIPE).communicate()
+ text = string.join(lines)
+ StringIdler.__init__(self, v, text,repeat=False)
+
+ def affinity(self):
+ return 20
+
+class FileIdler(StringIdler):
+ def __init__(self, v, thefile=None, repeat=False, affinity=8):
+ text = "I broke my wookie...."
+ self._affinity = affinity
+
+ if file and os.access(thefile,os.F_OK|os.R_OK):
+ f = file(thefile,'r')
+ text = string.join(f.readlines())
+ f.close()
+ StringIdler.__init__(self, v, text,repeat=repeat)
+
+ def affinity(self):
+ return self._affinity