Contains a title and widgets. When the title is clicked, the contained widgets are hidden. Its scope is to provide a foldable group
| 680 | |
| 681 | |
| 682 | class EditorAttributesGroup(gui.VBox): |
| 683 | """ Contains a title and widgets. When the title is clicked, the contained widgets are hidden. |
| 684 | Its scope is to provide a foldable group |
| 685 | """ |
| 686 | |
| 687 | def __init__(self, title, **kwargs): |
| 688 | super(EditorAttributesGroup, self).__init__(**kwargs) |
| 689 | self.add_class('.RaisedFrame') |
| 690 | #self.style['display'] = 'block' |
| 691 | self.container = gui.HBox(width="100%", style={ |
| 692 | 'overflow': 'visible', 'justify-content': 'flex-start', 'align-items': 'flex-start', 'flex-wrap': 'wrap'}) |
| 693 | self.container.css_justify_content = 'flex-start' |
| 694 | self.opened = True |
| 695 | self.title = gui.Label(title, width='100%') |
| 696 | self.title.add_class("Title") |
| 697 | self.title.style.update({'text-indent': '25px', |
| 698 | 'background-image': "url('/editor_resources:minus.png')", |
| 699 | 'background-repeat': 'no-repeat', |
| 700 | 'background-position': '5px', |
| 701 | 'border-top': '3px solid lightgray'}) |
| 702 | self.title.onclick.do(self.openClose) |
| 703 | super(EditorAttributesGroup, self).append(self.title) |
| 704 | super(EditorAttributesGroup, self).append(self.container) |
| 705 | |
| 706 | def openClose(self, widget): |
| 707 | self.opened = not self.opened |
| 708 | backgroundImage = "url('/editor_resources:minus.png')" if self.opened else "url('/editor_resources:plus.png')" |
| 709 | self.title.style['background-image'] = backgroundImage |
| 710 | self.container.css_display = 'flex' if self.opened else 'none' |
| 711 | |
| 712 | def append(self, widget, key=''): |
| 713 | return self.container.append(widget, key) |
| 714 | |
| 715 | def remove_child(self, widget): |
| 716 | return self.container.remove_child(widget) |
| 717 | |
| 718 | |
| 719 | class EditorAttributes(gui.VBox): |
no outgoing calls
no test coverage detected