Example #1
0
    def __init__(self, title, content=None, is_open=True, align=HALIGN_CENTER):
        Controller.__init__(self)
        if align == HALIGN_LEFT:
            left_expand = False
            right_expand = True
        elif align == HALIGN_CENTER:
            left_expand = True
            right_expand = True
        else:  # HALIGN_RIGHT
            left_expand = True
            right_expand = False

        self.is_open = is_open
        self.folding_content = content
        self.book = Graphic(self._get_image_path())

        self.header = HorizontalContainer([Graphic(path=["section", "left"], is_expandable=left_expand),
                                           Frame(HorizontalContainer([
                                               self.book,
                                               Label(title, path=["section"]),
                                               ]), path=["section", "center"]),
                                           Graphic(path=["section", "right"], is_expandable=right_expand),
                                           ], align=VALIGN_BOTTOM, padding=0)
        layout = [self.header]
        if self.is_open:
            layout.append(self.folding_content)

        VerticalContainer.__init__(self, content=layout, align=align)
Example #2
0
    def set_manager(self, manager):
        Controller.set_manager(self, manager)

        self.header.set_manager(manager)
        self.header.parent = self

        for item in self._content:
            if item == self.header:
                continue
            item.set_manager(self._manager)
            item.parent = self