Args: text (str): The text that will be displayed on the label. kwargs: See Widget.__init__()
(self, text='bit status widget', db_index=-1, byte_index=-1, bit_index=-1, *args, **kwargs)
| 387 | label_value = None #a gui.Label widget that shows the value as '1' or '0' |
| 388 | |
| 389 | def __init__(self, text='bit status widget', db_index=-1, byte_index=-1, bit_index=-1, *args, **kwargs): |
| 390 | """ |
| 391 | Args: |
| 392 | text (str): The text that will be displayed on the label. |
| 393 | kwargs: See Widget.__init__() |
| 394 | """ |
| 395 | default_style = {'position':'absolute','left':'10px','top':'10px', 'align-items':'stretch', 'justify-content':'flex-start'} |
| 396 | default_style.update(kwargs.get('style',{})) |
| 397 | kwargs['style'] = default_style |
| 398 | kwargs['width'] = kwargs['style'].get('width', kwargs.get('width','100px')) |
| 399 | kwargs['height'] = kwargs['style'].get('height', kwargs.get('height','30px')) |
| 400 | super(BitStatusWidget, self).__init__(*args, **kwargs) |
| 401 | SiemensWidget._setup(self) |
| 402 | _style = style_inheritance_text_dict |
| 403 | _style.update(style_inheritance_dict) |
| 404 | _style['border'] = '1px solid black' |
| 405 | self.label = gui.Label(text, width="100%", height="100%", style=_style) |
| 406 | _style.update({'background-color':'gray', 'text-align':'center'}) |
| 407 | self.label_value = gui.Label("0", width='30px', height="100%", style=_style) |
| 408 | self.append([self.label, self.label_value]) |
| 409 | self.db_index = db_index |
| 410 | self.byte_index = byte_index |
| 411 | self.bit_index = bit_index |
| 412 | |
| 413 | def update(self, *args): |
| 414 | if self.plc_instance==None: |