| 163 | label_value = None # the gui.Label used to show the value 0 or 1 |
| 164 | |
| 165 | def __init__(self, epics_pv_name='', *args, **kwargs): |
| 166 | self.color_inactive = 'darkgray' |
| 167 | self.color_active = 'rgb(0,180,0)' |
| 168 | default_style = {'position':'absolute','left':'10px','top':'10px', 'color':'white','background-color':self.color_inactive, 'align-items':'center', 'justify-content':'center'} |
| 169 | default_style.update(kwargs.get('style',{})) |
| 170 | kwargs['style'] = default_style |
| 171 | kwargs['width'] = kwargs['style'].get('width', kwargs.get('width','50px')) |
| 172 | kwargs['height'] = kwargs['style'].get('height', kwargs.get('height','50px')) |
| 173 | super(EPICSLed, self).__init__(*args, **kwargs) |
| 174 | _style = {'text-align':'center'} |
| 175 | _style.update(style_inheritance_text_dict) |
| 176 | self.label_value = gui.Label("0", style=_style) |
| 177 | self.append(self.label_value) |
| 178 | self.epics_pv_name = epics_pv_name |
| 179 | |
| 180 | def _update_size(self): |
| 181 | width = gui.from_pix(self.style.get('width', "100").replace("%","")) |