Пример #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)
Пример #2
0
 def __init__(self, title, content):
     VerticalContainer.__init__(self, content=[
         HorizontalContainer([Graphic(path=["titlebar", "left"], is_expandable=True),
                              Frame(Label(title, path=["titlebar"]),
                                    path=["titlebar", "center"]),
                              Graphic(path=["titlebar", "right"], is_expandable=True),
                              ], align=VALIGN_BOTTOM, padding=0),
         Frame(content, path=["titlebar", "frame"], is_expandable=True),
         ], padding=0)