Пример #1
0
 def _create_light_at_index(self, index, x, y):
     light = Light(self.machine, self.name + "_light_" + str(index))
     tags = [self.name]
     tags.extend(self.config['tags'])
     light_config = copy.deepcopy(self.config['light_template'])
     if self.config['number_template']:
         light_config['number'] = self.config['number_template'].format(
             index)
     else:
         light_config['number'] = index
     light_config['tags'].append(self.name)
     light_config['x'] = x
     light_config['y'] = y
     light_config = light.validate_and_parse_config(light_config, False)
     light.load_config(light_config)
     self.lights.append(light)
     self.machine.lights[light.name] = light
Пример #2
0
 def _create_light_at_index(self, index, x, y, relative_index):
     light = Light(self.machine,
                   "{}_light_{}".format(self.name, relative_index))
     tags = [self.name]
     tags.extend(self.config['tags'])
     light_config = copy.deepcopy(self.config['light_template'])
     if self.config['start_channel']:
         if relative_index == 0:
             light_config['start_channel'] = self.config['start_channel']
         else:
             light_config['previous'] = "{}_light_{}".format(
                 self.name, relative_index - 1)
     elif self.config['number_template']:
         light_config['number'] = self.config['number_template'].format(
             index)
     else:
         light_config['number'] = index
     light_config['tags'].append(self.name)
     light_config['x'] = x
     light_config['y'] = y
     light_config = light.validate_and_parse_config(light_config, False)
     light.load_config(light_config)
     self.lights.append(light)
     self.machine.lights[light.name] = light