| 875 | label = None # widget |
| 876 | |
| 877 | def __init__(self, widget, attributeName, propertyDef, attributeDict, appInstance, *args, **kwargs): |
| 878 | _style = {'display': 'block', |
| 879 | 'overflow': 'hidden', |
| 880 | 'margin': '2px', |
| 881 | 'outline': '1px solid lightgray', |
| 882 | 'width': '100%'} |
| 883 | if 'style' in kwargs.keys(): |
| 884 | kwargs['style'].update(_style) |
| 885 | else: |
| 886 | kwargs['style'] = _style |
| 887 | |
| 888 | super(EditorAttributeInputBase, self).__init__(*args, **kwargs) |
| 889 | |
| 890 | self.targetWidget = widget |
| 891 | self.propertyDef = propertyDef |
| 892 | self.attributeName = attributeName |
| 893 | self.attributeDict = attributeDict |
| 894 | self.appInstance = appInstance |
| 895 | self.removeAttribute = gui.Image( |
| 896 | '/editor_resources:delete.png', width='10px') |
| 897 | self.removeAttribute.attributes['title'] = 'Remove attribute from this widget.' |
| 898 | self.removeAttribute.onclick.do(self.on_attribute_remove) |
| 899 | |
| 900 | self.label = gui.Label(attributeName, width='100%', height="100%", style={ |
| 901 | 'overflow': 'hidden', 'font-size': '13px', 'margin': '0px'}) |
| 902 | self.label.attributes['title'] = attributeDict['description'] |
| 903 | |
| 904 | if not self.propertyDef.fdel is None: |
| 905 | self.append({'del': self.removeAttribute, 'lbl': self.label}) |
| 906 | else: |
| 907 | self.append({'lbl': self.label}) |
| 908 | |
| 909 | self.set_valid(False) |
| 910 | |
| 911 | def set_valid(self, valid=True): |
| 912 | self.label.style['opacity'] = '1.0' |