def __init__(self, *,
                 drivers, layout, maker, path, animation, controls,
                 edit_queue_maxsize=EDIT_QUEUE_MAXSIZE, **kwds):
        """
        :param int edit_queue_maxsize: maxsize parameter to queue.Queue.
            0 means an unbounded queue.
        """
        self.needs_cleanup = False

        def create(root, name):
            def post(desc):
                exception = desc.get('_exception')
                if exception:
                    raise exception
                return self.construct_child(name, **desc)

            with exception.add('Unable to create ' + name):
                return recurse.recurse(
                    root,
                    pre=None,
                    post=post,
                    python_path='bibliopixel.' + name)

        attributes.check(kwds, 'project')
        self.path = path
        layout = layout or fill.fill_layout(animation)
        self.maker = self.construct_child('maker', **maker)
        self.drivers = [create(d, 'drivers') for d in drivers]
        with exception.add('Unable to create layout'):
            self.layout = self.construct_child('layout', **layout)

        self.animation = create(animation, 'animation')
        self.running = False
        self.clock = clock.Clock()

        eq = edit_queue.EditQueue(maxsize=edit_queue_maxsize)
        self.layout.edit_queue = self.animation.edit_queue = eq
        self.animation.add_preframe_callback(eq.get_and_run_edits)

        # Unfortunately, the whole animation cycle is controlled by methods on
        # the topmost animation - but we need to get called back at a certain
        # point in that animation cycle in order to run the edit queue safely -
        # and animations don't know about the Project!
        #
        # So the monkey-patch above.  Ugly.  When we rewrite the
        # animation cycle, it will be freed from the topmost animation, and
        # this problem will go away.

        self.controls = [create(c, 'control') for c in controls]

        for d in self.drivers:
            d.set_project(self)

        self.animation.set_project(self)
def __init__ ( self , * , drivers , layout , maker , path , animation , controls , edit_queue_maxsize = EDIT_QUEUE_MAXSIZE , ** kwds ) : self . needs_cleanup = False def create ( root , name ) : def post ( desc ) : exception = desc . get ( '_exception' ) if exception : raise exception return self . construct_child ( name , ** desc ) with exception . add ( 'Unable to create ' + name ) : return recurse . recurse ( root , pre = None , post = post , python_path = 'bibliopixel.' + name ) attributes . check ( kwds , 'project' ) self . path = path layout = layout or fill . fill_layout ( animation ) self . maker = self . construct_child ( 'maker' , ** maker ) self . drivers = [ create ( d , 'drivers' ) for d in drivers ] with exception . add ( 'Unable to create layout' ) : self . layout = self . construct_child ( 'layout' , ** layout ) self . animation = create ( animation , 'animation' ) self . running = False self . clock = clock . Clock ( ) eq = edit_queue . EditQueue ( maxsize = edit_queue_maxsize ) self . layout . edit_queue = self . animation . edit_queue = eq self . animation . add_preframe_callback ( eq . get_and_run_edits ) self . controls = [ create ( c , 'control' ) for c in controls ] for d in self . drivers : d . set_project ( self ) self . animation . set_project ( self )
:param int edit_queue_maxsize: maxsize parameter to queue.Queue.
            0 means an unbounded queue.