Exemple #1
0
    def _evaluate(self):
        color_lists = self.patterns()
        assert len(color_lists) == 1
        color_list = color_lists[0]

        columns = self.get('columns') or getattr(color_list, 'columns', 0)
        rows = self.get('rows')

        if rows:
            columns = columns or cechomesh.compute_rows(len(color_list), rows)
        elif columns:
            rows = cechomesh.compute_rows(len(color_list), columns)
        else:
            columns, rows = Settings.get('light', 'visualizer', 'layout')

        return cechomesh.mirror_color_list(
          color_list, int(columns), int(rows),
          bool(self.get('reverse_x')), bool(self.get('reverse_y')))
Exemple #2
0
    def _evaluate(self):
        color_lists = self.patterns()
        assert len(color_lists) == 1
        color_list = color_lists[0]

        columns = self.get('columns') or getattr(color_list, 'columns', 0)
        rows = self.get('rows')

        if rows:
            columns = columns or cechomesh.compute_rows(len(color_list), rows)
        elif columns:
            rows = cechomesh.compute_rows(len(color_list), columns)
        else:
            columns, rows = Settings.get('light', 'visualizer', 'layout')

        return cechomesh.mirror_color_list(color_list, int(columns), int(rows),
                                           bool(self.get('reverse_x')),
                                           bool(self.get('reverse_y')))
Exemple #3
0
    def _evaluate_one(self, color_list):
        if not color_list:
            LOGGER.error('Empty input to Tile.')
            return color_list

        size = self.get('size')
        scale = self.get('scale')

        if scale:
            if size:
                LOGGER.warn('Ignoring scale in Tile pattern that has a size')
            else:
                columns = color_list.columns or len(color_list)
                rows = cechomesh.compute_rows(len(color_list), columns)
                size = [int(scale[0] * columns), int(scale[1] * rows)]
        elif not scale:
            LOGGER.error('No size or scale for Tile pattern.')
            return color_list

        center = [_CENTERING.get(c, c) for c in self.get('center')]
        return cechomesh.tile_colors(color_list, *(size + center))
Exemple #4
0
    def _evaluate_one(self, color_list):
        if not color_list:
            LOGGER.error('Empty input to Tile.')
            return color_list

        size = self.get('size')
        scale = self.get('scale')

        if scale:
            if size:
                LOGGER.warn('Ignoring scale in Tile pattern that has a size')
            else:
                columns = color_list.columns or len(color_list)
                rows = cechomesh.compute_rows(len(color_list), columns)
                size = [int(scale[0] * columns), int(scale[1] * rows)]
        elif not scale:
            LOGGER.error('No size or scale for Tile pattern.')
            return color_list

        center = [_CENTERING.get(c, c) for c in self.get('center')]
        return cechomesh.tile_colors(color_list, *(size + center))