Exemple #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)
Exemple #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)
Exemple #3
0
    def __init__(self, text="", window=None, batch=None, group=None,
                 theme=None, on_escape=None, have_focus=False):
        def on_ok(_):
            if on_escape is not None:
                on_escape(self)
            self.delete()

        button = FocusButton("Ok", on_press=on_ok)
        Manager.__init__(self, content=Frame(VerticalContainer(
                         [Label(text), button])),
                         window=window, batch=batch, group=group,
                         theme=theme, is_movable=True)
        Manager.set_next_focus(self, 1)
Exemple #4
0
    def __init__(self, text="", ok="Ok", cancel="Cancel",
                 window=None, batch=None, group=None, theme=None,
                 on_ok=None, on_cancel=None):
        def on_ok_click(_):
            if on_ok is not None:
                on_ok(self)
            self.delete()

        def on_cancel_click(_):
            if on_cancel is not None:
                on_cancel(self)
            self.delete()

        Manager.__init__(self, content=Frame(
            VerticalContainer([
                Label(text),
                HorizontalContainer([Button(ok, on_press=on_ok_click),
                                     None,
                                     Button(cancel, on_press=on_cancel_click)]
                )])
        ), window=window, batch=batch, group=group, theme=theme, is_movable=True)
Exemple #5
0
 def delete(self):
     if not self.is_open:
         self.folding_content.delete()
     self.folding_content = None
     VerticalContainer.delete(self)