예제 #1
0
    def _evaluate(self):
        color_names = self.get_raw('colors')
        colors, error_colors = cechomesh.color_list_with_errors(color_names)
        if error_colors:
            raise Exception(
                '\nCan\'t understand %s: %s.' %
                (plural(len(error_colors), 'color'), ', '.join(error_colors)))

        steps = self.get('steps')
        total_steps = self.get('total_steps')
        max_steps = light_count(Settings.get)

        if not total_steps:
            if steps:
                total_steps = steps
                steps = None
            else:
                total_steps = None
                max_steps = len(colors)

        return cechomesh.color_spread(colors,
                                      self.get('model'),
                                      max_steps=max_steps,
                                      steps=steps,
                                      total_steps=total_steps,
                                      transform=self.get('transform'))
예제 #2
0
 def settings_update(self, get):
     if not self.count_set:
         self._set_count(light_count(get))
     self.brightness = Expression.convert(get('light', 'brightness'))
     if not self.period_set:
         self.period = Expression.convert(
             get('light', 'visualizer', 'period'))
예제 #3
0
    def _evaluate(self):
        color_names = self.get_raw('colors')
        colors, error_colors = cechomesh.color_list_with_errors(color_names)
        if error_colors:
            raise Exception('\nCan\'t understand %s: %s.' % (
                plural(len(error_colors), 'color'), ', '.join(error_colors)))

        steps = self.get('steps')
        total_steps = self.get('total_steps')
        max_steps = light_count(Settings.get)

        if not total_steps:
            if steps:
                total_steps = steps
                steps = None
            else:
                total_steps = None
                max_steps = len(colors)

        return cechomesh.color_spread(
          colors,
          self.get('model'),
          max_steps=max_steps,
          steps=steps,
          total_steps=total_steps,
          transform=self.get('transform'))
예제 #4
0
파일: Spi.py 프로젝트: TopRamenGod/echomesh
 def settings_update(self, get):
     if not self.count_set:
         self._set_count(light_count(get))
     self.brightness = Expression.convert(get('light', 'brightness'))
     if not self.period_set:
         self.period = Expression.convert(
             get('light', 'visualizer', 'period'))
예제 #5
0
    def _evaluate(self):
        color_lists = self.patterns()
        assert len(color_lists) == 1
        color_list = color_lists[0]

        skip = int(self.get('skip'))
        offset = int(self.get('offset'))
        length = self.get('length') or light_count(Settings.get)
        rollover = bool(self.get('rollover'))

        return cechomesh.insert_color_list(
            color_list, offset, length, rollover, skip)