Fix selection of effect
This commit is contained in:
parent
dd72459b24
commit
07cd3eb9ed
1 changed files with 7 additions and 10 deletions
15
client.py
15
client.py
|
|
@ -46,18 +46,11 @@ def RunClient(options):
|
|||
screen = Packet(client)
|
||||
# loop the effect until we cancel by pressing ctrl+c / exit the program
|
||||
|
||||
# we run the effect that has been given trough the -e flag.
|
||||
# This defaults to RandomFill
|
||||
if options.effect:
|
||||
effect = locals()[options.effect]
|
||||
else:
|
||||
effect = RandomFill
|
||||
|
||||
while screen:
|
||||
|
||||
# add some pixels to the screen with our functions
|
||||
# the width/height are read from the client's config
|
||||
effect(screen, client.width, client.height)
|
||||
options.effect(screen, client.width, client.height)
|
||||
|
||||
if __name__ == '__main__':
|
||||
# if this script is called from the command line, and thus not imported
|
||||
|
|
@ -74,10 +67,14 @@ if __name__ == '__main__':
|
|||
type="int", help="Width of the server's screen")
|
||||
parser.add_option('-y', action="store", dest="height", default=None,
|
||||
type="int", help="Height of the server's screen")
|
||||
parser.add_option('-e', action="store", dest="effect", default=None,
|
||||
parser.add_option('-e', action="store", dest="effect", default='RandomFill',
|
||||
type="str", help="Which effect to run.")
|
||||
options, remainder = parser.parse_args()
|
||||
|
||||
# we run the effect that has been given trough the -e flag.
|
||||
# This defaults to RandomFill
|
||||
options.effect = locals()[options.effect]
|
||||
|
||||
try:
|
||||
RunClient(options)
|
||||
except KeyboardInterrupt:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue