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)
def __init__(self, document, width=0, height=0, is_fixed_size=False, background=False, font_size=13, font_name='Segoe UI', font_color=None, chat=False): Viewer.__init__(self, width, height) Controller.__init__(self) self.max_height = height if isinstance(document, str): self._document = pyglet.text.document.UnformattedDocument(document) else: self._document = document self.h1 = height self.w1 = width self.chat = chat self.fontSize = font_size self.fontName = font_name self.fontColor = font_color self._bgcolor = background self._bg = None self._content = None self.content_width = width self._scrollbar = None self.set_document_style = False self.firstTimeLoad = True self.is_fixed_size = is_fixed_size
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)
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
def set_manager(self, manager): Controller.set_manager(self, manager) self._theme = manager.theme self.batch = manager.batch self.root_group = ScrollableGroup(0, 0, self.width, self.height, parent=manager.group['foreground']) self.group['panel'] = pyglet.graphics.OrderedGroup(0, self.root_group) self.group['background'] = pyglet.graphics.OrderedGroup(10, self.root_group) self.group['foreground'] = pyglet.graphics.OrderedGroup(20, self.root_group) self.group['highlight'] = pyglet.graphics.OrderedGroup(30, self.root_group) self.content.set_manager(self) self.content.parent = self
def __init__(self, document, width=0, height=0, is_fixed_size=False): Viewer.__init__(self, width, height) Controller.__init__(self) self.max_height = height if isinstance(document, str): self._document = pyglet.text.document.UnformattedDocument(document) else: self._document = document self._content = None self.content_width = width self._scrollbar = None self.set_document_style = False self.is_fixed_size = is_fixed_size
def set_manager(self, manager): Controller.set_manager(self, manager) self._theme = manager.theme self.batch = manager.batch self.root_group = ScrollableGroup(0, 0, self.width, self.height, parent=manager.group['foreground']) self.group['panel'] = pyglet.graphics.OrderedGroup(0, self.root_group) self.group['background'] = pyglet.graphics.OrderedGroup( 10, self.root_group) self.group['foreground'] = pyglet.graphics.OrderedGroup( 20, self.root_group) self.group['highlight'] = pyglet.graphics.OrderedGroup( 30, self.root_group) self.content.set_manager(self) self.content.parent = self
def delete(self): Controller.delete(self) Viewer.delete(self)