forked from jesstesstest/ColorWall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
29 lines (23 loc) · 900 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
import optparse, sys
from wall import Wall
import effects
if __name__ == "__main__":
parser = optparse.OptionParser("""Usage: %prog [options]""")
parser.add_option("-w", "--width", type="int",
action="store", dest="width",
default=8, help="wall width")
parser.add_option("-t", "--height", type="int",
action="store", dest="height",
default=8, help="wall height")
(opts, args) = parser.parse_args(sys.argv[1:])
wall = Wall(opts.width, opts.height)
if args:
effects_to_run = [getattr(effects, a) for a in args \
if hasattr(effects, a)]
else:
effects_to_run = effects.Effects
for effect in effects_to_run:
new_effect = effect(wall)
print new_effect.__class__.__name__
new_effect.run()