Mercurial > code > home > repos > light-bridge
comparison light.py @ 6:fc8ed0efcd72
move init to Lights
author | drewp@bigasterisk.com |
---|---|
date | Sun, 28 Jan 2024 16:02:31 -0800 |
parents | 7eeda7f4f9cd |
children | 9f427d8073c3 |
comparison
equal
deleted
inserted
replaced
5:7eeda7f4f9cd | 6:fc8ed0efcd72 |
---|---|
32 | 32 |
33 | 33 |
34 class Lights: | 34 class Lights: |
35 _d: dict[str, Light] = {} | 35 _d: dict[str, Light] = {} |
36 | 36 |
37 def __init__(self): | |
38 self.add(Light('do-desk', 'topic1', True, Color('#ff0000'), {'r': 255}, Color('#000000'), 100)) | |
39 self.add(Light('do-desk2', 'topic2', True, Color('#ff00ff'), {'r': 255}, Color('#000000'), 200)) | |
40 | |
37 def add(self, d: Light): | 41 def add(self, d: Light): |
38 self._d[d.name] = d | 42 self._d[d.name] = d |
39 | 43 |
40 def byName(self, name: str) -> Light: | 44 def byName(self, name: str) -> Light: |
41 return self._d[name] | 45 return self._d[name] |