Fix selection of effect

This commit is contained in:
Jan Klopper 2018-04-03 16:15:26 +02:00
parent dd72459b24
commit 07cd3eb9ed

View file

@ -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: