示例#1
0
    def __init__(self, title, content=None, is_open=True, align=HALIGN_CENTER):
        Control.__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 = HorizontalLayout([
            Graphic(path=["section", "left"], is_expandable=left_expand),
            Frame(HorizontalLayout([
                      self.book,
                      Label(title, path=["section"]),
                  ]), path=["section", "center"],
                  use_bg_group=True),
            Graphic(path=["section", "right"], is_expandable=right_expand),
            ], align=VALIGN_BOTTOM, padding=0)
        layout = [self.header]
        if self.is_open:
            layout.append(content)

        VerticalLayout.__init__(self, content=layout, align=align)
示例#2
0
    def __init__(self, title, content=None, is_open=True, align=HALIGN_CENTER):
        Control.__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 = HorizontalLayout([
            Graphic(path=["section", "left"], is_expandable=left_expand),
            Frame(HorizontalLayout([
                self.book,
                Label(title, path=["section"]),
            ]),
                  path=["section", "center"],
                  use_bg_group=True),
            Graphic(path=["section", "right"], is_expandable=right_expand),
        ],
                                       align=VALIGN_BOTTOM,
                                       padding=0)
        layout = [self.header]
        if self.is_open:
            layout.append(content)

        VerticalLayout.__init__(self, content=layout, align=align)
示例#3
0
文件: menu.py 项目: isS/sy-game
 def __init__(self, options=[], align=HALIGN_CENTER, padding=4,
              on_select=None):
     self.align = align
     menu_options = self._make_options(options)
     self.options = dict(zip(options, menu_options))
     self.on_select = on_select
     self.selected = None
     VerticalLayout.__init__(self, menu_options,
                             align=align, padding=padding)
示例#4
0
 def __init__(self, title, content):
     VerticalLayout.__init__(self, content=[
             HorizontalLayout([
                 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)
示例#5
0
 def __init__(self, title, content):
     VerticalLayout.__init__(
         self,
         content=[
             HorizontalLayout([
                 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)
示例#6
0
 def __init__(self,
              options=[],
              align=HALIGN_CENTER,
              padding=4,
              on_select=None,
              option_padding_x=0,
              option_padding_y=0):
     self.align = align
     self.option_padding_x = option_padding_x
     self.option_padding_y = option_padding_y
     menu_options = self._make_options(options)
     self.options = dict(zip(options, menu_options))
     self.on_select = on_select
     self.selected = None
     VerticalLayout.__init__(self,
                             menu_options,
                             align=align,
                             padding=padding)