Exemple #1
0
    def __init__(self,
                 wall,
                 nocam=False,
                 effects=Effects,
                 effect_order="random"):
        """
        wall: Wall object
        nocam: boolean indicating if a camera is being used
        effects: list of Effect classes
        effect_order: string describing the order in which effects will be
            displayed. The supported options are 'random' and 'serial'.
        """
        self.wall = wall
        self.nocam = nocam
        if not self.nocam:
            self.watcher = Watcher()
        else:
            self.watcher = DebugWatcher()

        # Filter out effects that won't run with this wall's dimensions.
        self.effects = filter(
            lambda effect: effect.run_on_wall(self.wall.width, self.wall.height
                                              ), effects)

        if not len(self.effects):
            print "None of the provided effects can run on this %d x %d wall." % (
                self.wall.width, self.wall.height)
            sys.exit(1)

        self.effect_order = effect_order
        if self.effect_order == "serial":
            self.current_effect = 0