def addToLayout(self, analysis, position=None):
        """ Adds the analysis passed in to the worksheet's layout
        """
        # TODO Redux
        layout = self.getLayout()
        container_uid = self.get_container_for(analysis)
        if IRequestAnalysis.providedBy(analysis) and \
                not IDuplicateAnalysis.providedBy(analysis):
            container_uids = map(lambda slot: slot['container_uid'], layout)
            if container_uid in container_uids:
                position = [int(slot['position']) for slot in layout if
                            slot['container_uid'] == container_uid][0]
            elif not position:
                used_positions = [0, ] + [int(slot['position']) for slot in
                                          layout]
                position = [pos for pos in range(1, max(used_positions) + 2)
                            if pos not in used_positions][0]

        an_type = self.get_analysis_type(analysis)
        self.setLayout(layout + [{'position': position,
                                  'type': an_type,
                                  'container_uid': container_uid,
                                  'analysis_uid': api.get_uid(analysis)}, ])
def addToLayout ( self , analysis , position = None ) : layout = self . getLayout ( ) container_uid = self . get_container_for ( analysis ) if IRequestAnalysis . providedBy ( analysis ) and not IDuplicateAnalysis . providedBy ( analysis ) : container_uids = map ( lambda slot : slot [ 'container_uid' ] , layout ) if container_uid in container_uids : position = [ int ( slot [ 'position' ] ) for slot in layout if slot [ 'container_uid' ] == container_uid ] [ 0 ] elif not position : used_positions = [ 0 , ] + [ int ( slot [ 'position' ] ) for slot in layout ] position = [ pos for pos in range ( 1 , max ( used_positions ) + 2 ) if pos not in used_positions ] [ 0 ] an_type = self . get_analysis_type ( analysis ) self . setLayout ( layout + [ { 'position' : position , 'type' : an_type , 'container_uid' : container_uid , 'analysis_uid' : api . get_uid ( analysis ) } , ] )
Adds the analysis passed in to the worksheet's layout